Browse Source

Merge branch 'logistics' of dd.tall.wiki:ccsens_wiki/ccsenscloud into logistics

logistics
zy_Java 4 years ago
parent
commit
67765c0413
  1. 2
      logistics/src/main/java/com/ccsens/logistics/Netty/NettyClient.java
  2. 22
      logistics/src/main/java/com/ccsens/logistics/Util/Constant.java
  3. 32
      logistics/src/main/java/com/ccsens/logistics/api/DebugController.java
  4. 9
      logistics/src/main/java/com/ccsens/logistics/api/WarehouseController.java
  5. 22
      logistics/src/main/java/com/ccsens/logistics/bean/dto/HttpDto.java
  6. 10
      logistics/src/main/java/com/ccsens/logistics/bean/dto/MbpsDto.java
  7. 3
      logistics/src/main/java/com/ccsens/logistics/bean/dto/WarehouseDto.java
  8. 11
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEnvironmentRecord.java
  9. 70
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEnvironmentRecordExample.java
  10. 11
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsHeatImagingRecord.java
  11. 70
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsHeatImagingRecordExample.java
  12. 11
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsParkEquipment.java
  13. 70
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsParkEquipmentExample.java
  14. 17
      logistics/src/main/java/com/ccsens/logistics/bean/vo/EquipmentVo.java
  15. 63
      logistics/src/main/java/com/ccsens/logistics/bean/vo/HttpVo.java
  16. 6
      logistics/src/main/java/com/ccsens/logistics/bean/vo/MbpsVo.java
  17. 25
      logistics/src/main/java/com/ccsens/logistics/bean/vo/ParkVo.java
  18. 16
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsCarRecordDao.java
  19. 16
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsEnvironmentRecordDao.java
  20. 3
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsHeatImagingRecordDao.java
  21. 10
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsParkEquipmentDao.java
  22. 31
      logistics/src/main/java/com/ccsens/logistics/scheduled/ScheduledService.java
  23. 170
      logistics/src/main/java/com/ccsens/logistics/service/HttpService.java
  24. 13
      logistics/src/main/java/com/ccsens/logistics/service/IHttpService.java
  25. 5
      logistics/src/main/java/com/ccsens/logistics/service/IWarehouseService.java
  26. 62
      logistics/src/main/java/com/ccsens/logistics/service/MbpsService.java
  27. 16
      logistics/src/main/java/com/ccsens/logistics/service/WarehouseService.java
  28. 8
      logistics/src/main/resources/application-prod.yml
  29. 6
      logistics/src/main/resources/druid-prod.yml
  30. 8
      logistics/src/main/resources/mapper_dao/LogisticsCarRecordDao.xml
  31. 102
      logistics/src/main/resources/mapper_dao/LogisticsEnvironmentRecordDao.xml
  32. 5
      logistics/src/main/resources/mapper_dao/LogisticsHeatImagingRecordDao.xml
  33. 13
      logistics/src/main/resources/mapper_dao/LogisticsParkEquipmentDao.xml
  34. 31
      logistics/src/main/resources/mapper_raw/LogisticsEnvironmentRecordMapper.xml
  35. 27
      logistics/src/main/resources/mapper_raw/LogisticsHeatImagingRecordMapper.xml
  36. 28
      logistics/src/main/resources/mapper_raw/LogisticsParkEquipmentMapper.xml

2
logistics/src/main/java/com/ccsens/logistics/Netty/NettyClient.java

