parent
43c840d9e9
commit
e8f116054e
6 changed files with 94 additions and 3 deletions
@ -1,4 +1,4 @@ |
||||
package org.jeecg.modules.largeScreen; |
||||
package org.jeecg.modules.largeScreen.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
@ -0,0 +1,36 @@ |
||||
package org.jeecg.modules.largeScreen.controller; |
||||
|
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.modules.largeScreen.service.ProductionLargeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
import java.util.Map; |
||||
|
||||
@Api(tags = "生产设备大屏数据") |
||||
@RequestMapping("/productionLargeScreen") |
||||
@RestController |
||||
@Slf4j |
||||
public class ProductionLargeScreenController { |
||||
|
||||
@Autowired |
||||
private ProductionLargeService productionLargeService; |
||||
|
||||
/** |
||||
* 查询订单的状态 |
||||
* |
||||
* @return |
||||
*/ |
||||
@ApiOperation(value = "获取生产设备大屏数据", notes = "获取生产设备大屏数据") |
||||
@GetMapping("/getData") |
||||
public Result<?> getData() { |
||||
Map<String, Object> data = productionLargeService.getData(); |
||||
return Result.OK(data); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,8 @@ |
||||
package org.jeecg.modules.largeScreen.service; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public interface ProductionLargeService { |
||||
|
||||
Map<String, Object> getData(); |
||||
} |
@ -0,0 +1,46 @@ |
||||
package org.jeecg.modules.largeScreen.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import org.jeecg.modules.hanger.entity.HangRecord; |
||||
import org.jeecg.modules.hanger.service.IHangRecordService; |
||||
import org.jeecg.modules.largeScreen.service.ProductionLargeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.ObjectUtils; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
@Service |
||||
public class ProductionLargeServiceImpl implements ProductionLargeService { |
||||
|
||||
@Autowired |
||||
private IHangRecordService iHangRecordService; |
||||
|
||||
@Override |
||||
public Map<String, Object> getData() { |
||||
|
||||
Map<String, Object> resultMap = new HashMap<>(); |
||||
|
||||
//1,吊挂 分组统计,获取最新时间5条吊挂运行记录
|
||||
List<HangRecord> recordList = iHangRecordService.list(new LambdaQueryWrapper<HangRecord>().groupBy(HangRecord::getHangCode)); |
||||
Map<String, Object> diaoguaData = new HashMap<>(); |
||||
if (!ObjectUtils.isEmpty(recordList)) { |
||||
recordList.stream().forEach(e -> { |
||||
List<HangRecord> records = iHangRecordService.list(new LambdaQueryWrapper<HangRecord>() |
||||
.eq(HangRecord::getHangCode, e.getHangCode()) |
||||
.orderByDesc(HangRecord::getCreateTime) |
||||
.last("limit 5") |
||||
); |
||||
diaoguaData.put(e.getHangCode(), records); |
||||
}); |
||||
} |
||||
resultMap.put("diaogua_Data", diaoguaData); |
||||
|
||||
|
||||
//2,TODO
|
||||
|
||||
return resultMap; |
||||
} |
||||
} |
Loading…
Reference in new issue