Browse Source

修改问题

logistics
ma 4 years ago
parent
commit
ac8fc1c5f4
  1. 4
      logistics/src/main/java/com/ccsens/logistics/Netty/NettyClient.java
  2. 8
      logistics/src/main/java/com/ccsens/logistics/bean/dto/MbpsDto.java
  3. 16
      logistics/src/main/java/com/ccsens/logistics/persist/dao/LogisticsCarRecordDao.java
  4. 16
      logistics/src/main/java/com/ccsens/logistics/service/MbpsService.java
  5. 4
      logistics/src/main/resources/application.yml
  6. 8
      logistics/src/main/resources/mapper_dao/LogisticsCarRecordDao.xml
  7. 2
      logistics/src/main/resources/mapper_dao/LogisticsEnvironmentRecordDao.xml

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

@ -12,6 +12,7 @@ import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.Delimiters;
import io.netty.handler.codec.string.StringEncoder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@ -19,7 +20,7 @@ import javax.annotation.Resource;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Slf4j
@Component
public class NettyClient {
@Resource
@ -63,6 +64,7 @@ public class NettyClient {
@Override
public void run() {
// thermalImageryService.getImagery();
log.info("请求热成像图片");
future.channel().writeAndFlush("{\"service_id\":\"123\",\"type\":\"READSN4\",\"thing_id\":\"050005A2\",\"data\":{\"GetType\":\"Auto\",\"Highest\":70,\"Lowest\":30}}"+"\r\n");
future.channel().writeAndFlush("{\"service_id\":\"123\",\"type\":\"READSN4\",\"thing_id\":\"050005BD\",\"data\":{\"GetType\":\"Auto\",\"Highest\":70,\"Lowest\":30}}"+"\r\n");
}

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

@ -27,10 +27,6 @@ public class MbpsDto {
private Byte queryType;
@ApiModelProperty("查询的天数")
private Integer queryOfDay = 10;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
}
@Data
@ -42,10 +38,6 @@ public class MbpsDto {
@NotNull(message = "请选择要查询的仓库")
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("查询的几个小时的数据")
private Integer queryOfDay = 5;
}

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

@ -46,44 +46,36 @@ public interface LogisticsCarRecordDao extends LogisticsCarRecordMapper {
/**
* 根据时间查询车辆吞进量
* @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);
List<MbpsVo.CarOfInByTime> selCarOfInByTime(@Param("queryType") Byte queryType,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
/**
* 根据时间查询车辆吐出量
*@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);
List<MbpsVo.CarOfOutByTime> selCarOfOutByTime(@Param("queryType") Byte queryType,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
/**
* 根据时间查询入货量
* @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);
List<MbpsVo.WeightOfInByTime> selWeightOfInByTime(@Param("queryType") Byte queryType,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
/**
* 根据时间查询出货量
* @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);
List<MbpsVo.WeightOfOutByTime> selWeightOfOutByTime(@Param("queryType") Byte queryType,@Param("countArr") String[] countArr,@Param("nowDate") String nowDate);
}

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

@ -74,7 +74,13 @@ public class MbpsService implements IMbpsService {
@Override
public MbpsVo.SelMbpsByTime selMbpsByTime(MbpsDto.SelMbpsByTime param) {
String[] countArr = new String[param.getQueryOfDay()];
String[] countArr;
if (ObjectUtil.isNotNull(param.getQueryOfDay())){
countArr = new String[param.getQueryOfDay()];
}else{
countArr = new String[10];
}
//查找当前时间
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
@ -82,13 +88,13 @@ public class MbpsService implements IMbpsService {
MbpsVo.SelMbpsByTime selMbpsByTime = new MbpsVo.SelMbpsByTime();
//查询吞进量
List<MbpsVo.CarOfInByTime> carOfInByTimeList = carRecordDao.selCarOfInByTime(param.getQueryType(),param.getStartTime(),param.getEndTime(),countArr,nowDate);
List<MbpsVo.CarOfInByTime> carOfInByTimeList = carRecordDao.selCarOfInByTime(param.getQueryType(),countArr,nowDate);
selMbpsByTime.getCarOfInsByTime().addAll(carOfInByTimeList);
//查询吐出量
List<MbpsVo.CarOfOutByTime> carOfOutByTimeList = carRecordDao.selCarOfOutByTime(param.getQueryType(),param.getStartTime(),param.getEndTime(),countArr,nowDate);
List<MbpsVo.CarOfOutByTime> carOfOutByTimeList = carRecordDao.selCarOfOutByTime(param.getQueryType(),countArr,nowDate);
selMbpsByTime.getCarOfOutsByTime().addAll(carOfOutByTimeList);
//查询入库吨数
List<MbpsVo.WeightOfInByTime> weightOfInByTimeList = carRecordDao.selWeightOfInByTime(param.getQueryType(),param.getStartTime(),param.getEndTime(),countArr,nowDate);
List<MbpsVo.WeightOfInByTime> weightOfInByTimeList = carRecordDao.selWeightOfInByTime(param.getQueryType(),countArr,nowDate);
for (MbpsVo.WeightOfInByTime weightOfInByTime : weightOfInByTimeList) {
if (ObjectUtil.isNull(weightOfInByTime.getWeightOfIn())){
weightOfInByTime.setWeightOfIn(0L);
@ -96,7 +102,7 @@ public class MbpsService implements IMbpsService {
}
selMbpsByTime.getWeightOfInsByTime().addAll(weightOfInByTimeList);
//查询出货吨数
List<MbpsVo.WeightOfOutByTime> weightOfOutByTimeList =carRecordDao.selWeightOfOutByTime(param.getQueryType(),param.getStartTime(),param.getEndTime(),countArr,nowDate);
List<MbpsVo.WeightOfOutByTime> weightOfOutByTimeList =carRecordDao.selWeightOfOutByTime(param.getQueryType(),countArr,nowDate);
for (MbpsVo.WeightOfOutByTime weightOfOutByTime : weightOfOutByTimeList) {
if (ObjectUtil.isNull(weightOfOutByTime.getWeightOfOut())){
weightOfOutByTime.setWeightOfOut(0L);

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

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

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 or warehouseId!=''">
<if test="warehouseId!=null">
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 or warehouseId!=''">
<if test="warehouseId!=null">
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 or warehouseId!=''">
<if test="warehouseId!=null">
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 or warehouseId!=''">
<if test="warehouseId!=null">
AND cr.warehouse_id = #{warehouseId}
</if>
</select>

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

@ -4,7 +4,7 @@
<select id="selTempByTime" resultType="com.ccsens.logistics.bean.vo.MbpsVo$Temps">
SELECT
s.date AS time,
s.date AS `time`,
MAX(newEr.numValue) AS temp
FROM
(select date_add(#{nowDate},interval @i:=@i-1 HOUR) as date

Loading…
Cancel
Save