企业设备接口,周期巡检,巡检记录,保养计划,数据库建表
This commit is contained in:
parent
7139270269
commit
57518bfe3a
|
|
@ -35,4 +35,13 @@ public interface EntDeviceMapper extends BaseMapper<EntDevice> {
|
||||||
* */
|
* */
|
||||||
EntDevice entEquipmentStatistic(String enterpriseId, String deviceId);
|
EntDevice entEquipmentStatistic(String enterpriseId, String deviceId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业设备修改
|
||||||
|
* @param entDevice 企业id
|
||||||
|
* @return EntDevice
|
||||||
|
* */
|
||||||
|
int updateEntDevice(@Param("entDevice") EntDevice entDevice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,19 @@ public interface EntDeviceTypeMapper extends BaseMapper<EntDeviceType> {
|
||||||
* */
|
* */
|
||||||
List<EntDeviceType>selectEntEquipmentTypeList(@Param("enterpriseId") String enterpriseId);
|
List<EntDeviceType>selectEntEquipmentTypeList(@Param("enterpriseId") String enterpriseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改企业设备类型
|
||||||
|
* @param entDeviceType
|
||||||
|
* @return int
|
||||||
|
* */
|
||||||
int updateEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
|
int updateEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入企业设备类型
|
||||||
|
* @param entDeviceType
|
||||||
|
* @return int
|
||||||
|
* */
|
||||||
int addEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
|
int addEntEquipment(@Param("entDeviceType") EntDeviceType entDeviceType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.rzyc.model;
|
package com.rzyc.model;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
|
@ -51,7 +53,7 @@ public class EntDevice implements Serializable {
|
||||||
private Date dateProduction;
|
private Date dateProduction;
|
||||||
|
|
||||||
@ApiModelProperty(value = "安装时间")
|
@ApiModelProperty(value = "安装时间")
|
||||||
@TableField("installation_production")
|
@TableField("installation_time")
|
||||||
private Date installationTime;
|
private Date installationTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "启用时间")
|
@ApiModelProperty(value = "启用时间")
|
||||||
|
|
@ -98,6 +100,79 @@ public class EntDevice implements Serializable {
|
||||||
@TableField("modify_by")
|
@TableField("modify_by")
|
||||||
private String modifyBy;
|
private String modifyBy;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "经度")
|
||||||
|
@TableField("longitude")
|
||||||
|
private BigDecimal longitude;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "纬度")
|
||||||
|
@TableField("latitude")
|
||||||
|
private BigDecimal latitude;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "出厂编号")
|
||||||
|
@TableField("factory_number")
|
||||||
|
private String factoryNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备负责人")
|
||||||
|
@TableField("eq_charge_person")
|
||||||
|
private String eqChargePerson;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "制造厂商")
|
||||||
|
@TableField("manufacturer")
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备具体位置")
|
||||||
|
@TableField("specific_location")
|
||||||
|
private String specificLocation;
|
||||||
|
|
||||||
|
|
||||||
|
public BigDecimal getLongitude() {
|
||||||
|
return longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLongitude(BigDecimal longitude) {
|
||||||
|
this.longitude = longitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getLatitude() {
|
||||||
|
return latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatitude(BigDecimal latitude) {
|
||||||
|
this.latitude = latitude;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactoryNumber() {
|
||||||
|
return factoryNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFactoryNumber(String factoryNumber) {
|
||||||
|
this.factoryNumber = factoryNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEqChargePerson() {
|
||||||
|
return eqChargePerson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEqChargePerson(String eqChargePerson) {
|
||||||
|
this.eqChargePerson = eqChargePerson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManufacturer() {
|
||||||
|
return manufacturer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManufacturer(String manufacturer) {
|
||||||
|
this.manufacturer = manufacturer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSpecificLocation() {
|
||||||
|
return specificLocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpecificLocation(String specificLocation) {
|
||||||
|
this.specificLocation = specificLocation;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getInstallationTime() {
|
public Date getInstallationTime() {
|
||||||
return installationTime;
|
return installationTime;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,11 @@
|
||||||
<select id="entEquipmentStatistic" resultMap="BaseResultMap">
|
<select id="entEquipmentStatistic" resultMap="BaseResultMap">
|
||||||
生命周期中的统计
|
生命周期中的统计
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateEntDevice" parameterType="com.rzyc.model.EntDevice">
|
||||||
|
update ent_device set type_path = #{entDevice.typePath},enterprise_id = #{entDevice.enterpriseId},qr_code = #{entDevice.qrCode},installation_time = #{entDevice.installationTime},
|
||||||
|
enable_time = #{entDevice.enableTime},scrap_time = #{entDevice.scrapTime},factory_number = #{entDevice.factoryNumber},longitude = #{entDevice.longitude},latitude = #{entDevice.latitude},
|
||||||
|
eq_charge_person = #{entDevice.eqChargePerson},manufacturer = #{entDevice.manufacturer},specific_location = #{entDevice.specificLocation},modify_by = #{entDevice.modifyBy},modify_time = #{entDevice.modifyTime}
|
||||||
|
where device_id = #{entDevice.deviceId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,16 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateEntEquipment" >
|
||||||
|
update ent_device_type set name = #{entDeviceType.name},logo = #{entDeviceType.logo},parent_id = #{entDeviceType.parentId},parent_path = #{entDeviceType.parentPath},parent_name = #{entDeviceType.parentName},sort_id = #{entDeviceType.sortId},
|
||||||
|
modify_by = #{modifyBy},modify_time = #{modifyTime}
|
||||||
|
where type_id = #{entDeviceType.typeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="addEntEquipment">
|
||||||
|
insert into ent_device_type (type_id,enterprise_id,name,logo,parent_id,parent_path,parent_name,sort_id)
|
||||||
|
values (#{entDeviceType.typeId},#{entDeviceType.enterpriseId},#{entDeviceType.name},#{entDeviceType.logo},#{entDeviceType.parentId},#{entDeviceType.parentPath},#{entDeviceType.parentName}
|
||||||
|
,#{entDeviceType.sortId})
|
||||||
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,16 @@ import com.rzyc.config.MethodAnnotation;
|
||||||
import com.rzyc.model.EntDevice;
|
import com.rzyc.model.EntDevice;
|
||||||
import com.rzyc.model.EntDeviceType;
|
import com.rzyc.model.EntDeviceType;
|
||||||
import com.rzyc.model.dto.AddOrUpdateEntEquipmentDto;
|
import com.rzyc.model.dto.AddOrUpdateEntEquipmentDto;
|
||||||
import com.rzyc.model.ent.EntUser;
|
import com.rzyc.model.dto.AddOrUpdateEntEquipmentTypeDto;
|
||||||
import com.rzyc.service.PcBusinessService;
|
import com.rzyc.service.PcBusinessService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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 javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -102,17 +98,31 @@ public class EnterpriseEquipmentController extends BaseController {
|
||||||
return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId);
|
return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型,修改设备类型
|
||||||
|
* @return 新增设备类型,修改设备类型
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "新增设备类型,修改设备类型", notes = "新增设备类型,修改设备类型")
|
||||||
|
@PostMapping(value = "/addOrUpdateEntEquipmentType")
|
||||||
|
@PreAuthorize("hasAnyAuthority('addOrUpdateEntEquipmentType')")
|
||||||
|
@MethodAnnotation(authorizations = {"addOrUpdateEntEquipmentType"},name = "新增设备类型,修改设备类型")
|
||||||
|
@ResponseBody
|
||||||
|
public SingleResult addOrUpdateEntEquipmentType(@RequestBody AddOrUpdateEntEquipmentTypeDto addOrUpdateEntEquipmentTypeDto)throws Exception{
|
||||||
|
return pcBusinessService.addOrUpdateEntEquipmentType(addOrUpdateEntEquipmentTypeDto);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增设备,修改设备
|
* 新增设备,修改设备
|
||||||
* @return 新增设备,修改设备
|
* @return 新增设备,修改设备
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "新增设备,修改设备", notes = "新增设备,修改设备")
|
@ApiOperation(value = "新增设备,修改设备", notes = "新增设备,修改设备")
|
||||||
@GetMapping(value = "/addOrUpdateEntEquipment")
|
@PostMapping(value = "/addOrUpdateEntEquipment")
|
||||||
@PreAuthorize("hasAnyAuthority('addOrUpdateEntEquipment')")
|
@PreAuthorize("hasAnyAuthority('addOrUpdateEntEquipment')")
|
||||||
@MethodAnnotation(authorizations = {"addOrUpdateEntEquipment"},name = "新增设备,修改设备")
|
@MethodAnnotation(authorizations = {"addOrUpdateEntEquipment"},name = "新增设备,修改设备")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto)throws Exception{
|
public SingleResult addOrUpdateEntEquipment(@RequestBody AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto)throws Exception{
|
||||||
return pcBusinessService.addOrUpdateEntEquipment(addOrUpdateEntEquipmentDto);
|
return pcBusinessService.addOrUpdateEntEquipment(addOrUpdateEntEquipmentDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.rzyc.service;
|
package com.rzyc.service;
|
||||||
|
|
||||||
import cn.jiguang.common.TimeUnit;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.common.utils.*;
|
import com.common.utils.*;
|
||||||
|
|
@ -8,11 +7,9 @@ import com.common.utils.encryption.MD5;
|
||||||
import com.common.utils.model.Code;
|
import com.common.utils.model.Code;
|
||||||
import com.common.utils.model.Message;
|
import com.common.utils.model.Message;
|
||||||
import com.common.utils.model.SingleResult;
|
import com.common.utils.model.SingleResult;
|
||||||
import com.rzyc.bean.emergency.PlanList;
|
|
||||||
import com.rzyc.config.RedisUtil;
|
import com.rzyc.config.RedisUtil;
|
||||||
import com.rzyc.controller.BaseController;
|
import com.rzyc.controller.BaseController;
|
||||||
import com.rzyc.enums.RedisKeys;
|
import com.rzyc.enums.RedisKeys;
|
||||||
import com.rzyc.mapper.EntPostTaskMapper;
|
|
||||||
import com.rzyc.model.*;
|
import com.rzyc.model.*;
|
||||||
import com.rzyc.model.dto.*;
|
import com.rzyc.model.dto.*;
|
||||||
import com.rzyc.model.ent.EntPost;
|
import com.rzyc.model.ent.EntPost;
|
||||||
|
|
@ -339,16 +336,54 @@ public class PcBusinessService extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto) throws Exception {
|
public SingleResult addOrUpdateEntEquipmentType(AddOrUpdateEntEquipmentTypeDto addOrUpdateEntEquipmentTypeDto) throws Exception {
|
||||||
SingleResult singleResult = new SingleResult();
|
SingleResult singleResult = new SingleResult();
|
||||||
EntDeviceType entDeviceType = new EntDeviceType();
|
EntDeviceType entDeviceType = new EntDeviceType();
|
||||||
BeanUtils.copyProperties(addOrUpdateEntEquipmentDto,entDeviceType);
|
BeanUtils.copyProperties(addOrUpdateEntEquipmentTypeDto,entDeviceType);
|
||||||
Integer result = 0;
|
Integer result = 0;
|
||||||
if (null != addOrUpdateEntEquipmentDto && null != addOrUpdateEntEquipmentDto.getTypeId()){
|
if (null != addOrUpdateEntEquipmentTypeDto && null != addOrUpdateEntEquipmentTypeDto.getTypeId()){
|
||||||
|
entDeviceType.setModifyBy(getUserId());
|
||||||
|
entDeviceType.setModifyTime(new Date());
|
||||||
result = entDeviceTypeMapper.updateEntEquipment(entDeviceType);
|
result = entDeviceTypeMapper.updateEntEquipment(entDeviceType);
|
||||||
}else {
|
}else {
|
||||||
|
entDeviceType.setCreateBy(getUserId());
|
||||||
|
entDeviceType.setCreateTime(new Date());
|
||||||
|
entDeviceType.setTypeId(RandomNumber.getUUid());
|
||||||
result = entDeviceTypeMapper.addEntEquipment(entDeviceType);
|
result = entDeviceTypeMapper.addEntEquipment(entDeviceType);
|
||||||
}
|
}
|
||||||
|
if (result != 1 ){
|
||||||
|
singleResult.setCode(Code.ERROR.getCode());
|
||||||
|
singleResult.setMessage(Message.ERROR);
|
||||||
|
}else {
|
||||||
|
//更新redis
|
||||||
|
List<EntDeviceType> entDeviceTypes = entDeviceTypeMapper.selectEntEquipmentTypeList(addOrUpdateEntEquipmentTypeDto.getEnterpriseId());
|
||||||
|
//树结构处理
|
||||||
|
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(),addOrUpdateEntEquipmentTypeDto.getEnterpriseId()),posts,0);
|
||||||
|
}
|
||||||
|
return singleResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SingleResult addOrUpdateEntEquipment(AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto) throws Exception {
|
||||||
|
SingleResult singleResult = new SingleResult();
|
||||||
|
EntDevice entDevice = new EntDevice();
|
||||||
|
BeanUtils.copyProperties(addOrUpdateEntEquipmentDto,entDevice);
|
||||||
|
Integer result = 0;
|
||||||
|
if (null != addOrUpdateEntEquipmentDto && null != addOrUpdateEntEquipmentDto.getDeviceId()){
|
||||||
|
entDevice.setModifyBy(getUserId());
|
||||||
|
entDevice.setModifyTime(new Date());
|
||||||
|
result = entDeviceMapper.updateEntDevice(entDevice);
|
||||||
|
}else {
|
||||||
|
entDevice.setCreateBy(getUserId());
|
||||||
|
entDevice.setCreateTime(new Date());
|
||||||
|
entDevice.setDeviceId(RandomNumber.getUUid());
|
||||||
|
result = entDeviceMapper.insert(entDevice);
|
||||||
|
}
|
||||||
if (result != 1 ){
|
if (result != 1 ){
|
||||||
singleResult.setCode(Code.ERROR.getCode());
|
singleResult.setCode(Code.ERROR.getCode());
|
||||||
singleResult.setMessage(Message.ERROR);
|
singleResult.setMessage(Message.ERROR);
|
||||||
|
|
@ -358,4 +393,6 @@ public class PcBusinessService extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user