Browse Source

增加查询仓库及摄像头接口,查询温度湿度接口

logistics
ma 4 years ago
parent
commit
30dce09e83
  1. 42
      logistics/src/main/java/com/ccsens/logistics/api/EquipmentController.java
  2. 11
      logistics/src/main/java/com/ccsens/logistics/api/MbpsController.java
  3. 44
      logistics/src/main/java/com/ccsens/logistics/api/WarehouseController.java
  4. 20
      logistics/src/main/java/com/ccsens/logistics/bean/dto/EquipmentDto.java
  5. 15
      logistics/src/main/java/com/ccsens/logistics/bean/dto/MbpsDto.java
  6. 21
      logistics/src/main/java/com/ccsens/logistics/bean/dto/WarehouseDto.java
  7. 22
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEquipment.java
  8. 140
      logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEquipmentExample.java
  9. 27
      logistics/src/main/java/com/ccsens/logistics/bean/vo/EquipmentVo.java
  10. 30
      logistics/src/main/java/com/ccsens/logistics/bean/vo/MbpsVo.java
  11. 26
      logistics/src/main/java/com/ccsens/logistics/bean/vo/WarehouseVo.java
  12. 2
      logistics/src/main/java/com/ccsens/logistics/config/SwaggerConfigure.java
  13. 1
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsCarRecordDao.java
  14. 22
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsEnvironmentRecordDao.java
  15. 13
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsWarehouseDao.java
  16. 19
      logistics/src/main/java/com/ccsens/logistics/service/EquipmentService.java
  17. 14
      logistics/src/main/java/com/ccsens/logistics/service/IEquipmentService.java
  18. 8
      logistics/src/main/java/com/ccsens/logistics/service/IMbpsService.java
  19. 20
      logistics/src/main/java/com/ccsens/logistics/service/IWarehouseService.java
  20. 17
      logistics/src/main/java/com/ccsens/logistics/service/MbpsService.java
  21. 33
      logistics/src/main/java/com/ccsens/logistics/service/WarehouseService.java
  22. 4
      logistics/src/main/resources/application.yml
  23. 2
      logistics/src/main/resources/logback-spring.xml
  24. 40
      logistics/src/main/resources/mapper_dao/LogisticsCarRecordDao.xml
  25. 44
      logistics/src/main/resources/mapper_dao/LogisticsEnvironmentRecordDao.xml
  26. 35
      logistics/src/main/resources/mapper_dao/LogisticsWarehouseDao.xml
  27. 42
      logistics/src/main/resources/mapper_raw/LogisticsEquipmentMapper.xml

42
logistics/src/main/java/com/ccsens/logistics/api/EquipmentController.java

