|
@@ -15,9 +15,11 @@ import io.swagger.annotations.ApiOperation;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -110,6 +112,26 @@ public class DeviceEventMsgServiceImpl extends ServiceImpl<DeviceEventMsgMapper,
|
|
return R.ok(vos);
|
|
return R.ok(vos);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("count")
|
|
|
|
+ @ApiOperation("统计查询")
|
|
|
|
+ public R<List<DeviceEventMsgDto.CountVo>> count(@RequestBody @Validated DeviceEventMsgDto.Count count) {
|
|
|
|
+ List<String> codes = count.getCodes();
|
|
|
|
+ List<DeviceEventMsgDto.CountVo> countVos = new ArrayList<>(codes.size());
|
|
|
|
+ codes.forEach(code -> {
|
|
|
|
+ LambdaQueryWrapper<DeviceEventMsg> queryWrapper = new LambdaQueryWrapper<DeviceEventMsg>()
|
|
|
|
+ .eq(DeviceEventMsg::getCode, code)
|
|
|
|
+ .ge(Emptys.check(count.getCreateTimeBegin()), DeviceEventMsg::getCreateTime, count.getCreateTimeBegin())
|
|
|
|
+ .le(Emptys.check(count.getCreateTimeEnd()), DeviceEventMsg::getCreateTime, count.getCreateTimeEnd());
|
|
|
|
+ long countNum = count(queryWrapper);
|
|
|
|
+ DeviceEventMsgDto.CountVo countVo = new DeviceEventMsgDto.CountVo()
|
|
|
|
+ .setCode(code)
|
|
|
|
+ .setCount(countNum);
|
|
|
|
+ countVos.add(countVo);
|
|
|
|
+ });
|
|
|
|
+ return R.ok(countVos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 递归获取子编码
|
|
* 递归获取子编码
|
|
*
|
|
*
|