@ -70,7 +70,7 @@ public class NettyClient {
ScheduledExecutorService service = Executors
.newSingleThreadScheduledExecutor();
// 第二个参数为首次执行的延时时间,第三个参数为定时执行的间隔时间
service.scheduleAtFixedRate(runnable, 2, 30, TimeUnit.SECONDS);
service.scheduleAtFixedRate(runnable, 2, 5, TimeUnit.SECONDS);
// 创建并执行在给定延迟后启用的 ScheduledFuture。
// 参数:
// callable - 要执行的功能

22
logistics/src/main/java/com/ccsens/logistics/Util/Constant.java

@ -3,7 +3,7 @@ package com.ccsens.logistics.Util;
/**
* @author
*/
public class Constant {
public class Constant {
/**
* 心跳信息
*/
@ -12,4 +12,24 @@ public class Constant {
* 热成像图片
*/
public static final String THERMAL_IMAGERY = "SN4Image";
/**
* 温度检测
*/
public static final String TEMP = "温度(℃)";
/**
* 湿度检测
*/
public static final String HUMIDITY = "湿度(%RH)";
/**
* 水浸检测
*/
public static final String WATER_OUT = "水浸";
/**
* 有水
*/
public static final String HAVE_WATER = "有水";
/**
* 无水
*/
public static final String NO_WATER = "无水";
}

32
logistics/src/main/java/com/ccsens/logistics/api/DebugController.java

@ -5,6 +5,8 @@ import com.ccsens.logistics.bean.po.LogisticsCarRecord;
import com.ccsens.logistics.bean.po.LogisticsEnvironmentRecord;
import com.ccsens.logistics.persist.dao.LogisticsCarRecordDao;
import com.ccsens.logistics.persist.dao.LogisticsEnvironmentRecordDao;
import com.ccsens.logistics.service.HttpService;
import com.ccsens.logistics.service.IHttpService;
import com.ccsens.util.JsonResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
@ -27,26 +29,28 @@ public class DebugController {
private LogisticsCarRecordDao carRecordDao;
@Resource
private Snowflake snowflake;
@Resource
private IHttpService iHttpService;
@ApiOperation(value = "/测试添加假数据",notes = "")
@ApiImplicitParams({
})
@RequestMapping(value="",produces = {"application/json;charset=UTF-8"})
public JsonResponse getSmsCode(HttpServletRequest request) throws Exception {
Long currentTime = 1620632535000L;
for (int i = 0; i < 100; i++) {
Byte carType = Math.random()*10 < 5 ? (byte)0 :(byte) 1;
LogisticsCarRecord logisticsCarRecord = new LogisticsCarRecord();
logisticsCarRecord.setId(snowflake.nextId());
logisticsCarRecord.setCarWeight(RandomUtils.nextLong(1,9));
logisticsCarRecord.setLicensePlate("未知");
logisticsCarRecord.setCarType(carType);
logisticsCarRecord.setInOut(carType);
logisticsCarRecord.setRecordTime(currentTime);
currentTime = currentTime-86400000;
carRecordDao.insertSelective(logisticsCarRecord);
}
// Long currentTime = 1620632535000L;
// for (int i = 0; i < 100; i++) {
// Byte carType = Math.random()*10 < 5 ? (byte)0 :(byte) 1;
// LogisticsCarRecord logisticsCarRecord = new LogisticsCarRecord();
// logisticsCarRecord.setId(snowflake.nextId());
// logisticsCarRecord.setCarWeight(RandomUtils.nextLong(1,9));
// logisticsCarRecord.setLicensePlate("未知");
// logisticsCarRecord.setCarType(carType);
// logisticsCarRecord.setInOut(carType);
// logisticsCarRecord.setRecordTime(currentTime);
// currentTime = currentTime-86400000;
// carRecordDao.insertSelective(logisticsCarRecord);
// }
iHttpService.getTemperatureAndHumidity();
return JsonResponse.newInstance().ok("测试");
}

9
logistics/src/main/java/com/ccsens/logistics/api/WarehouseController.java

@ -3,6 +3,7 @@ package com.ccsens.logistics.api;
import com.ccsens.logistics.bean.dto.MbpsDto;
import com.ccsens.logistics.bean.dto.WarehouseDto;
import com.ccsens.logistics.bean.vo.MbpsVo;
import com.ccsens.logistics.bean.vo.ParkVo;
import com.ccsens.logistics.bean.vo.WarehouseVo;
import com.ccsens.logistics.service.IWarehouseService;
import com.ccsens.util.JsonResponse;
@ -34,11 +35,11 @@ public class WarehouseController {
@ApiOperation(value = "查询仓库列表及仓库下的摄像头", notes = "mz:查询仓库列表及仓库下的摄像头")
@RequestMapping(value = "/selAllWarehouse", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<WarehouseVo.AllWarehouse> selAllWarehouse(@ApiParam @Validated @RequestBody QueryDto<WarehouseDto.SelWarehouse> params) {
public JsonResponse<ParkVo.ParkInfo> selAllWarehouse(@ApiParam @Validated @RequestBody QueryDto<WarehouseDto.SelWarehouse> params) {
log.info("查询仓库列表及仓库下的摄像头:{}",params);
List<WarehouseVo.AllWarehouse> warehouse = iWarehouseService.selAllWarehouse(params.getParam());
log.info("查询仓库列表及仓库下的摄像头:{}",warehouse);
return JsonResponse.newInstance().ok(warehouse);
ParkVo.ParkInfo parkInfo = iWarehouseService.selAllWarehouse(params.getParam());
log.info("查询仓库列表及仓库下的摄像头:{}",parkInfo);
return JsonResponse.newInstance().ok(parkInfo);
}
}

22
logistics/src/main/java/com/ccsens/logistics/bean/dto/HttpDto.java

@ -0,0 +1,22 @@
package com.ccsens.logistics.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author
*/
@Data
public class HttpDto {
@Data
@ApiModel("温湿度登录接口")
public static class Login{
@ApiModelProperty("账号")
private String loginName;
@ApiModelProperty("密码")
private String password;
}
}

10
logistics/src/main/java/com/ccsens/logistics/bean/dto/MbpsDto.java

@ -25,6 +25,8 @@ public class MbpsDto {
@NotNull(message = "请选择查询类型")
@ApiModelProperty("查询类型(0-按天,1-按周,2-按月,3-按年)")
private Byte queryType;
@ApiModelProperty("查询的天数")
private Integer queryOfDay = 10;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
@ -34,6 +36,9 @@ public class MbpsDto {
@Data
@ApiModel(value = "查看温度和湿度")
public static class SelTeamAndHumidity{
@NotNull(message = "请选择要查询的园区")
@ApiModelProperty("园区id")
private Long parkId;
@NotNull(message = "请选择要查询的仓库")
@ApiModelProperty("仓库id")
private Long warehouseId;
@ -41,11 +46,16 @@ public class MbpsDto {
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("查询的几个小时的数据")
private Integer queryOfDay = 5;
}
@Data
@ApiModel(value = "查询热成像信息")
public static class SelHeatImaging{
@NotNull(message = "请选择要查看的仓库")
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("热成像设备id")
private Long id;
}

3
logistics/src/main/java/com/ccsens/logistics/bean/dto/WarehouseDto.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* @author
*/
@ -13,6 +15,7 @@ public class WarehouseDto {
@Data
@ApiModel("查询仓库")
public static class SelWarehouse{
@NotNull(message = "请选择要查询的园区")
@ApiModelProperty("园区id")
private Long parkId;
@ApiModelProperty("仓库id")

11
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEnvironmentRecord.java

@ -15,6 +15,8 @@ public class LogisticsEnvironmentRecord implements Serializable {
private Long warehouseId;
private String equipmentNum;
private Long recordTime;
private Byte isAlarm;
@ -67,6 +69,14 @@ public class LogisticsEnvironmentRecord implements Serializable {
this.warehouseId = warehouseId;
}
public String getEquipmentNum() {
return equipmentNum;
}
public void setEquipmentNum(String equipmentNum) {
this.equipmentNum = equipmentNum == null ? null : equipmentNum.trim();
}
public Long getRecordTime() {
return recordTime;
}
@ -118,6 +128,7 @@ public class LogisticsEnvironmentRecord implements Serializable {
sb.append(", numType=").append(numType);
sb.append(", equipmentId=").append(equipmentId);
sb.append(", warehouseId=").append(warehouseId);
sb.append(", equipmentNum=").append(equipmentNum);
sb.append(", recordTime=").append(recordTime);
sb.append(", isAlarm=").append(isAlarm);
sb.append(", createdAt=").append(createdAt);

70
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEnvironmentRecordExample.java

@ -406,6 +406,76 @@ public class LogisticsEnvironmentRecordExample {
return (Criteria) this;
}
public Criteria andEquipmentNumIsNull() {
addCriterion("equipment_num is null");
return (Criteria) this;
}
public Criteria andEquipmentNumIsNotNull() {
addCriterion("equipment_num is not null");
return (Criteria) this;
}
public Criteria andEquipmentNumEqualTo(String value) {
addCriterion("equipment_num =", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotEqualTo(String value) {
addCriterion("equipment_num <>", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumGreaterThan(String value) {
addCriterion("equipment_num >", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumGreaterThanOrEqualTo(String value) {
addCriterion("equipment_num >=", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLessThan(String value) {
addCriterion("equipment_num <", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLessThanOrEqualTo(String value) {
addCriterion("equipment_num <=", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLike(String value) {
addCriterion("equipment_num like", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotLike(String value) {
addCriterion("equipment_num not like", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumIn(List<String> values) {
addCriterion("equipment_num in", values, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotIn(List<String> values) {
addCriterion("equipment_num not in", values, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumBetween(String value1, String value2) {
addCriterion("equipment_num between", value1, value2, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotBetween(String value1, String value2) {
addCriterion("equipment_num not between", value1, value2, "equipmentNum");
return (Criteria) this;
}
public Criteria andRecordTimeIsNull() {
addCriterion("record_time is null");
return (Criteria) this;

11
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsHeatImagingRecord.java

@ -23,6 +23,8 @@ public class LogisticsHeatImagingRecord implements Serializable {
private Long warehouseId;
private String equipmentNum;
private Date createdAt;
private Date updatedAt;
@ -105,6 +107,14 @@ public class LogisticsHeatImagingRecord implements Serializable {
this.warehouseId = warehouseId;
}
public String getEquipmentNum() {
return equipmentNum;
}
public void setEquipmentNum(String equipmentNum) {
this.equipmentNum = equipmentNum == null ? null : equipmentNum.trim();
}
public Date getCreatedAt() {
return createdAt;
}
@ -152,6 +162,7 @@ public class LogisticsHeatImagingRecord implements Serializable {
sb.append(", recordTime=").append(recordTime);
sb.append(", equipmentId=").append(equipmentId);
sb.append(", warehouseId=").append(warehouseId);
sb.append(", equipmentNum=").append(equipmentNum);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);

70
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsHeatImagingRecordExample.java

@ -666,6 +666,76 @@ public class LogisticsHeatImagingRecordExample {
return (Criteria) this;
}
public Criteria andEquipmentNumIsNull() {
addCriterion("equipment_num is null");
return (Criteria) this;
}
public Criteria andEquipmentNumIsNotNull() {
addCriterion("equipment_num is not null");
return (Criteria) this;
}
public Criteria andEquipmentNumEqualTo(String value) {
addCriterion("equipment_num =", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotEqualTo(String value) {
addCriterion("equipment_num <>", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumGreaterThan(String value) {
addCriterion("equipment_num >", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumGreaterThanOrEqualTo(String value) {
addCriterion("equipment_num >=", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLessThan(String value) {
addCriterion("equipment_num <", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLessThanOrEqualTo(String value) {
addCriterion("equipment_num <=", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumLike(String value) {
addCriterion("equipment_num like", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotLike(String value) {
addCriterion("equipment_num not like", value, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumIn(List<String> values) {
addCriterion("equipment_num in", values, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotIn(List<String> values) {
addCriterion("equipment_num not in", values, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumBetween(String value1, String value2) {
addCriterion("equipment_num between", value1, value2, "equipmentNum");
return (Criteria) this;
}
public Criteria andEquipmentNumNotBetween(String value1, String value2) {
addCriterion("equipment_num not between", value1, value2, "equipmentNum");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;

11
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsParkEquipment.java

@ -14,6 +14,8 @@ public class LogisticsParkEquipment implements Serializable {
private Long parkId;
private String equipmentLocation;
private Date createdAt;
private Date updatedAt;
@ -62,6 +64,14 @@ public class LogisticsParkEquipment implements Serializable {
this.parkId = parkId;
}
public String getEquipmentLocation() {
return equipmentLocation;
}
public void setEquipmentLocation(String equipmentLocation) {
this.equipmentLocation = equipmentLocation == null ? null : equipmentLocation.trim();
}
public Date getCreatedAt() {
return createdAt;
}
@ -97,6 +107,7 @@ public class LogisticsParkEquipment implements Serializable {
sb.append(", equipmentNumber=").append(equipmentNumber);
sb.append(", equipmentType=").append(equipmentType);
sb.append(", parkId=").append(parkId);
sb.append(", equipmentLocation=").append(equipmentLocation);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);

70
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsParkEquipmentExample.java

@ -425,6 +425,76 @@ public class LogisticsParkEquipmentExample {
return (Criteria) this;
}
public Criteria andEquipmentLocationIsNull() {
addCriterion("equipment_location is null");
return (Criteria) this;
}
public Criteria andEquipmentLocationIsNotNull() {
addCriterion("equipment_location is not null");
return (Criteria) this;
}
public Criteria andEquipmentLocationEqualTo(String value) {
addCriterion("equipment_location =", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationNotEqualTo(String value) {
addCriterion("equipment_location <>", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationGreaterThan(String value) {
addCriterion("equipment_location >", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationGreaterThanOrEqualTo(String value) {
addCriterion("equipment_location >=", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationLessThan(String value) {
addCriterion("equipment_location <", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationLessThanOrEqualTo(String value) {
addCriterion("equipment_location <=", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationLike(String value) {
addCriterion("equipment_location like", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationNotLike(String value) {
addCriterion("equipment_location not like", value, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationIn(List<String> values) {
addCriterion("equipment_location in", values, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationNotIn(List<String> values) {
addCriterion("equipment_location not in", values, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationBetween(String value1, String value2) {
addCriterion("equipment_location between", value1, value2, "equipmentLocation");
return (Criteria) this;
}
public Criteria andEquipmentLocationNotBetween(String value1, String value2) {
addCriterion("equipment_location not between", value1, value2, "equipmentLocation");
return (Criteria) this;
}
public Criteria andCreatedAtIsNull() {
addCriterion("created_at is null");
return (Criteria) this;

17
logistics/src/main/java/com/ccsens/logistics/bean/vo/EquipmentVo.java

@ -11,7 +11,7 @@ import lombok.Data;
public class EquipmentVo {
@Data
@ApiModel("摄像头列表")
@ApiModel("仓库摄像头列表")
public static class AllCamera{
@ApiModelProperty("设备id")
private Long equipmentId;
@ -24,4 +24,19 @@ public class EquipmentVo {
@ApiModelProperty("设备地址")
private String equipmentLocation;
}
@Data
@ApiModel("园区设备列表")
public static class ParkEquipment{
@ApiModelProperty("设备id")
private Long equipmentId;
@ApiModelProperty("设备名称")
private String equipmentName;
@ApiModelProperty("设备编号")
private String equipmentNumber;
@ApiModelProperty("设备类型(0-车辆识别摄像头进,1-车辆识别摄像头出)")
private Byte equipmentType;
@ApiModelProperty("设备地址")
private String equipmentLocation;
}
}

63
logistics/src/main/java/com/ccsens/logistics/bean/vo/HttpVo.java

@ -0,0 +1,63 @@
package com.ccsens.logistics.bean.vo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author
*/
@Data
public class HttpVo {
@Data
@ApiModel("温湿度设备分组")
public static class Groups{
@ApiModelProperty("分组id")
private String groupId;
@ApiModelProperty("分组名称")
private String groupName;
}
@Data
@ApiModel("温湿度设备的数据")
public static class EnvironmentOfData{
@ApiModelProperty("分组id")
private String groupId;
@ApiModelProperty("设备编号")
private String deviceKey;
@ApiModelProperty("设备地址")
private Integer deviceAddr;
@ApiModelProperty("节点编号")
private Integer nodeID;
@ApiModelProperty("节点类型")
private Integer nodeType;
@ApiModelProperty("停用状态,true停用")
private Integer deviceDisabled;
@ApiModelProperty("设备名称")
private String deviceName;
@ApiModelProperty("设备状态0未运行,1离线,2在线")
private Integer deviceStatus;
@ApiModelProperty("实时数据")
private JSONArray relTimeData;
// @ApiModelProperty("实时数据")
// private List<RealData> relTimeData;
}
@Data
@ApiModel("实时数据")
public static class RealData{
@ApiModelProperty("模拟量名称")
private String dataName;
@ApiModelProperty("实时数据")
private String dataValue;
@ApiModelProperty("是否报警")
private Boolean isAlarm;
@ApiModelProperty("报警信息")
private String alarmMsg;
}
}

6
logistics/src/main/java/com/ccsens/logistics/bean/vo/MbpsVo.java

@ -86,18 +86,16 @@ public class MbpsVo {
@Data
@ApiModel("温度变化")
public static class Temps{
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty("时间")
private Date time;
private String time;
@ApiModelProperty("温度")
private BigDecimal temp;
}
@Data
@ApiModel("湿度变化")
public static class Humiditys{
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty("时间")
private Date time;
private String time;
@ApiModelProperty("湿度")
private BigDecimal humidity;
}

25
logistics/src/main/java/com/ccsens/logistics/bean/vo/ParkVo.java

@ -0,0 +1,25 @@
package com.ccsens.logistics.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author
*/
@Data
public class ParkVo {
@Data
@ApiModel("仓库及摄像头")
public static class ParkInfo{
@ApiModelProperty("园区设备")
private List<EquipmentVo.ParkEquipment> parkEquipment = new ArrayList<>();
@ApiModelProperty("仓库信息")
private List<WarehouseVo.AllWarehouse> warehouseInfo = new ArrayList<>();
}
}

16
logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsCarRecordDao.java

@ -20,34 +20,36 @@ public interface LogisticsCarRecordDao extends LogisticsCarRecordMapper {
* @param warehouseId 仓库id
* @return 车辆吞进量
*/
Long selCarOfIn(Long warehouseId);
Long selCarOfIn(@Param("warehouseId") Long warehouseId);
/**
* 查询车辆吐出量
* @param warehouseId 仓库id
* @return 车辆吐出量
*/
Long selCarOfOut(Long warehouseId);
Long selCarOfOut(@Param("warehouseId") Long warehouseId);
/**
* 查询入库吨数
* @param warehouseId 仓库id
* @return 入库吨数
*/
Long selWeightOfIn(Long warehouseId);
Long selWeightOfIn(@Param("warehouseId") Long warehouseId);
/**
* 查询出货吨数
* @param warehouseId 仓库id
* @return 出货吨数
*/
Long selWeightOfOut(Long warehouseId);
Long selWeightOfOut(@Param("warehouseId") Long warehouseId);
/**
* 根据时间查询车辆吞进量
* @param queryType 查询类型
* @param startTime 开始时间
* @param endTime 结束时间
* @param nowDate 现在的时间
* @param countArr 查询的天数
* @return 该时间车辆吞进量
*/
List<MbpsVo.CarOfInByTime> selCarOfInByTime(@Param("queryType") Byte queryType, @Param("startTime") Long startTime, @Param("endTime") Long endTime,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
@ -57,6 +59,8 @@ public interface LogisticsCarRecordDao extends LogisticsCarRecordMapper {
*@param queryType 查询类型
* @param startTime 开始时间
* @param endTime 结束时间
* @param nowDate 现在的时间
* @param countArr 查询的天数
* @return 该时间车辆吐出量
*/
List<MbpsVo.CarOfOutByTime> selCarOfOutByTime(@Param("queryType") Byte queryType,@Param("startTime") Long startTime,@Param("endTime") Long endTime,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
@ -66,6 +70,8 @@ public interface LogisticsCarRecordDao extends LogisticsCarRecordMapper {
* @param queryType 查询类型
* @param startTime 开始时间
* @param endTime 结束时间
* @param nowDate 现在的时间
* @param countArr 查询的天数
* @return 该时间入货量
*/
List<MbpsVo.WeightOfInByTime> selWeightOfInByTime(@Param("queryType") Byte queryType,@Param("startTime") Long startTime,@Param("endTime") Long endTime,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
@ -75,6 +81,8 @@ public interface LogisticsCarRecordDao extends LogisticsCarRecordMapper {
* @param queryType 查询类型
* @param startTime 开始时间
* @param endTime 结束时间
* @param nowDate 现在的时间
* @param countArr 查询的天数
* @return 该时间车辆出货量
*/
List<MbpsVo.WeightOfOutByTime> selWeightOfOutByTime(@Param("queryType") Byte queryType,@Param("startTime") Long startTime,@Param("endTime") Long endTime,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);

16
logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsEnvironmentRecordDao.java

@ -16,32 +16,32 @@ public interface LogisticsEnvironmentRecordDao extends LogisticsEnvironmentRecor
/**
* 查询温度变化
* @param warehouseId 仓库id
* @param startTime 开始时间
* @param endTime 结束时间
* @param countArr 需要查询几天的数据
* @param nowDate 现在的时间
* @return 温度列表
*/
List<MbpsVo.Temps> selTempByTime(@Param("warehouseId") Long warehouseId,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
List<MbpsVo.Temps> selTempByTime(@Param("parkId") Long parkId,@Param("warehouseId") Long warehouseId,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
/**
* 查询湿度变化
* @param warehouseId 仓库id
* @param startTime 开始时间
* @param endTime 结束时间
* @param countArr 需要查询几天的数据
* @param nowDate 现在的时间
* @return 湿度列表
*/
List<MbpsVo.Humiditys> selHumidityByTime(@Param("warehouseId") Long warehouseId,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
List<MbpsVo.Humiditys> selHumidityByTime(@Param("parkId") Long parkId,@Param("warehouseId") Long warehouseId,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
/**
* 是否有火灾
* @param id 仓库id
* @return (0-,1-)
*/
Byte selFire(Long id);
Integer selFire(@Param("id") Long id);
/**
* 是否有水灾
* @param id 仓库id
* @return (0-,1-)
*/
Byte selFlood(Long id);
Integer selFlood(@Param("id") Long id);
}

3
logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsHeatImagingRecordDao.java

@ -13,7 +13,8 @@ public interface LogisticsHeatImagingRecordDao {
/**
* 查询热成像最新信息
* @param id 热成像设备id
* @param warehouseId 仓库id
* @return 热成像信息
*/
MbpsVo.SelHeatImaging selHeatImaging(@Param("id") Long id);
MbpsVo.SelHeatImaging selHeatImaging(@Param("id") Long id,@Param("warehouseId") Long warehouseId);
}

10
logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsParkEquipmentDao.java

@ -1,11 +1,21 @@
package com.ccsens.logistics.persist.dao;
import com.ccsens.logistics.bean.vo.EquipmentVo;
import com.ccsens.logistics.persist.mapper.LogisticsParkEquipmentMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface LogisticsParkEquipmentDao extends LogisticsParkEquipmentMapper {
/**
* 查询园区下的设备
* @param parkId 园区id
* @return 园区设备列表
*/
List<EquipmentVo.ParkEquipment> selParkEquipment(Long parkId);
}

31
logistics/src/main/java/com/ccsens/logistics/scheduled/ScheduledService.java

@ -0,0 +1,31 @@
package com.ccsens.logistics.scheduled;
import com.ccsens.logistics.service.IHttpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* @author
*/
@Slf4j
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
@Component
@EnableScheduling
public class ScheduledService {
@Resource
private IHttpService iHttpService;
@Scheduled(cron = "*/30 * * * * ?")
public void runfirst(){
iHttpService.getTemperatureAndHumidity();
}
}

170
logistics/src/main/java/com/ccsens/logistics/service/HttpService.java

@ -0,0 +1,170 @@
package com.ccsens.logistics.service;
import cn.hutool.core.lang.Snowflake;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.logistics.bean.dto.HttpDto;
import com.ccsens.logistics.bean.po.LogisticsEnvironmentRecord;
import com.ccsens.logistics.bean.vo.HttpVo;
import com.ccsens.logistics.persist.dao.LogisticsEnvironmentRecordDao;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.RestTemplateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.apache.http.HttpEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.ccsens.logistics.Util.Constant;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class HttpService implements IHttpService{
@Resource
private LogisticsEnvironmentRecordDao environmentRecordDao;
@Resource
private Snowflake snowflake;
@Override
public void getTemperatureAndHumidity() {
try {
List<HttpVo.Groups> groupsList = new ArrayList<>();
HttpDto.Login login = new HttpDto.Login();
login.setLoginName("t210510sxck");
login.setPassword("ccsens123");
//调取登录接口 获取userId
String userId = getUserId(login);
//获取设备分组列表
// String getGroupOfUrl = "http://iot.0531yun.cn/wsjc/app/GetUserDeviceGroups";
// String groupString = getBody(getGroupOfUrl,userId);
// JsonResponse<JSONArray> groups = JSONObject.parseObject(groupString,JsonResponse.class);
// JSONArray data = groups.getData();
// for (int i = 0; i < data.size(); i++) {
// HttpVo.Groups oneData = JSONObject.parseObject(data.get(i).toString(), HttpVo.Groups.class);
// groupsList.add(oneData);
// }
//循环查询分组id下的设备数据并存入数据库
String getDataAndSaveOfUrl = "http://iot.0531yun.cn/wsjc/app/GetDeviceData?groupId=";
String environmentOfData = getBody(getDataAndSaveOfUrl, userId);
JSONObject jsonObject = JSONObject.parseObject(environmentOfData);
JSONArray dataArray = jsonObject.getJSONArray("data");
for (int i = 0; i < dataArray.size(); i++) {
LogisticsEnvironmentRecord environmentRecord = new LogisticsEnvironmentRecord();
JSONObject oneObject = dataArray.getJSONObject(i);
//获取设备运行状态 0未运行,1离线,2在线
Integer deviceStatus = oneObject.getInteger("deviceStatus");
//如果设备为在线状态 将数据存入到数据库
if (2 == deviceStatus){
environmentRecord.setEquipmentNum(oneObject.getString("deviceAddr"));
environmentRecord.setRecordTime(System.currentTimeMillis());
JSONArray realTimeData = oneObject.getJSONArray("realTimeData");
for (int j = 0; j < realTimeData.size(); j++) {
JSONObject realData = realTimeData.getJSONObject(j);
switch (realData.getString("dataName")){
case Constant.TEMP :
environmentRecord.setId(snowflake.nextId());
environmentRecord.setNumType((byte)1);
environmentRecord.setNumValue(new BigDecimal(realData.getString("dataValue")));
environmentRecord.setIsAlarm(realData.getBoolean("isAlarm") ? (byte) 1 : (byte) 0);
break;
case Constant.HUMIDITY:
environmentRecord.setId(snowflake.nextId());
environmentRecord.setNumType((byte)0);
environmentRecord.setNumValue(new BigDecimal(realData.getString("dataValue")));
environmentRecord.setIsAlarm(realData.getBoolean("isAlarm") ? (byte) 1 : (byte) 0);
break;
case Constant.WATER_OUT:
environmentRecord.setId(snowflake.nextId());
environmentRecord.setNumType((byte)2);
if(Constant.HAVE_WATER.equals(realData.getString("dataValue"))){
environmentRecord.setNumValue(new BigDecimal(100));
environmentRecord.setIsAlarm((byte)1);
}else{
environmentRecord.setNumValue(new BigDecimal(0));
environmentRecord.setIsAlarm((byte)0);
}
break;
default:
break;
}
environmentRecordDao.insertSelective(environmentRecord);
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
/**
* 温湿度登录接口 获取设备的userId 调用其他接口
* @param login 账号密码
* @return userId
*/
public String getUserId(HttpDto.Login login){
String requestUrl = "http://iot.0531yun.cn/app/Login";
String s = RestTemplateUtil.postBody(requestUrl, login);
JsonResponse<JSONObject> a = JSONObject.parseObject(s, JsonResponse.class);
JSONObject data = a.getData();
return data.getString("userId");
}
//get请求
public static String getBody(String url,String userId){
try {
HttpGet get = new HttpGet(url);
get.setHeader("userId",userId);
HttpClient httpClient = HttpClients.createDefault();
HttpResponse response = httpClient.execute(get);
return getResult(response);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static String getResult(HttpResponse response) throws IOException {
// 获取状态码
int code = response.getStatusLine().getStatusCode();
System.out.println(code);
// 获取body
HttpEntity entity = response.getEntity();
String body = EntityUtils.toString(entity);
System.out.println(body);
// 获取头信息
Header[] allHeaders = response.getAllHeaders();
String headers = Arrays.toString(allHeaders);
System.out.println(headers);
// 返回body
return body;
}
}

13
logistics/src/main/java/com/ccsens/logistics/service/IHttpService.java

@ -0,0 +1,13 @@
package com.ccsens.logistics.service;
/**
* @author
*/
public interface IHttpService {
/**
* 获取温度和湿度
*/
void getTemperatureAndHumidity();
}

5
logistics/src/main/java/com/ccsens/logistics/service/IWarehouseService.java

@ -2,6 +2,7 @@ package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.WarehouseDto;
import com.ccsens.logistics.bean.vo.MbpsVo;
import com.ccsens.logistics.bean.vo.ParkVo;
import com.ccsens.logistics.bean.vo.WarehouseVo;
import java.util.List;
@ -14,7 +15,7 @@ public interface IWarehouseService {
/**
* 查询仓库及摄像头
* @param param 园区id 仓库id
* @return 仓库及摄像头
* @return 园区设备仓库及摄像头
*/
List<WarehouseVo.AllWarehouse> selAllWarehouse(WarehouseDto.SelWarehouse param);
ParkVo.ParkInfo selAllWarehouse(WarehouseDto.SelWarehouse param);
}

62
logistics/src/main/java/com/ccsens/logistics/service/MbpsService.java

@ -16,6 +16,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -42,22 +43,38 @@ public class MbpsService implements IMbpsService {
MbpsVo.AllMbps allMbps = new MbpsVo.AllMbps();
//查询吞进量
Long carOfIn = carRecordDao.selCarOfIn(param.getWarehouseId());
allMbps.setCarOfIn(carOfIn);
if (null == carOfIn){
allMbps.setCarOfIn(0L);
}else{
allMbps.setCarOfIn(carOfIn);
}
//查询吐出量
Long carOfOut = carRecordDao.selCarOfOut(param.getWarehouseId());
allMbps.setCarOfOut(carOfOut);
if (null == carOfOut){
allMbps.setCarOfOut(0L);
}else {
allMbps.setCarOfOut(carOfOut);
}
//查询入库吨数
Long weightOfIn = carRecordDao.selWeightOfIn(param.getWarehouseId());
allMbps.setWeightOfIn(weightOfIn);
if (null == weightOfIn){
allMbps.setWeightOfIn(0L);
}else {
allMbps.setWeightOfIn(weightOfIn);
}
//查询出货吨数
Long weightOfOut = carRecordDao.selWeightOfOut(param.getWarehouseId());
allMbps.setWeightOfOut(weightOfOut);
if (null == weightOfOut){
allMbps.setWeightOfOut(0L);
}else {
allMbps.setWeightOfOut(weightOfOut);
}
return allMbps;
}
@Override
public MbpsVo.SelMbpsByTime selMbpsByTime(MbpsDto.SelMbpsByTime param) {
String[] countArr = new String[10];
String[] countArr = new String[param.getQueryOfDay()];
//查找当前时间
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
@ -92,12 +109,33 @@ public class MbpsService implements IMbpsService {
@Override
public MbpsVo.SelTempAndHumidity selTeamAndHumidity(MbpsDto.SelTeamAndHumidity param) {
MbpsVo.SelTempAndHumidity tempAndHumidity = new MbpsVo.SelTempAndHumidity();
String[] countArr = new String[param.getQueryOfDay()];
//查找当前时间
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH");
String nowDate = format.format(date);
//查询温度
List<MbpsVo.Temps> tempsList = environmentRecordDao.selTempByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime());
List<MbpsVo.Temps> tempsList = environmentRecordDao.selTempByTime(param.getParkId(),param.getWarehouseId(),countArr,nowDate);
if (CollectionUtil.isNotEmpty(tempsList)){
for (MbpsVo.Temps temps : tempsList) {
if (ObjectUtil.isNull(temps.getTemp())){
temps.setTemp(new BigDecimal(0));
}
}
}
tempAndHumidity.getTemps().addAll(tempsList);
//查询湿度
List<MbpsVo.Humiditys> humidityList = environmentRecordDao.selHumidityByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime());
List<MbpsVo.Humiditys> humidityList = environmentRecordDao.selHumidityByTime(param.getParkId(),param.getWarehouseId(),countArr,nowDate);
if (CollectionUtil.isNotEmpty(humidityList)){
for (MbpsVo.Humiditys humidity : humidityList) {
if (ObjectUtil.isNull(humidity.getHumidity())){
humidity.setHumidity(new BigDecimal(0));
}
}
}
tempAndHumidity.getHumiditys().addAll(humidityList);
return tempAndHumidity;
@ -105,7 +143,7 @@ public class MbpsService implements IMbpsService {
@Override
public MbpsVo.SelHeatImaging selHeatImaging(MbpsDto.SelHeatImaging param) {
return heatImagingRecordDao.selHeatImaging(param.getId());
return heatImagingRecordDao.selHeatImaging(param.getId(),param.getWarehouseId());
}
@Override
@ -119,10 +157,10 @@ public class MbpsService implements IMbpsService {
if (CollectionUtil.isNotEmpty(warehouses)){
for (LogisticsWarehouse warehouse : warehouses) {
//火灾
Byte fireAlarm = environmentRecordDao.selFire(warehouse.getId());
Integer fireAlarm = environmentRecordDao.selFire(warehouse.getId());
fireAlarm = fireAlarm == null ? 0 : fireAlarm;
//水灾
Byte floodAlarm = environmentRecordDao.selFlood(warehouse.getId());
Integer floodAlarm = environmentRecordDao.selFlood(warehouse.getId());
floodAlarm = floodAlarm == null ? 0 : floodAlarm;
if (ObjectUtil.isNotNull(fireAlarm)){
@ -144,8 +182,8 @@ public class MbpsService implements IMbpsService {
}
}
}else{
Byte fireAlarm = environmentRecordDao.selFire(param.getWarehouseId());
Byte floodAlarm = environmentRecordDao.selFlood(param.getWarehouseId());
Integer fireAlarm = environmentRecordDao.selFire(param.getWarehouseId());
Integer floodAlarm = environmentRecordDao.selFlood(param.getWarehouseId());
if (ObjectUtil.isNotNull(fireAlarm)){
fireOrFlood.setIsFire(fireAlarm == 1);
}

16
logistics/src/main/java/com/ccsens/logistics/service/WarehouseService.java

@ -1,7 +1,10 @@
package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.WarehouseDto;
import com.ccsens.logistics.bean.vo.EquipmentVo;
import com.ccsens.logistics.bean.vo.ParkVo;
import com.ccsens.logistics.bean.vo.WarehouseVo;
import com.ccsens.logistics.persist.dao.LogisticsParkEquipmentDao;
import com.ccsens.logistics.persist.dao.LogisticsWarehouseDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@ -21,10 +24,19 @@ public class WarehouseService implements IWarehouseService {
@Resource
private LogisticsWarehouseDao warehouseDao;
@Resource
private LogisticsParkEquipmentDao parkEquipmentDao;
@Override
public List<WarehouseVo.AllWarehouse> selAllWarehouse(WarehouseDto.SelWarehouse param) {
return warehouseDao.selWarehouseAndCamera(param.getParkId(),param.getWarehouseId());
public ParkVo.ParkInfo selAllWarehouse(WarehouseDto.SelWarehouse param) {
ParkVo.ParkInfo parkInfo = new ParkVo.ParkInfo();
//查询仓库及仓库下的设备
List<WarehouseVo.AllWarehouse> warehouses = warehouseDao.selWarehouseAndCamera(param.getParkId(), param.getWarehouseId());
parkInfo.getWarehouseInfo().addAll(warehouses);
//查询园区下的摄像头设备
List<EquipmentVo.ParkEquipment> parkEquipments = parkEquipmentDao.selParkEquipment(param.getParkId());
parkInfo.getParkEquipment().addAll(parkEquipments);
return parkInfo;
}
}

8
logistics/src/main/resources/application-prod.yml

@ -8,7 +8,7 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
rabbitmq:
host: 127.0.0.1
host: 121.36.3.207
password: 111111
port: 5672
username: admin
@ -21,15 +21,15 @@ spring:
max-idle: 10
max-wait: -1ms
min-idle: 0
# password: ''
password: 'areowqr!@43ef'
password: ''
# password: 'areowqr!@43ef'
port: 6379
timeout: 1000ms
swagger:
enable: true
eureka:
instance:
ip-address: 121.36.3.207
ip-address: 119.3.214.36
gatewayUrl: https://www.tall.wiki/gateway/
notGatewayUrl: https://www.tall.wiki/

6
logistics/src/main/resources/druid-prod.yml

@ -15,7 +15,7 @@ spring:
maxWait: 60000
minEvictableIdleTimeMillis: 300000
minIdle: 5
password:
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
@ -27,7 +27,7 @@ spring:
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://127.0.0.1/logisticspark?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
url: jdbc:mysql://www.tall.wiki/logistics?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_GAME
env: CCSENS_TALL

8
logistics/src/main/resources/mapper_dao/LogisticsCarRecordDao.xml

@ -4,28 +4,28 @@
<select id="selCarOfIn" resultType="java.lang.Long">
SELECT COUNT(cr.id) FROM t_logistics_car_record AS cr WHERE cr.in_out = 0 AND cr.rec_status = 0
<if test="warehouseId!=null and warehouseId!=''">
<if test="warehouseId!=null or warehouseId!=''">
AND cr.warehouse_id = #{warehouseId}
</if>
</select>
<select id="selCarOfOut" resultType="java.lang.Long">
SELECT COUNT(cr.id) FROM t_logistics_car_record AS cr WHERE cr.in_out = 1 AND cr.rec_status = 0
<if test="warehouseId!=null and warehouseId!=''">
<if test="warehouseId!=null or warehouseId!=''">
AND cr.warehouse_id = #{warehouseId}
</if>
</select>
<select id="selWeightOfIn" resultType="java.lang.Long">
SELECT SUM(cr.car_weight) FROM t_logistics_car_record AS cr WHERE cr.in_out = 0 AND cr.rec_status = 0
<if test="warehouseId!=null and warehouseId!=''">
<if test="warehouseId!=null or warehouseId!=''">
AND cr.warehouse_id = #{warehouseId}
</if>
</select>
<select id="selWeightOfOut" resultType="java.lang.Long">
SELECT SUM(cr.car_weight) FROM t_logistics_car_record AS cr WHERE cr.in_out = 1 AND cr.rec_status = 0
<if test="warehouseId!=null and warehouseId!=''">
<if test="warehouseId!=null or warehouseId!=''">
AND cr.warehouse_id = #{warehouseId}
</if>
</select>

102
logistics/src/main/resources/mapper_dao/LogisticsEnvironmentRecordDao.xml

@ -4,76 +4,88 @@
<select id="selTempByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$Temps">
SELECT
id,
FROM_UNIXTIME(
record_time / 1000,
'%H:%i:%s') AS time,
MAX(num_value) AS temp
s.date AS time,
MAX(newEr.numValue) AS temp
FROM
t_logistics_environment_record
WHERE
num_type = 0
AND warehouse_id = #{warehouseId}
AND rec_status = 0
AND record_time BETWEEN #{startTime} AND #{endTime}
GROUP BY
HOUR (
FROM_UNIXTIME(
record_time / 1000,
'%H:%i:%s'
))
(select date_add(#{nowDate},interval @i:=@i-1 HOUR) as date
from (
SELECT 1
<foreach item="index" collection="countArr">
union all select 1
</foreach>
) AS tmp,
( SELECT @i := + 1 ) t ) AS s
LEFT JOIN
(
SELECT
FROM_UNIXTIME(er.record_time/1000,'%Y-%m-%d %H:00:00') AS recordTime,
er.num_value AS numValue
FROM
t_logistics_environment_record AS er
LEFT JOIN t_logistics_equipment AS e ON er.equipment_num = e.equipment_number
LEFT JOIN t_logistics_warehouse AS w ON w.id = e.warehouse_id
WHERE er.rec_status = 0 AND e.rec_status = 0 AND w.rec_status = 0 AND er.num_type = 1 AND e.warehouse_id = #{warehouseId} AND w.park_id = #{parkId}
) AS newEr ON newEr.recordTime = s.date
group by s.date ORDER BY s.date
</select>
<select id="selHumidityByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$Humiditys">
SELECT
id,
FROM_UNIXTIME(
record_time / 1000,
'%H:%i:%s') AS time,
MAX(num_value) AS humidity
s.date AS time,
MAX(newEr.numValue) AS humidity
FROM
t_logistics_environment_record
WHERE
num_type = 1
AND warehouse_id = #{warehouseId}
AND rec_status = 0
AND record_time BETWEEN #{startTime} AND #{endTime}
GROUP BY
HOUR (
FROM_UNIXTIME(
record_time / 1000,
'%H:%i:%s'
))
(select date_add(#{nowDate},interval @i:=@i-1 HOUR) as date
from (
SELECT 1
<foreach item="index" collection="countArr">
union all select 1
</foreach>
) AS tmp,
( SELECT @i := + 1 ) t ) AS s
LEFT JOIN
(
SELECT
FROM_UNIXTIME(er.record_time/1000,'%Y-%m-%d %H:00:00') AS recordTime,
er.num_value AS numValue
FROM
t_logistics_environment_record AS er
LEFT JOIN t_logistics_equipment AS e ON er.equipment_num = e.equipment_number
LEFT JOIN t_logistics_warehouse AS w ON w.id = e.warehouse_id
WHERE er.rec_status = 0 AND e.rec_status = 0 AND w.rec_status = 0 AND er.num_type = 0 AND e.warehouse_id = #{warehouseId} AND w.park_id = #{parkId}
) AS newEr ON newEr.recordTime = s.date
group by s.date ORDER BY s.date
</select>
<select id="selFire" resultType="java.lang.Byte">
SELECT
<select id="selFire" resultType="java.lang.Integer">
SELECT
er.is_alarm AS isFire
FROM
t_logistics_environment_record AS er
LEFT JOIN t_logistics_warehouse AS w ON er.warehouse_id = w.id
AND w.rec_status = 0
LEFT JOIN t_logistics_equipment AS e ON e.id = er.equipment_id
LEFT JOIN t_logistics_warehouse AS w ON e.warehouse_id = w.id
AND w.rec_status = 0
WHERE
er.num_type = 1
er.num_type = 3
AND w.id = #{id}
ORDER BY
er.record_time DESC
LIMIT 1
LIMIT 1
</select>
<select id="selFlood" resultType="java.lang.Byte">
<select id="selFlood" resultType="java.lang.Integer">
SELECT
er.is_alarm AS isFlood
FROM
t_logistics_environment_record AS er
LEFT JOIN t_logistics_warehouse AS w ON er.warehouse_id = w.id
AND w.rec_status = 0
LEFT JOIN t_logistics_equipment AS e ON er.equipment_num = e.equipment_number
LEFT JOIN t_logistics_warehouse AS w ON e.warehouse_id = w.id
AND w.rec_status = 0
WHERE
er.num_type = 0
er.num_type = 2
AND w.id = #{id}
ORDER BY
er.record_time DESC
LIMIT 1
LIMIT 1
</select>
</mapper>

5
logistics/src/main/resources/mapper_dao/LogisticsHeatImagingRecordDao.xml

@ -5,7 +5,7 @@
<select id="selHeatImaging" resultType="com.ccsens.logistics.bean.vo.MbpsVo$SelHeatImaging">
SELECT
ir.id AS id,
ir.num_value AS numValue,
ir.max_t AS numValue,
ir.max_tx AS maxTx,
ir.max_ty AS maxTy,
ir.image_data AS imageData
@ -18,6 +18,9 @@
<if test="id != null">
AND le.id = #{id}
</if>
<if test="warehouseId != null">
AND le.warehouse_id = #{warehouseId}
</if>
ORDER BY
ir.record_time DESC
LIMIT 1

13
logistics/src/main/resources/mapper_dao/LogisticsParkEquipmentDao.xml

@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.logistics.persist.dao.LogisticsParkEquipmentDao">
<select id="selParkEquipment" resultType="com.ccsens.logistics.bean.vo.EquipmentVo$ParkEquipment">
SELECT
pe.id AS equipmentId,
pe.`name` AS equipmentName,
pe.equipment_number AS equipmentNumber,
pe.equipment_type AS equipmentType,
pe.equipment_location AS equipmentLocation
FROM
t_logistics_park_equipment AS pe
WHERE
park_id = #{parkId}
</select>
</mapper>

31
logistics/src/main/resources/mapper_raw/LogisticsEnvironmentRecordMapper.xml

@ -7,6 +7,7 @@
<result column="num_type" jdbcType="TINYINT" property="numType" />
<result column="equipment_id" jdbcType="BIGINT" property="equipmentId" />
<result column="warehouse_id" jdbcType="BIGINT" property="warehouseId" />
<result column="equipment_num" jdbcType="VARCHAR" property="equipmentNum" />
<result column="record_time" jdbcType="BIGINT" property="recordTime" />
<result column="is_alarm" jdbcType="TINYINT" property="isAlarm" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
@ -72,8 +73,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, num_value, num_type, equipment_id, warehouse_id, record_time, is_alarm, created_at,
updated_at, rec_status
id, num_value, num_type, equipment_id, warehouse_id, equipment_num, record_time,
is_alarm, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.logistics.bean.po.LogisticsEnvironmentRecordExample" resultMap="BaseResultMap">
select
@ -107,13 +108,13 @@
</delete>
<insert id="insert" parameterType="com.ccsens.logistics.bean.po.LogisticsEnvironmentRecord">
insert into t_logistics_environment_record (id, num_value, num_type,
equipment_id, warehouse_id, record_time,
is_alarm, created_at, updated_at,
rec_status)
equipment_id, warehouse_id, equipment_num,
record_time, is_alarm, created_at,
updated_at, rec_status)
values (#{id,jdbcType=BIGINT}, #{numValue,jdbcType=DECIMAL}, #{numType,jdbcType=TINYINT},
#{equipmentId,jdbcType=BIGINT}, #{warehouseId,jdbcType=BIGINT}, #{recordTime,jdbcType=BIGINT},
#{isAlarm,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
#{equipmentId,jdbcType=BIGINT}, #{warehouseId,jdbcType=BIGINT}, #{equipmentNum,jdbcType=VARCHAR},
#{recordTime,jdbcType=BIGINT}, #{isAlarm,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.logistics.bean.po.LogisticsEnvironmentRecord">
insert into t_logistics_environment_record
@ -133,6 +134,9 @@
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="equipmentNum != null">
equipment_num,
</if>
<if test="recordTime != null">
record_time,
</if>
@ -165,6 +169,9 @@
<if test="warehouseId != null">
#{warehouseId,jdbcType=BIGINT},
</if>
<if test="equipmentNum != null">
#{equipmentNum,jdbcType=VARCHAR},
</if>
<if test="recordTime != null">
#{recordTime,jdbcType=BIGINT},
</if>
@ -206,6 +213,9 @@
<if test="record.warehouseId != null">
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
</if>
<if test="record.equipmentNum != null">
equipment_num = #{record.equipmentNum,jdbcType=VARCHAR},
</if>
<if test="record.recordTime != null">
record_time = #{record.recordTime,jdbcType=BIGINT},
</if>
@ -233,6 +243,7 @@
num_type = #{record.numType,jdbcType=TINYINT},
equipment_id = #{record.equipmentId,jdbcType=BIGINT},
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
equipment_num = #{record.equipmentNum,jdbcType=VARCHAR},
record_time = #{record.recordTime,jdbcType=BIGINT},
is_alarm = #{record.isAlarm,jdbcType=TINYINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
@ -257,6 +268,9 @@
<if test="warehouseId != null">
warehouse_id = #{warehouseId,jdbcType=BIGINT},
</if>
<if test="equipmentNum != null">
equipment_num = #{equipmentNum,jdbcType=VARCHAR},
</if>
<if test="recordTime != null">
record_time = #{recordTime,jdbcType=BIGINT},
</if>
@ -281,6 +295,7 @@
num_type = #{numType,jdbcType=TINYINT},
equipment_id = #{equipmentId,jdbcType=BIGINT},
warehouse_id = #{warehouseId,jdbcType=BIGINT},
equipment_num = #{equipmentNum,jdbcType=VARCHAR},
record_time = #{recordTime,jdbcType=BIGINT},
is_alarm = #{isAlarm,jdbcType=TINYINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},

27
logistics/src/main/resources/mapper_raw/LogisticsHeatImagingRecordMapper.xml

@ -11,6 +11,7 @@
<result column="record_time" jdbcType="BIGINT" property="recordTime" />
<result column="equipment_id" jdbcType="BIGINT" property="equipmentId" />
<result column="warehouse_id" jdbcType="BIGINT" property="warehouseId" />
<result column="equipment_num" jdbcType="VARCHAR" property="equipmentNum" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
@ -78,7 +79,7 @@
</sql>
<sql id="Base_Column_List">
id, num_value, num_type, max_t, max_tx, max_ty, record_time, equipment_id, warehouse_id,
created_at, updated_at, rec_status
equipment_num, created_at, updated_at, rec_status
</sql>
<sql id="Blob_Column_List">
image_data
@ -135,13 +136,13 @@
insert into t_logistics_heat_imaging_record (id, num_value, num_type,
max_t, max_tx, max_ty,
record_time, equipment_id, warehouse_id,
created_at, updated_at, rec_status,
image_data)
equipment_num, created_at, updated_at,
rec_status, image_data)
values (#{id,jdbcType=BIGINT}, #{numValue,jdbcType=DECIMAL}, #{numType,jdbcType=TINYINT},
#{maxT,jdbcType=DECIMAL}, #{maxTx,jdbcType=VARCHAR}, #{maxTy,jdbcType=VARCHAR},
#{recordTime,jdbcType=BIGINT}, #{equipmentId,jdbcType=BIGINT}, #{warehouseId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT},
#{imageData,jdbcType=LONGVARCHAR})
#{equipmentNum,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT}, #{imageData,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.logistics.bean.po.LogisticsHeatImagingRecord">
insert into t_logistics_heat_imaging_record
@ -173,6 +174,9 @@
<if test="warehouseId != null">
warehouse_id,
</if>
<if test="equipmentNum != null">
equipment_num,
</if>
<if test="createdAt != null">
created_at,
</if>
@ -214,6 +218,9 @@
<if test="warehouseId != null">
#{warehouseId,jdbcType=BIGINT},
</if>
<if test="equipmentNum != null">
#{equipmentNum,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
@ -264,6 +271,9 @@
<if test="record.warehouseId != null">
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
</if>
<if test="record.equipmentNum != null">
equipment_num = #{record.equipmentNum,jdbcType=VARCHAR},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
@ -292,6 +302,7 @@
record_time = #{record.recordTime,jdbcType=BIGINT},
equipment_id = #{record.equipmentId,jdbcType=BIGINT},
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
equipment_num = #{record.equipmentNum,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT},
@ -311,6 +322,7 @@
record_time = #{record.recordTime,jdbcType=BIGINT},
equipment_id = #{record.equipmentId,jdbcType=BIGINT},
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
equipment_num = #{record.equipmentNum,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
@ -345,6 +357,9 @@
<if test="warehouseId != null">
warehouse_id = #{warehouseId,jdbcType=BIGINT},
</if>
<if test="equipmentNum != null">
equipment_num = #{equipmentNum,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
@ -370,6 +385,7 @@
record_time = #{recordTime,jdbcType=BIGINT},
equipment_id = #{equipmentId,jdbcType=BIGINT},
warehouse_id = #{warehouseId,jdbcType=BIGINT},
equipment_num = #{equipmentNum,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT},
@ -386,6 +402,7 @@
record_time = #{recordTime,jdbcType=BIGINT},
equipment_id = #{equipmentId,jdbcType=BIGINT},
warehouse_id = #{warehouseId,jdbcType=BIGINT},
equipment_num = #{equipmentNum,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}

28
logistics/src/main/resources/mapper_raw/LogisticsParkEquipmentMapper.xml

@ -7,6 +7,7 @@
<result column="equipment_number" jdbcType="VARCHAR" property="equipmentNumber" />
<result column="equipment_type" jdbcType="TINYINT" property="equipmentType" />
<result column="park_id" jdbcType="BIGINT" property="parkId" />
<result column="equipment_location" jdbcType="VARCHAR" property="equipmentLocation" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
@ -70,7 +71,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, equipment_number, equipment_type, park_id, created_at, updated_at, rec_status
id, name, equipment_number, equipment_type, park_id, equipment_location, created_at,
updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.logistics.bean.po.LogisticsParkEquipmentExample" resultMap="BaseResultMap">
select
@ -104,11 +106,13 @@
</delete>
<insert id="insert" parameterType="com.ccsens.logistics.bean.po.LogisticsParkEquipment">
insert into t_logistics_park_equipment (id, name, equipment_number,
equipment_type, park_id, created_at,
updated_at, rec_status)
equipment_type, park_id, equipment_location,
created_at, updated_at, rec_status
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{equipmentNumber,jdbcType=VARCHAR},
#{equipmentType,jdbcType=TINYINT}, #{parkId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
#{equipmentType,jdbcType=TINYINT}, #{parkId,jdbcType=BIGINT}, #{equipmentLocation,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
</insert>
<insert id="insertSelective" parameterType="com.ccsens.logistics.bean.po.LogisticsParkEquipment">
insert into t_logistics_park_equipment
@ -128,6 +132,9 @@
<if test="parkId != null">
park_id,
</if>
<if test="equipmentLocation != null">
equipment_location,
</if>
<if test="createdAt != null">
created_at,
</if>
@ -154,6 +161,9 @@
<if test="parkId != null">
#{parkId,jdbcType=BIGINT},
</if>
<if test="equipmentLocation != null">
#{equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
#{createdAt,jdbcType=TIMESTAMP},
</if>
@ -189,6 +199,9 @@
<if test="record.parkId != null">
park_id = #{record.parkId,jdbcType=BIGINT},
</if>
<if test="record.equipmentLocation != null">
equipment_location = #{record.equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="record.createdAt != null">
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
</if>
@ -210,6 +223,7 @@
equipment_number = #{record.equipmentNumber,jdbcType=VARCHAR},
equipment_type = #{record.equipmentType,jdbcType=TINYINT},
park_id = #{record.parkId,jdbcType=BIGINT},
equipment_location = #{record.equipmentLocation,jdbcType=VARCHAR},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
@ -232,6 +246,9 @@
<if test="parkId != null">
park_id = #{parkId,jdbcType=BIGINT},
</if>
<if test="equipmentLocation != null">
equipment_location = #{equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="createdAt != null">
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
@ -250,6 +267,7 @@
equipment_number = #{equipmentNumber,jdbcType=VARCHAR},
equipment_type = #{equipmentType,jdbcType=TINYINT},
park_id = #{parkId,jdbcType=BIGINT},
equipment_location = #{equipmentLocation,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}

Loading…
Cancel
Save