@ -0,0 +1,42 @@
package com.ccsens.logistics.api;
import com.ccsens.logistics.bean.dto.EquipmentDto;
import com.ccsens.logistics.bean.vo.EquipmentVo;
import com.ccsens.logistics.service.IEquipmentService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@Slf4j
@Api(tags = "设备相关接口")
@RestController
@RequestMapping("/equipment")
public class EquipmentController {
@Resource
private IEquipmentService iEquipmentService;
@ApiOperation(value = "查询摄像头列表(暂不使用)", notes = "mz:查询摄像头列表")
@RequestMapping(value = "/selCamera", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<EquipmentVo.AllCamera>> selCamera(@ApiParam @Validated @RequestBody QueryDto<EquipmentDto.SelCamera> params) {
log.info("查看交付物的历史记录:{}",params);
// List<EquipmentVo.AllCamera> allCamera = iEquipmentService.selCamera(params.getParam());
// log.info("查看交付物的历史记录:{}",allCamera);
return JsonResponse.newInstance().ok();
}
}

11
logistics/src/main/java/com/ccsens/logistics/api/MbpsController.java

@ -25,7 +25,7 @@ import java.util.List;
@Slf4j
@Api(tags = "吞吐量相关接口" , description = "")
@RestController
@RequestMapping("/Mbps")
@RequestMapping("/mbps")
public class MbpsController {
@Resource
@ -49,4 +49,13 @@ public class MbpsController {
return JsonResponse.newInstance().ok(allMbps);
}
@ApiOperation(value = "查询温度与湿度", notes = "mz:查询温度与湿度")
@RequestMapping(value = "/selTeamAndHumidity", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<MbpsVo.SelTempAndHumidity> selTeamAndHumidity(@ApiParam @Validated @RequestBody QueryDto<MbpsDto.SelTeamAndHumidity> params) {
log.info("查看交付物的历史记录:{}",params);
MbpsVo.SelTempAndHumidity teamAndHumidity = iMbpsService.selTeamAndHumidity(params.getParam());
log.info("查看交付物的历史记录:{}",teamAndHumidity);
return JsonResponse.newInstance().ok(teamAndHumidity);
}
}

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

@ -0,0 +1,44 @@
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.WarehouseVo;
import com.ccsens.logistics.service.IWarehouseService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@Slf4j
@Api(tags = "仓库相关接口" , description = "")
@RestController
@RequestMapping("/warehouse")
public class WarehouseController {
@Resource
private IWarehouseService iWarehouseService;
@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) {
log.info("查看交付物的历史记录:{}",params);
List<WarehouseVo.AllWarehouse> warehouse = iWarehouseService.selAllWarehouse(params.getParam());
log.info("查看交付物的历史记录:{}",warehouse);
return JsonResponse.newInstance().ok(warehouse);
}
}

20
logistics/src/main/java/com/ccsens/logistics/bean/dto/EquipmentDto.java

@ -0,0 +1,20 @@
package com.ccsens.logistics.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author
*/
@Data
public class EquipmentDto {
@Data
@ApiModel("查询摄像头")
public static class SelCamera{
@ApiModelProperty("仓库id")
private Long warehouseId;
}
}

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

@ -11,14 +11,14 @@ import lombok.Data;
public class MbpsDto {
@Data
@ApiModel
@ApiModel(value = "查询总吞吐量")
public static class SelAllMbpsSerch{
@ApiModelProperty("仓库id")
private Long warehouseId;
}
@Data
@ApiModel
@ApiModel(value = "查询吞吐量折线图")
public static class SelMbpsByTime{
@ApiModelProperty("查询类型(0-按天,1-按周,2-按月,3-按年)")
private Byte queryType;
@ -28,4 +28,15 @@ public class MbpsDto {
private Long endTime;
}
@Data
@ApiModel(value = "查看温度和湿度")
public static class SelTeamAndHumidity{
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
}
}

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

@ -0,0 +1,21 @@
package com.ccsens.logistics.bean.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author
*/
@Data
public class WarehouseDto {
@Data
@ApiModel("查询仓库")
public static class SelWarehouse{
@ApiModelProperty("园区id")
private Long parkId;
@ApiModelProperty("仓库id")
private Long warehouseId;
}
}

22
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEquipment.java

@ -20,6 +20,10 @@ public class LogisticsEquipment implements Serializable {
private Byte recStatus;
private String equipmentLocation;
private String remark;
private static final long serialVersionUID = 1L;
public Long getId() {
@ -86,6 +90,22 @@ public class LogisticsEquipment implements Serializable {
this.recStatus = recStatus;
}
public String getEquipmentLocation() {
return equipmentLocation;
}
public void setEquipmentLocation(String equipmentLocation) {
this.equipmentLocation = equipmentLocation == null ? null : equipmentLocation.trim();
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@ -100,6 +120,8 @@ public class LogisticsEquipment implements Serializable {
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);
sb.append(", recStatus=").append(recStatus);
sb.append(", equipmentLocation=").append(equipmentLocation);
sb.append(", remark=").append(remark);
sb.append("]");
return sb.toString();
}

140
logistics/src/main/java/com/ccsens/logistics/bean/po/LogisticsEquipmentExample.java

@ -594,6 +594,146 @@ public class LogisticsEquipmentExample {
addCriterion("rec_status not between", value1, value2, "recStatus");
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 andRemarkIsNull() {
addCriterion("remark is null");
return (Criteria) this;
}
public Criteria andRemarkIsNotNull() {
addCriterion("remark is not null");
return (Criteria) this;
}
public Criteria andRemarkEqualTo(String value) {
addCriterion("remark =", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotEqualTo(String value) {
addCriterion("remark <>", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThan(String value) {
addCriterion("remark >", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkGreaterThanOrEqualTo(String value) {
addCriterion("remark >=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThan(String value) {
addCriterion("remark <", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLessThanOrEqualTo(String value) {
addCriterion("remark <=", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkLike(String value) {
addCriterion("remark like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotLike(String value) {
addCriterion("remark not like", value, "remark");
return (Criteria) this;
}
public Criteria andRemarkIn(List<String> values) {
addCriterion("remark in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotIn(List<String> values) {
addCriterion("remark not in", values, "remark");
return (Criteria) this;
}
public Criteria andRemarkBetween(String value1, String value2) {
addCriterion("remark between", value1, value2, "remark");
return (Criteria) this;
}
public Criteria andRemarkNotBetween(String value1, String value2) {
addCriterion("remark not between", value1, value2, "remark");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

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

@ -0,0 +1,27 @@
package com.ccsens.logistics.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author
*/
@Data
public class EquipmentVo {
@Data
@ApiModel("摄像头列表")
public static class AllCamera{
@ApiModelProperty("设备id")
private Long equipmentId;
@ApiModelProperty("设备名称")
private String equipmentName;
@ApiModelProperty("设备编号")
private Integer equipmentNumber;
@ApiModelProperty("设备类型(0-摄像头,1-温度测试,2-湿度测试,3-漏水检测)")
private Byte equipmentType;
@ApiModelProperty("设备地址")
private String equipmentLocation;
}
}

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

@ -1,9 +1,11 @@
package com.ccsens.logistics.bean.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
@ -71,4 +73,32 @@ public class MbpsVo {
private Long weightOfOut;
}
@Data
@ApiModel("查询温度和湿度")
public static class SelTempAndHumidity{
@ApiModelProperty("温度变化")
private List<Temps> temps = new ArrayList<>();
@ApiModelProperty("湿度变化")
private List<Humiditys> humiditys = new ArrayList<>();
}
@Data
@ApiModel("温度变化")
public static class Temps{
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty("时间")
private Date time;
@ApiModelProperty("温度")
private Long temp;
}
@Data
@ApiModel("湿度变化")
public static class Humiditys{
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty("时间")
private Date time;
@ApiModelProperty("湿度")
private Long humidity;
}
}

26
logistics/src/main/java/com/ccsens/logistics/bean/vo/WarehouseVo.java

@ -0,0 +1,26 @@
package com.ccsens.logistics.bean.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author
*/
@Data
public class WarehouseVo {
@Data
@ApiModel("仓库及摄像头")
public static class AllWarehouse{
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("摄像头列表")
private List<EquipmentVo.AllCamera> cameras;
}
}

2
logistics/src/main/java/com/ccsens/logistics/config/SwaggerConfigure.java

@ -28,7 +28,7 @@ public class SwaggerConfigure /*implements WebMvcConfigurer*/ {
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors
.basePackage("com.ccsens.logistics.web"))
.basePackage("com.ccsens.logistics.api"))
.build()
.globalOperationParameters(setHeaderToken());
}

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

@ -5,6 +5,7 @@ import com.ccsens.logistics.persist.mapper.LogisticsCarRecordMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**

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

@ -1,11 +1,33 @@
package com.ccsens.logistics.persist.dao;
import com.ccsens.logistics.bean.vo.MbpsVo;
import com.ccsens.logistics.persist.mapper.LogisticsEnvironmentRecordMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface LogisticsEnvironmentRecordDao extends LogisticsEnvironmentRecordMapper {
/**
* 查询温度变化
* @param warehouseId 仓库id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 温度列表
*/
List<MbpsVo.Temps> selTempByTime(@Param("warehouseId") Long warehouseId,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
/**
* 查询湿度变化
* @param warehouseId 仓库id
* @param startTime 开始时间
* @param endTime 结束时间
* @return 湿度列表
*/
List<MbpsVo.Humiditys> selHumidityByTime(@Param("warehouseId") Long warehouseId,@Param("startTime") Long startTime,@Param("endTime") Long endTime);
}

13
logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsWarehouseDao.java

@ -1,11 +1,24 @@
package com.ccsens.logistics.persist.dao;
import com.ccsens.logistics.bean.vo.WarehouseVo;
import com.ccsens.logistics.persist.mapper.LogisticsWarehouseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author
*/
@Repository
public interface LogisticsWarehouseDao extends LogisticsWarehouseMapper {
/**
* 查询仓库及下面的摄像头
* @param parkId 园区id
* @param warehouseId 仓库id
* @return 仓库及摄像头
*/
List<WarehouseVo.AllWarehouse> selWarehouseAndCamera(@Param("parkId") Long parkId,@Param("warehouseId") Long warehouseId);
}

19
logistics/src/main/java/com/ccsens/logistics/service/EquipmentService.java

@ -0,0 +1,19 @@
package com.ccsens.logistics.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/**
* 设备相关
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class EquipmentService implements IEquipmentService {
}

14
logistics/src/main/java/com/ccsens/logistics/service/IEquipmentService.java

@ -0,0 +1,14 @@
package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.EquipmentDto;
import com.ccsens.logistics.bean.vo.EquipmentVo;
import java.util.List;
/**
* 设备相关
* @author
*/
public interface IEquipmentService {
}

8
logistics/src/main/java/com/ccsens/logistics/service/IMbpsService.java

@ -3,7 +3,6 @@ package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.MbpsDto;
import com.ccsens.logistics.bean.vo.MbpsVo;
import java.util.List;
/**
* @author
@ -23,4 +22,11 @@ public interface IMbpsService {
* @return 当前时间段的数据
*/
MbpsVo.SelMbpsByTime selMbpsByTime(MbpsDto.SelMbpsByTime param);
/**
* 查询温度和湿度
* @param param 开始与结束时间
* @return 温度与湿度
*/
MbpsVo.SelTempAndHumidity selTeamAndHumidity(MbpsDto.SelTeamAndHumidity param);
}

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

@ -0,0 +1,20 @@
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.WarehouseVo;
import java.util.List;
/**
* @author
*/
public interface IWarehouseService {
/**
* 查询仓库及摄像头
* @param param 园区id 仓库id
* @return 仓库及摄像头
*/
List<WarehouseVo.AllWarehouse> selAllWarehouse(WarehouseDto.SelWarehouse param);
}

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

@ -3,6 +3,7 @@ package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.MbpsDto;
import com.ccsens.logistics.bean.vo.MbpsVo;
import com.ccsens.logistics.persist.dao.LogisticsCarRecordDao;
import com.ccsens.logistics.persist.dao.LogisticsEnvironmentRecordDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@ -21,6 +22,8 @@ public class MbpsService implements IMbpsService {
@Resource
private LogisticsCarRecordDao carRecordDao;
@Resource
private LogisticsEnvironmentRecordDao environmentRecordDao;
@Override
public MbpsVo.AllMbps selAllMbps(MbpsDto.SelAllMbpsSerch param) {
@ -58,4 +61,18 @@ public class MbpsService implements IMbpsService {
return selMbpsByTime;
}
@Override
public MbpsVo.SelTempAndHumidity selTeamAndHumidity(MbpsDto.SelTeamAndHumidity param) {
MbpsVo.SelTempAndHumidity tempAndHumidity = new MbpsVo.SelTempAndHumidity();
//查询温度
List<MbpsVo.Temps> tempsList = environmentRecordDao.selTempByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime());
tempAndHumidity.getTemps().addAll(tempsList);
//查询湿度
List<MbpsVo.Humiditys> humidityList = environmentRecordDao.selHumidityByTime(param.getWarehouseId(),param.getStartTime(),param.getEndTime());
tempAndHumidity.getHumiditys().addAll(humidityList);
return tempAndHumidity;
}
}

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

@ -0,0 +1,33 @@
package com.ccsens.logistics.service;
import com.ccsens.logistics.bean.dto.WarehouseDto;
import com.ccsens.logistics.bean.vo.WarehouseVo;
import com.ccsens.logistics.persist.dao.LogisticsWarehouseDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @author
*/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
public class WarehouseService implements IWarehouseService {
@Resource
private LogisticsWarehouseDao warehouseDao;
@Override
public List<WarehouseVo.AllWarehouse> selAllWarehouse(WarehouseDto.SelWarehouse param) {
//查询仓库及摄像头
List<WarehouseVo.AllWarehouse> warehouses = warehouseDao.selWarehouseAndCamera(param.getParkId(),param.getWarehouseId());
return warehouses;
}
}

4
logistics/src/main/resources/application.yml

@ -1,6 +1,6 @@
spring:
profiles:
active: dev
include: common, util-dev
active: test
include: common,util-test

2
logistics/src/main/resources/logback-spring.xml

@ -9,7 +9,7 @@
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="/home/cloud/mt/log/" />
<property name="log.path" value="/home/cloud/logistics/log/" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->

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

@ -32,7 +32,7 @@
<select id="selCarOfInByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$CarOfInByTime">
SELECT
FROM_UNIXTIME(cr.record_time, '%Y-%m-%d') AS time,
FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d') AS time,
COUNT(cr.id) AS carOfIn
FROM
t_logistics_car_record AS cr
@ -41,25 +41,25 @@
AND cr.record_time BETWEEN #{startTime} AND #{endTime}
<if test="queryType==0">
GROUP BY
DAY(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
DAY(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==1">
GROUP BY
WEEK(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
WEEK(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==2">
GROUP BY
MONTH(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
MONTH(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==3">
GROUP BY
YEAR(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
YEAR(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
</select>
<select id="selCarOfOutByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$CarOfOutByTime">
SELECT
FROM_UNIXTIME(cr.record_time, '%Y-%m-%d') AS time,
FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d') AS time,
COUNT(cr.id) AS carOfOut
FROM
t_logistics_car_record AS cr
@ -68,25 +68,25 @@
AND cr.record_time BETWEEN #{startTime} AND #{endTime}
<if test="queryType==0">
GROUP BY
DAY(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
DAY(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==1">
GROUP BY
WEEK(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
WEEK(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==2">
GROUP BY
MONTH(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
MONTH(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==3">
GROUP BY
YEAR(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
YEAR(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
</select>
<select id="selWeightOfInByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$WeightOfInByTime">
SELECT
FROM_UNIXTIME(cr.record_time, '%Y-%m-%d') AS time,
FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d') AS time,
SUM(cr.car_weight) AS weightOfIn
FROM
t_logistics_car_record AS cr
@ -95,25 +95,25 @@
AND cr.record_time BETWEEN #{startTime} AND #{endTime}
<if test="queryType==0">
GROUP BY
DAY(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
DAY(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==1">
GROUP BY
WEEK(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
WEEK(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==2">
GROUP BY
MONTH(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
MONTH(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==3">
GROUP BY
YEAR(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
YEAR(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
</select>
<select id="selWeightOfOutByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$WeightOfOutByTime">
SELECT
FROM_UNIXTIME(cr.record_time, '%Y-%m-%d') AS time,
FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d') AS time,
SUM(cr.car_weight) AS weightOfOut
FROM
t_logistics_car_record AS cr
@ -122,19 +122,19 @@
AND cr.record_time BETWEEN #{startTime} AND #{endTime}
<if test="queryType==0">
GROUP BY
DAY(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
DAY(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==1">
GROUP BY
WEEK(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
WEEK(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==2">
GROUP BY
MONTH(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
MONTH(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
<if test="queryType==3">
GROUP BY
YEAR(FROM_UNIXTIME(cr.record_time, '%Y-%m-%d'));
YEAR(FROM_UNIXTIME(cr.record_time/1000, '%Y-%m-%d'));
</if>
</select>

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

@ -2,4 +2,48 @@
<!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.LogisticsEnvironmentRecordDao">
<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
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>
<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
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>
</mapper>

35
logistics/src/main/resources/mapper_dao/LogisticsWarehouseDao.xml

@ -2,4 +2,39 @@
<!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.LogisticsWarehouseDao">
<resultMap id="warehouseAndCamera" type="com.ccsens.logistics.bean.vo.WarehouseVo$AllWarehouse">
<id column="warehouseId" property="warehouseId"/>
<result column="warehouseName" property="warehouseName"/>
<collection property="cameras" ofType="com.ccsens.logistics.bean.vo.EquipmentVo$AllCamera">
<id column="equipmentId" property="equipmentId"/>
<result column="equipmentName" property="equipmentName"/>
<result column="equipmentNumber" property="equipmentNumber"/>
<result column="equipmentType" property="equipmentType"/>
<result column="equipmentLocation" property="equipmentLocation"/>
</collection>
</resultMap>
<select id="selWarehouseAndCamera" resultMap="warehouseAndCamera">
SELECT
w.id AS warehouseId,
w.`name` AS warehouseName,
e.id AS equipmentId,
e.`name` AS equipmentName,
e.equipment_number AS equipmentNumber,
e.equipment_location AS equipmentLocation,
e.equipment_type AS equipmentType
FROM
t_logistics_warehouse AS w
LEFT JOIN t_logistics_equipment AS e ON w.id = e.warehouse_id AND e.equipment_type = 0
AND e.rec_status = 0
WHERE
w.rec_status = 0
<if test="parkId!=null and parkId!=''">
AND w.park_id = #{parkId}
</if>
<if test="warehouseId!=null and warehouseId!=''">
AND w.id = #{warehouseId}
</if>
</select>
</mapper>

42
logistics/src/main/resources/mapper_raw/LogisticsEquipmentMapper.xml

@ -10,6 +10,8 @@
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
<result column="rec_status" jdbcType="TINYINT" property="recStatus" />
<result column="equipment_location" jdbcType="VARCHAR" property="equipmentLocation" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -71,7 +73,7 @@
</sql>
<sql id="Base_Column_List">
id, name, equipment_number, equipment_type, warehouse_id, created_at, updated_at,
rec_status
rec_status, equipment_location, remark
</sql>
<select id="selectByExample" parameterType="com.ccsens.logistics.bean.po.LogisticsEquipmentExample" resultMap="BaseResultMap">
select
@ -106,10 +108,12 @@
<insert id="insert" parameterType="com.ccsens.logistics.bean.po.LogisticsEquipment">
insert into t_logistics_equipment (id, name, equipment_number,
equipment_type, warehouse_id, created_at,
updated_at, rec_status)
updated_at, rec_status, equipment_location,
remark)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{equipmentNumber,jdbcType=INTEGER},
#{equipmentType,jdbcType=TINYINT}, #{warehouseId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP},
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT})
#{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, #{equipmentLocation,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.logistics.bean.po.LogisticsEquipment">
insert into t_logistics_equipment
@ -138,6 +142,12 @@
<if test="recStatus != null">
rec_status,
</if>
<if test="equipmentLocation != null">
equipment_location,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -164,6 +174,12 @@
<if test="recStatus != null">
#{recStatus,jdbcType=TINYINT},
</if>
<if test="equipmentLocation != null">
#{equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.ccsens.logistics.bean.po.LogisticsEquipmentExample" resultType="java.lang.Long">
@ -199,6 +215,12 @@
<if test="record.recStatus != null">
rec_status = #{record.recStatus,jdbcType=TINYINT},
</if>
<if test="record.equipmentLocation != null">
equipment_location = #{record.equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -213,7 +235,9 @@
warehouse_id = #{record.warehouseId,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
rec_status = #{record.recStatus,jdbcType=TINYINT}
rec_status = #{record.recStatus,jdbcType=TINYINT},
equipment_location = #{record.equipmentLocation,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -242,6 +266,12 @@
<if test="recStatus != null">
rec_status = #{recStatus,jdbcType=TINYINT},
</if>
<if test="equipmentLocation != null">
equipment_location = #{equipmentLocation,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@ -253,7 +283,9 @@
warehouse_id = #{warehouseId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
rec_status = #{recStatus,jdbcType=TINYINT}
rec_status = #{recStatus,jdbcType=TINYINT},
equipment_location = #{equipmentLocation,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
Loading…
Cancel
Save