企业端设备列表接口,企业端设备生命周期统计接口
redis加入一个分类key枚举类
This commit is contained in:
parent
69eef85a78
commit
05ce271bb9
32
inventory-dao/src/main/java/com/rzyc/enums/RedisKeys.java
Normal file
32
inventory-dao/src/main/java/com/rzyc/enums/RedisKeys.java
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package com.rzyc.enums;
|
||||
|
||||
|
||||
/**
|
||||
* Redis key 分类包
|
||||
* @author Xuwanxin
|
||||
* @date 2022/10/18
|
||||
* */
|
||||
|
||||
public enum RedisKeys {
|
||||
//企业岗位
|
||||
POST("entPost"),
|
||||
|
||||
//企业设备
|
||||
DEVICE("entDevice");
|
||||
|
||||
/*******分界线********/
|
||||
|
||||
private String key;
|
||||
|
||||
RedisKeys(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.rzyc.mapper;
|
||||
|
||||
import com.rzyc.model.EntDevice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@Repository
|
||||
public interface EntDeviceMapper extends BaseMapper<EntDevice> {
|
||||
|
||||
/**
|
||||
* 查询企业设备表
|
||||
* @param enterpriseId 企业id
|
||||
* @param typeId 设备类型id
|
||||
* @return list
|
||||
* */
|
||||
List<EntDevice>selectEntEquipmentList(@Param("enterpriseId") String enterpriseId,@Param("typeId") String typeId);
|
||||
|
||||
|
||||
/**
|
||||
* 企业设备保养和维修检查记录统计
|
||||
* @param enterpriseId 企业id
|
||||
* @param deviceId 设备id
|
||||
* @return EntDevice
|
||||
* */
|
||||
EntDevice entEquipmentStatistic(String enterpriseId, String deviceId);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.rzyc.mapper;
|
||||
|
||||
import com.rzyc.model.EntDeviceType;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备分类 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@Repository
|
||||
public interface EntDeviceTypeMapper extends BaseMapper<EntDeviceType> {
|
||||
|
||||
/**
|
||||
* 查询企业设备类型表
|
||||
* @param enterpriseId
|
||||
* @return list
|
||||
* */
|
||||
List<EntDeviceType>selectEntEquipmentTypeList(@Param("enterpriseId") String enterpriseId);
|
||||
|
||||
}
|
||||
259
inventory-dao/src/main/java/com/rzyc/model/EntDevice.java
Normal file
259
inventory-dao/src/main/java/com/rzyc/model/EntDevice.java
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
package com.rzyc.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@TableName("ent_device")
|
||||
@ApiModel(value="EntDevice对象", description="设备")
|
||||
public class EntDevice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
@TableId("device_id")
|
||||
private String deviceId;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
@TableField("number")
|
||||
private String number;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@TableField("model_num")
|
||||
private String modelNum;
|
||||
|
||||
@ApiModelProperty(value = "设备状态")
|
||||
@TableField("model_state")
|
||||
private Integer modelState;
|
||||
|
||||
@ApiModelProperty(value = "购买时间")
|
||||
@TableField("buy_time")
|
||||
private Date buyTime;
|
||||
|
||||
@ApiModelProperty(value = "出厂日期")
|
||||
@TableField("date_production")
|
||||
private Date dateProduction;
|
||||
|
||||
@ApiModelProperty(value = "安装时间")
|
||||
@TableField("installation_production")
|
||||
private Date installationTime;
|
||||
|
||||
@ApiModelProperty(value = "启用时间")
|
||||
@TableField("enable_time")
|
||||
private Date enableTime;
|
||||
|
||||
@ApiModelProperty(value = "报废时间")
|
||||
@TableField("scrap_time")
|
||||
private Date scrapTime;
|
||||
|
||||
@ApiModelProperty(value = "设备分类id")
|
||||
@TableField("type_id")
|
||||
private String typeId;
|
||||
|
||||
@ApiModelProperty(value = "设备分类路径")
|
||||
@TableField("type_path")
|
||||
private String typePath;
|
||||
|
||||
@ApiModelProperty(value = "企业id")
|
||||
@TableField("enterprise_id")
|
||||
private String enterpriseId;
|
||||
|
||||
@ApiModelProperty(value = "二维码地址")
|
||||
@TableField("qr_code")
|
||||
private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "删除状态 1:正常 2:已删除")
|
||||
@TableField("del_state")
|
||||
private Integer delState;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@TableField("create_by")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("modify_time")
|
||||
private Date modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
@TableField("modify_by")
|
||||
private String modifyBy;
|
||||
|
||||
public Date getInstallationTime() {
|
||||
return installationTime;
|
||||
}
|
||||
|
||||
public void setInstallationTime(Date installationTime) {
|
||||
this.installationTime = installationTime;
|
||||
}
|
||||
|
||||
public Date getEnableTime() {
|
||||
return enableTime;
|
||||
}
|
||||
|
||||
public void setEnableTime(Date enableTime) {
|
||||
this.enableTime = enableTime;
|
||||
}
|
||||
|
||||
public Date getScrapTime() {
|
||||
return scrapTime;
|
||||
}
|
||||
|
||||
public void setScrapTime(Date scrapTime) {
|
||||
this.scrapTime = scrapTime;
|
||||
}
|
||||
|
||||
public Date getDateProduction() {
|
||||
return dateProduction;
|
||||
}
|
||||
|
||||
public void setDateProduction(Date dateProduction) {
|
||||
this.dateProduction = dateProduction;
|
||||
}
|
||||
|
||||
public String getDeviceId() {
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId) {
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
public String getModelNum() {
|
||||
return modelNum;
|
||||
}
|
||||
|
||||
public void setModelNum(String modelNum) {
|
||||
this.modelNum = modelNum;
|
||||
}
|
||||
public Integer getModelState() {
|
||||
return modelState;
|
||||
}
|
||||
|
||||
public void setModelState(Integer modelState) {
|
||||
this.modelState = modelState;
|
||||
}
|
||||
public Date getBuyTime() {
|
||||
return buyTime;
|
||||
}
|
||||
|
||||
public void setBuyTime(Date buyTime) {
|
||||
this.buyTime = buyTime;
|
||||
}
|
||||
public String getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(String typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
public String getTypePath() {
|
||||
return typePath;
|
||||
}
|
||||
|
||||
public void setTypePath(String typePath) {
|
||||
this.typePath = typePath;
|
||||
}
|
||||
public String getEnterpriseId() {
|
||||
return enterpriseId;
|
||||
}
|
||||
|
||||
public void setEnterpriseId(String enterpriseId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
public String getQrCode() {
|
||||
return qrCode;
|
||||
}
|
||||
|
||||
public void setQrCode(String qrCode) {
|
||||
this.qrCode = qrCode;
|
||||
}
|
||||
public Integer getDelState() {
|
||||
return delState;
|
||||
}
|
||||
|
||||
public void setDelState(Integer delState) {
|
||||
this.delState = delState;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
public String getModifyBy() {
|
||||
return modifyBy;
|
||||
}
|
||||
|
||||
public void setModifyBy(String modifyBy) {
|
||||
this.modifyBy = modifyBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntDevice{" +
|
||||
"deviceId=" + deviceId +
|
||||
", name=" + name +
|
||||
", number=" + number +
|
||||
", modelNum=" + modelNum +
|
||||
", modelState=" + modelState +
|
||||
", buyTime=" + buyTime +
|
||||
", typeId=" + typeId +
|
||||
", typePath=" + typePath +
|
||||
", enterpriseId=" + enterpriseId +
|
||||
", qrCode=" + qrCode +
|
||||
", delState=" + delState +
|
||||
", createTime=" + createTime +
|
||||
", createBy=" + createBy +
|
||||
", modifyTime=" + modifyTime +
|
||||
", modifyBy=" + modifyBy +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
187
inventory-dao/src/main/java/com/rzyc/model/EntDeviceType.java
Normal file
187
inventory-dao/src/main/java/com/rzyc/model/EntDeviceType.java
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
package com.rzyc.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备分类
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2022-10-18
|
||||
*/
|
||||
@TableName("ent_device_type")
|
||||
@ApiModel(value="EntDeviceType对象", description="设备分类")
|
||||
public class EntDeviceType implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "设备分类id")
|
||||
@TableId("type_id")
|
||||
private String typeId;
|
||||
|
||||
@ApiModelProperty(value = "企业id")
|
||||
@TableField("enterprise_id")
|
||||
private String enterpriseId;
|
||||
|
||||
@ApiModelProperty(value = "分类名")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "分类logo")
|
||||
@TableField("logo")
|
||||
private String logo;
|
||||
|
||||
@ApiModelProperty(value = "父级分类")
|
||||
@TableField("parent_id")
|
||||
private String parentId;
|
||||
|
||||
@ApiModelProperty(value = "所有父级分类")
|
||||
@TableField("parent_path")
|
||||
private String parentPath;
|
||||
|
||||
@ApiModelProperty(value = "父级分类名")
|
||||
@TableField("parent_name")
|
||||
private String parentName;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
@TableField("sort_id")
|
||||
private Integer sortId;
|
||||
|
||||
@ApiModelProperty(value = "删除状态 1:正常 2:已删除")
|
||||
@TableField("del_state")
|
||||
private Integer delState;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@TableField("create_by")
|
||||
private String createBy;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField("modify_time")
|
||||
private Date modifyTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
@TableField("modify_by")
|
||||
private String modifyBy;
|
||||
|
||||
public String getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void setTypeId(String typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
public String getEnterpriseId() {
|
||||
return enterpriseId;
|
||||
}
|
||||
|
||||
public void setEnterpriseId(String enterpriseId) {
|
||||
this.enterpriseId = enterpriseId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getLogo() {
|
||||
return logo;
|
||||
}
|
||||
|
||||
public void setLogo(String logo) {
|
||||
this.logo = logo;
|
||||
}
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
public String getParentPath() {
|
||||
return parentPath;
|
||||
}
|
||||
|
||||
public void setParentPath(String parentPath) {
|
||||
this.parentPath = parentPath;
|
||||
}
|
||||
public String getParentName() {
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
public Integer getSortId() {
|
||||
return sortId;
|
||||
}
|
||||
|
||||
public void setSortId(Integer sortId) {
|
||||
this.sortId = sortId;
|
||||
}
|
||||
public Integer getDelState() {
|
||||
return delState;
|
||||
}
|
||||
|
||||
public void setDelState(Integer delState) {
|
||||
this.delState = delState;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
public String getModifyBy() {
|
||||
return modifyBy;
|
||||
}
|
||||
|
||||
public void setModifyBy(String modifyBy) {
|
||||
this.modifyBy = modifyBy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntDeviceType{" +
|
||||
"typeId=" + typeId +
|
||||
", enterpriseId=" + enterpriseId +
|
||||
", name=" + name +
|
||||
", logo=" + logo +
|
||||
", parentId=" + parentId +
|
||||
", parentPath=" + parentPath +
|
||||
", parentName=" + parentName +
|
||||
", sortId=" + sortId +
|
||||
", delState=" + delState +
|
||||
", createTime=" + createTime +
|
||||
", createBy=" + createBy +
|
||||
", modifyTime=" + modifyTime +
|
||||
", modifyBy=" + modifyBy +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
41
inventory-dao/src/main/resources/mapper/EntDeviceMapper.xml
Normal file
41
inventory-dao/src/main/resources/mapper/EntDeviceMapper.xml
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?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.rzyc.mapper.EntDeviceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.rzyc.model.EntDevice">
|
||||
<id column="device_id" property="deviceId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="number" property="number" />
|
||||
<result column="model_num" property="modelNum" />
|
||||
<result column="model_state" property="modelState" />
|
||||
<result column="buy_time" property="buyTime" />
|
||||
<result column="type_id" property="typeId" />
|
||||
<result column="type_path" property="typePath" />
|
||||
<result column="enterprise_id" property="enterpriseId" />
|
||||
<result column="qr_code" property="qrCode" />
|
||||
<result column="del_state" property="delState" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="modify_time" property="modifyTime" />
|
||||
<result column="modify_by" property="modifyBy" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
device_id, name, number, model_num, model_state, buy_time, type_id, type_path, enterprise_id, qr_code, del_state, create_time, create_by, modify_time, modify_by
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectEntEquipmentList" resultMap="BaseResultMap">
|
||||
select * from ent_device where enterprise_id = #{enterpriseId}
|
||||
<if test="null != typeId and '' != typeId">
|
||||
and type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="entEquipmentStatistic" resultMap="BaseResultMap">
|
||||
生命周期中的统计
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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.rzyc.mapper.EntDeviceTypeMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.rzyc.model.EntDeviceType">
|
||||
<id column="type_id" property="typeId" />
|
||||
<result column="enterprise_id" property="enterpriseId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="logo" property="logo" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="parent_path" property="parentPath" />
|
||||
<result column="parent_name" property="parentName" />
|
||||
<result column="sort_id" property="sortId" />
|
||||
<result column="del_state" property="delState" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="modify_time" property="modifyTime" />
|
||||
<result column="modify_by" property="modifyBy" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
type_id, enterprise_id, name, logo, parent_id, parent_path, parent_name, sort_id, del_state, create_time, create_by, modify_time, modify_by
|
||||
</sql>
|
||||
|
||||
<select id="selectEntEquipmentTypeList" resultMap="BaseResultMap">
|
||||
select * from ent_device_type where del_state = 1
|
||||
<if test="null != enterpriseId">
|
||||
and enterprise_id = #{enterpriseId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
|
||||
import com.common.utils.model.SingleResult;
|
||||
import com.rzyc.config.MethodAnnotation;
|
||||
import com.rzyc.model.EntDevice;
|
||||
import com.rzyc.model.EntDeviceType;
|
||||
import com.rzyc.model.ent.EntUser;
|
||||
import com.rzyc.service.PcBusinessService;
|
||||
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.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Xuwanxin
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
@Api(tags = "企业端设备模块接口")
|
||||
@CrossOrigin("*")
|
||||
@RequestMapping("equipment")
|
||||
@Controller
|
||||
@Validated
|
||||
public class EnterpriseEquipmentController extends BaseController {
|
||||
|
||||
|
||||
PcBusinessService pcBusinessService;
|
||||
|
||||
public EnterpriseEquipmentController(PcBusinessService pcBusinessService) {
|
||||
this.pcBusinessService = pcBusinessService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 企业设备类型列表
|
||||
* @param enterpriseId 企业id
|
||||
* @return 企业设备类型列表
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "企业设备类型列表", notes = "企业设备类型列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string")
|
||||
})
|
||||
@GetMapping(value = "/entEquipmentTypeList")
|
||||
@PreAuthorize("hasAnyAuthority('entEquipmentTypeList','entEquipmentList:update')")
|
||||
@MethodAnnotation(authorizations = {"entEquipmentTypeList","entEquipmentList:update"},name = "企业设备类型列表")
|
||||
@ResponseBody
|
||||
public SingleResult<List<EntDeviceType>> entEquipmentTypeList(@NotNull(message = "公司id不能为null") String enterpriseId)throws Exception{
|
||||
return pcBusinessService.entEquipmentTypeList(enterpriseId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 企业设备列表
|
||||
* @param enterpriseId 企业id
|
||||
* @param typeId 设备类型id
|
||||
* @return 企业设备列表
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "企业设备列表", notes = "企业设备列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"),
|
||||
@ApiImplicitParam(name = "typeId", value = "设备类型id", required = false, dataType = "string")
|
||||
})
|
||||
@GetMapping(value = "/entEquipmentList")
|
||||
@PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')")
|
||||
@MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表")
|
||||
@ResponseBody
|
||||
public SingleResult<List<EntDevice>> entEquipmentList(@NotNull(message = "公司id不能为null") String enterpriseId, String typeId)throws Exception{
|
||||
return pcBusinessService.entEquipmentList(enterpriseId,typeId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 企业设备保养和维修检查记录统计
|
||||
* @param enterpriseId 企业id
|
||||
* @param deviceId 设备id
|
||||
* @return 企业设备列表
|
||||
* @throws Exception
|
||||
*/
|
||||
@ApiOperation(value = "企业设备保养和维修检查记录统计", notes = "企业设备保养和维修检查记录统计")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"),
|
||||
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataType = "string")
|
||||
})
|
||||
@GetMapping(value = "/entEquipmentStatistic")
|
||||
@PreAuthorize("hasAnyAuthority('entEquipmentStatistic')")
|
||||
@MethodAnnotation(authorizations = {"entEquipmentStatistic"},name = "企业设备保养和维修检查记录统计")
|
||||
@ResponseBody
|
||||
public SingleResult<List<EntDevice>> entEquipmentStatistic(@NotNull(message = "公司id不能为null") String enterpriseId, String deviceId)throws Exception{
|
||||
return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -11,11 +11,9 @@ import com.common.utils.model.SingleResult;
|
|||
import com.rzyc.bean.emergency.PlanList;
|
||||
import com.rzyc.config.RedisUtil;
|
||||
import com.rzyc.controller.BaseController;
|
||||
import com.rzyc.enums.RedisKeys;
|
||||
import com.rzyc.mapper.EntPostTaskMapper;
|
||||
import com.rzyc.model.EntPostDuty;
|
||||
import com.rzyc.model.EntPostList;
|
||||
import com.rzyc.model.EntPostTask;
|
||||
import com.rzyc.model.EntUserCredential;
|
||||
import com.rzyc.model.*;
|
||||
import com.rzyc.model.dto.*;
|
||||
import com.rzyc.model.ent.EntPost;
|
||||
import com.rzyc.model.ent.EntUser;
|
||||
|
|
@ -50,13 +48,13 @@ public class PcBusinessService extends BaseController {
|
|||
SingleResult singleResult = new SingleResult();
|
||||
//读缓存,get时候如果多级用:进行分隔
|
||||
if (null != enterpriseId && postId == null){
|
||||
List<Object> posts = redisUtil.lGet(enterpriseId,0,-1);
|
||||
List<EntPost> posts = (List<EntPost>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId));
|
||||
if (null != posts && posts.size() > 0 ){
|
||||
singleResult.setData(posts);
|
||||
return singleResult;
|
||||
}
|
||||
}else if (null != enterpriseId && postId != enterpriseId){
|
||||
List<EntPost>posts = (List<EntPost>) redisUtil.get(redisUtil.appendSymbol(enterpriseId,postId));
|
||||
List<EntPost>posts = (List<EntPost>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId,postId));
|
||||
if (null != posts && posts.size() > 0 ){
|
||||
singleResult.setData(posts);
|
||||
return singleResult;
|
||||
|
|
@ -83,10 +81,14 @@ public class PcBusinessService extends BaseController {
|
|||
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
||||
singleResult.setData(posts);
|
||||
//存入redis缓存
|
||||
try {
|
||||
if (null != enterpriseId && postId == null){
|
||||
redisUtil.set(enterpriseId,posts);
|
||||
redisUtil.set(redisUtil.appendSymbol(RedisKeys.POST.getKey(),enterpriseId),posts,0);
|
||||
}else if (null != enterpriseId && postId != enterpriseId){
|
||||
redisUtil.set(redisUtil.appendSymbol(enterpriseId,postId),posts,0);
|
||||
redisUtil.set(redisUtil.appendSymbol(RedisKeys.POST.getKey(),postId,enterpriseId),posts,0);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return singleResult;
|
||||
}
|
||||
|
|
@ -265,13 +267,55 @@ public class PcBusinessService extends BaseController {
|
|||
|
||||
public SingleResult entEquipmentTypeList(String enterpriseId){
|
||||
SingleResult singleResult = new SingleResult();
|
||||
entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId);
|
||||
List<EntDeviceType> redisEntDeviceTypes =(List<EntDeviceType>) redisUtil.get(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId));
|
||||
if (null != redisEntDeviceTypes && redisEntDeviceTypes.size()>0){
|
||||
singleResult.setData(redisEntDeviceTypes);
|
||||
return singleResult;
|
||||
}
|
||||
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(enterpriseId);
|
||||
//树结构处理
|
||||
JSONArray jsonArray = handleEntEquipment(entDeviceTypes);
|
||||
List<EntPost>posts = JSONArray.parseArray(JSONArray.toJSONString(jsonArray),EntPost.class);
|
||||
singleResult.setData(posts);
|
||||
//存redis
|
||||
boolean insertRedisResult = redisUtil.set(redisUtil.appendSymbol(RedisKeys.DEVICE.getKey(),enterpriseId),posts,0);
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理企业用户数结构list
|
||||
*/
|
||||
private JSONArray handleEntEquipment(List<EntDeviceType> list){
|
||||
List<Map<String,Object>> data = new ArrayList<>();
|
||||
for(EntDeviceType entDeviceType : list){
|
||||
if(StringUtils.isBlank(entDeviceType.getParentId())){
|
||||
entDeviceType.setParentId("");
|
||||
}
|
||||
Map<String,Object> entPostMap = new HashMap<String,Object>();
|
||||
entPostMap.put("typeId",entDeviceType.getTypeId());
|
||||
entPostMap.put("name",entDeviceType.getName());
|
||||
entPostMap.put("parentId",entDeviceType.getParentId());
|
||||
entPostMap.put("logo",entDeviceType.getLogo());
|
||||
data.add(entPostMap);
|
||||
}
|
||||
com.alibaba.fastjson.JSONArray result = TypeConversion.listToTree(com.alibaba.fastjson.JSONArray.parseArray(JSON.toJSONString(data)),"typeId","parentId","children");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public SingleResult entEquipmentList(String enterpriseId, String typeId){
|
||||
SingleResult singleResult = new SingleResult();
|
||||
List<EntDevice> devices = entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId);
|
||||
singleResult.setData(devices);
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){
|
||||
SingleResult singleResult = new SingleResult();
|
||||
entDeviceMapper.entEquipmentStatistic(enterpriseId,deviceId);
|
||||
return singleResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user