ZhuDongming
2020-03-24 495ab84a5544656fca0150c0f89321f0e4dfa2b5
update
6 files added
7 files modified
705 ■■■■■ changed files
src/main/java/com/moral/config/XxlJobConfig.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/Density.java 91 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/Device.java 201 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/DeviceProperty.java 101 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/DeviceVersion.java 56 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/MonitorPoint.java 113 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/entity/Sensor.java 73 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/DeviceService.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/SensorService.java 1 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/DeviceServiceImpl.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/service/impl/SensorServiceImpl.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/com/moral/task/HistoryTableInsertTask.java 8 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/task/RabbitMQInsertTask.java 12 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/config/XxlJobConfig.java
@@ -12,7 +12,7 @@
 *
 * @author xuxueli 2017-04-28
 */
//@Configuration
@Configuration
public class XxlJobConfig {
    private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
src/main/java/com/moral/entity/Density.java
New file
@@ -0,0 +1,91 @@
package com.moral.entity;
import java.io.Serializable;
public class Density implements Serializable {
    private Integer id;
    private Integer provinceCode;
    private Integer professionId;
    private Byte tech;
    private String limitVal;
    private String valUnit;
    private String extA;
    private Integer extB;
    private static final long serialVersionUID = 1L;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(Integer provinceCode) {
        this.provinceCode = provinceCode;
    }
    public Integer getPrefessionId() {
        return professionId;
    }
    public void setPrefessionId(Integer prefessionId) {
        this.professionId = prefessionId;
    }
    public Byte getTech() {
        return tech;
    }
    public void setTech(Byte tech) {
        this.tech = tech;
    }
    public String getLimitVal() {
        return limitVal;
    }
    public void setLimitVal(String limitVal) {
        this.limitVal = limitVal;
    }
    public String getValUnit() {
        return valUnit;
    }
    public void setValUnit(String valUnit) {
        this.valUnit = valUnit;
    }
    public String getExtA() {
        return extA;
    }
    public void setExtA(String extA) {
        this.extA = extA;
    }
    public Integer getExtB() {
        return extB;
    }
    public void setExtB(Integer extB) {
        this.extB = extB;
    }
}
src/main/java/com/moral/entity/Device.java
New file
@@ -0,0 +1,201 @@
package com.moral.entity;
import java.util.Date;
import java.util.List;
public class Device {
    private Integer id;
    private String name;
    private String address;
    private Double longitude;
    private Double latitude;
    private String mac;
    private Integer operateUserId;
    private Date createTime;
    private Date installTime;
    private Integer monitorPointId;
    private Integer deviceVersionId;
    private Integer professionId;
    private Density density;
    private MonitorPoint monitorPoint;
    private DeviceProperty deviceProperty;
    /**
     * @return the deviceProperty
     */
    public DeviceProperty getDeviceProperty() {
        return deviceProperty;
    }
    /**
     * @param deviceProperty the deviceProperty to set
     */
    public void setDeviceProperty(DeviceProperty deviceProperty) {
        this.deviceProperty = deviceProperty;
    }
    public MonitorPoint getMonitorPoint() {
        return monitorPoint;
    }
    public void setMonitorPoint(MonitorPoint monitorPoint) {
        this.monitorPoint = monitorPoint;
    }
    public Integer getProfessionId() {
        return professionId;
    }
    public void setProfessionId(Integer professionId) {
        this.professionId = professionId;
    }
    public Density getDensity() {
        return density;
    }
    public void setDensity(Density density) {
        this.density = density;
    }
    public DeviceVersion getDeviceVersion() {
        return deviceVersion;
    }
    public void setDeviceVersion(DeviceVersion deviceVersion) {
        this.deviceVersion = deviceVersion;
    }
    private DeviceVersion deviceVersion;
    public String getIsDelete() {
        return isDelete;
    }
    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete;
    }
    private String isDelete;
    public String getState() {
        return state;
    }
    public void setState(String state) {
        this.state = state;
    }
    private String state;//0 正常,1轻微,2中度,3严重,4离线
    public List<Integer> getOrganizationIds() {
        return organizationIds;
    }
    private List<Integer> organizationIds;//index:0 为该设备直接所属组织
    public void setOrganizationIds(List<Integer> organizationIds) {
        this.organizationIds = organizationIds;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }
    public Double getLongitude() {
        return longitude;
    }
    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
    public Double getLatitude() {
        return latitude;
    }
    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }
    public String getMac() {
        return mac==null?"":mac;
    }
    public void setMac(String mac) {
        this.mac = mac == null ? null : mac.trim();
    }
    public Integer getOperateUserId() {
        return operateUserId;
    }
    public void setOperateUserId(Integer operateUserId) {
        this.operateUserId = operateUserId;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getInstallTime() {
        return installTime;
    }
    public void setInstallTime(Date installTime) {
        this.installTime = installTime;
    }
    public Integer getMonitorPointId() {
        return monitorPointId;
    }
    public void setMonitorPointId(Integer monitorPointId) {
        this.monitorPointId = monitorPointId;
    }
    public Integer getDeviceVersionId() {
        return deviceVersionId;
    }
    public void setDeviceVersionId(Integer deviceVersionId) {
        this.deviceVersionId = deviceVersionId;
    }
}
src/main/java/com/moral/entity/DeviceProperty.java
New file
@@ -0,0 +1,101 @@
package com.moral.entity;
import java.io.Serializable;
public class DeviceProperty implements Serializable {
    private Integer id;
    private Byte deviceTech;
    private Byte deviceCat;
    private String deviceSource;
    private Integer extA;
    private Integer extB;
    private String extC;
    private String extD;
    private String extE;
    private static final long serialVersionUID = 1L;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public Byte getDeviceTech() {
        return deviceTech;
    }
    public void setDeviceTech(Byte deviceTech) {
        this.deviceTech = deviceTech;
    }
    public Byte getDeviceCat() {
        return deviceCat;
    }
    public void setDeviceCat(Byte deviceCat) {
        this.deviceCat = deviceCat;
    }
    public String getDeviceSource() {
        return deviceSource;
    }
    public void setDeviceSource(String deviceSource) {
        this.deviceSource = deviceSource;
    }
    public Integer getExtA() {
        return extA;
    }
    public void setExtA(Integer extA) {
        this.extA = extA;
    }
    public Integer getExtB() {
        return extB;
    }
    public void setExtB(Integer extB) {
        this.extB = extB;
    }
    public String getExtC() {
        return extC;
    }
    public void setExtC(String extC) {
        this.extC = extC;
    }
    public String getExtD() {
        return extD;
    }
    public void setExtD(String extD) {
        this.extD = extD;
    }
    public String getExtE() {
        return extE;
    }
    public void setExtE(String extE) {
        this.extE = extE;
    }
}
src/main/java/com/moral/entity/DeviceVersion.java
New file
@@ -0,0 +1,56 @@
package com.moral.entity;
import java.util.Date;
public class DeviceVersion {
    private Integer id;
    private String name;
    private Integer version;
    private Date createTime;
    private String description;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
    public Integer getVersion() {
        return version;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }
}
src/main/java/com/moral/entity/MonitorPoint.java
New file
@@ -0,0 +1,113 @@
package com.moral.entity;
public class MonitorPoint {
    private Integer id;
    private String name;
    private Double longitude;
    private Double latitude;
    private Integer provinceCode;
    private Integer cityCode;
    private Integer areaCode;
    private Integer organizationId;
    private String address;
    private String isDelete;
    private String description;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
    public Double getLongitude() {
        return longitude;
    }
    public void setLongitude(Double longitude) {
        this.longitude = longitude;
    }
    public Double getLatitude() {
        return latitude;
    }
    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }
    public Integer getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(Integer provinceCode) {
        this.provinceCode = provinceCode;
    }
    public Integer getCityCode() {
        return cityCode;
    }
    public void setCityCode(Integer cityCode) {
        this.cityCode = cityCode;
    }
    public Integer getAreaCode() {
        return areaCode;
    }
    public void setAreaCode(Integer areaCode) {
        this.areaCode = areaCode;
    }
    public Integer getOrganizationId() {
        return organizationId;
    }
    public void setOrganizationId(Integer organizationId) {
        this.organizationId = organizationId;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }
    public String getIsDelete() {
        return isDelete;
    }
    public void setIsDelete(String isDelete) {
        this.isDelete = isDelete == null ? null : isDelete.trim();
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }
}
src/main/java/com/moral/entity/Sensor.java
New file
@@ -0,0 +1,73 @@
package com.moral.entity;
public class Sensor {
    private Integer id;
    private String name;
    private String sensorKey;
    private Double upper;
    private Double lower;
    private String unit;
    private String description;
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
    public String getSensorKey() {
        return sensorKey;
    }
    public void setSensorKey(String sensorKey) {
        this.sensorKey = sensorKey == null ? null : sensorKey.trim();
    }
    public Double getUpper() {
        return upper;
    }
    public void setUpper(Double upper) {
        this.upper = upper;
    }
    public Double getLower() {
        return lower;
    }
    public void setLower(Double lower) {
        this.lower = lower;
    }
    public String getUnit() {
        return unit;
    }
    public void setUnit(String unit) {
        this.unit = unit == null ? null : unit.trim();
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description == null ? null : description.trim();
    }
}
src/main/java/com/moral/service/DeviceService.java
@@ -3,21 +3,9 @@
import java.util.List;
import java.util.Map;
import com.moral.entity.AlarmConfigValue;
import com.moral.entity.Device;
public interface DeviceService {
    Map<String, Object> getAvgData(Map<String, Object> parameters);
    Map<String, Object> getMaxAndMinData(Map<String, Object> parameters);
    List<Map<String, Object>> getMacAndSensorkeyByOrganizationid(List<Object> organizationIdList);
    List<Map<String, Object>> getSensorData(Map<String, Object> parameters);
    List<Map<String, Object>> getSensorDataOnce(Map<String, Object> parameters);
    List<String> getMacs();
src/main/java/com/moral/service/SensorService.java
@@ -3,7 +3,6 @@
import java.util.List;
public interface SensorService {
    List<String> querySensorNamesByKeys(List<String> keys);
    List<String> getSensorKeys();
src/main/java/com/moral/service/impl/DeviceServiceImpl.java
@@ -18,37 +18,13 @@
    @Autowired
    DeviceMapper deviceMapper;
    @Autowired
    HistoryMapper historyMapper;
    @Override
    public Map<String, Object> getAvgData(Map<String, Object> parameters) {
        // TODO Auto-generated method stub
        return historyMapper.getAvgData(parameters);
    }
    @Override
    public List<Map<String, Object>> getMacAndSensorkeyByOrganizationid(List<Object> organizationIdList) {
        // TODO Auto-generated method stub
        return deviceMapper.getMacAndSensorkeyByOrganizationid(organizationIdList);
    }
    @Override
    public Map<String, Object> getMaxAndMinData(Map<String, Object> parameters) {
        // TODO Auto-generated method stub
        return historyMapper.getMaxAndMinData(parameters);
    }
    @Override
    public List<Map<String, Object>> getSensorData(Map<String, Object> parameters) {
        return historyMapper.getSensorData(parameters);
    }
    @Override
    public List<Map<String, Object>> getSensorDataOnce(Map<String, Object> parameters) {
        return historyMapper.getSensorDataOnce(parameters);
    }
    @Override
src/main/java/com/moral/service/impl/SensorServiceImpl.java
@@ -4,14 +4,10 @@
import javax.annotation.Resource;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.moral.mapper.SensorMapper;
import com.moral.service.SensorService;
import com.moral.util.RedisUtils;
@Service
public class SensorServiceImpl implements SensorService {
@@ -19,11 +15,6 @@
    SensorMapper sensorMapper;
    @Override
    public List<String> querySensorNamesByKeys(List<String> keys) {
        return sensorMapper.selectSensorNamesByKeys(keys);
    }
     @Override
    public List<String> getSensorKeys() {
        return sensorMapper.getSensorKeys();
    }
src/main/java/com/moral/task/HistoryTableInsertTask.java
@@ -28,7 +28,7 @@
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
//@Component
@Component
public class HistoryTableInsertTask {
    private static transient Logger logger = LoggerFactory.getLogger(HistoryTableInsertTask.class);
@@ -47,7 +47,7 @@
    @Resource
    private HistoryDailyService historyDailyService;
    //@XxlJob("historyMinutely")
    @XxlJob("historyMinutely")
    public ReturnT insertHistoryMinutelyTable(String params) {
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
@@ -100,7 +100,7 @@
        return returnT;
    }
    //@XxlJob("historyHourly")
    @XxlJob("historyHourly")
    public ReturnT insertHistoryHourlyTable(String params) {
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
@@ -156,7 +156,7 @@
        return returnT;
    }
    //@XxlJob("historyDaily")
    @XxlJob("historyDaily")
    public ReturnT insertHistoryDailyTable(String params) {
        LocalDateTime time = LocalDateTime.now();
        LocalDateTime endTime = time.truncatedTo(ChronoUnit.DAYS);
src/main/java/com/moral/task/RabbitMQInsertTask.java
@@ -32,7 +32,7 @@
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
//@Component
@Component
public class RabbitMQInsertTask {
    private static transient Logger logger = LoggerFactory.getLogger(RabbitMQInsertTask.class);
@@ -61,7 +61,7 @@
    @Qualifier("organization_data")
    private TopicExchange organization_data;
    //@XxlJob("RabbitMQRealtimeMinutely")
    @XxlJob("RabbitMQRealtimeMinutely")
    public ReturnT insertRabbitMQRealtimeMinutely(String params) {
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
@@ -122,7 +122,7 @@
        return returnT;
    }
    //@XxlJob("RabbitMQRealtimeEveryFiveMinutes")
    @XxlJob("RabbitMQRealtimeEveryFiveMinutes")
    public ReturnT insertRabbitMQRealtimeEveryFiveMinutes(String params) {
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
@@ -183,7 +183,7 @@
        return returnT;
    }
    //@XxlJob("RabbitMQMinutely")
    @XxlJob("RabbitMQMinutely")
    public ReturnT insertRabbitMQMinutely(String params) {
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
@@ -245,7 +245,7 @@
        return returnT;
    }
    //@XxlJob("RabbitMQHourly")
    @XxlJob("RabbitMQHourly")
    public ReturnT insertRabbitMQHourly(String params) {
        LocalDateTime time = LocalDateTime.now();
        Map organizationIdMap = JSON.parseObject(params);
@@ -302,7 +302,7 @@
        return returnT;
    }
    //@XxlJob("RabbitMQDaily")
    @XxlJob("RabbitMQDaily")
    public ReturnT insertRabbitMQDaily(String params) {
        LocalDateTime time = LocalDateTime.now();
        Map organizationIdMap = JSON.parseObject(params);