Commit d2fe22d5 authored by zhangsen's avatar zhangsen

pom修改

parent 45877eeb
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.AnalysisFanStationImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
@RestController
@Api(tags = "分析场站-相关API")
@RequestMapping(value = "/analysisStation")
public class AnalysisFanStationController {
@Autowired
private StationBasicMapper stationBasicMapper;
@Autowired
AnalysisFanStationImpl analysisFanStationImpl;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分析-风站 - 场站风速")
@GetMapping("/getStationWindSpeedStatistics")
public ResponseModel<Map<String, Object>> getStationWindSpeedStatistics(@RequestParam(value = "stationId", required = false)String stationId, @RequestParam(value = "type", required = false)String type) {
String gatewayId = "";
if (null != stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
gatewayId = stationBasic.getBoosterGatewayId();
if (null == type){
gatewayId = stationBasic.getFanGatewayId();
}
}
Map<String, Object> detailsWindSpeed = analysisFanStationImpl.getStationWindSpeedStatistics(gatewayId);
return ResponseHelper.buildResponse(detailsWindSpeed);
}
}
......@@ -67,17 +67,12 @@ public class PersonQrCodeController extends BaseController {
resultList = sjglZsjZsbtzMapper.getJobYardStatistics(parentCode);
}
Map<Object, Object> collect = resultList.stream().collect(Collectors.toMap(t -> t.get("qrCodeColor"), t -> t.get("value")));
resultList.forEach(item -> {
String name = QrcodeColorEnum.getName(String.valueOf(item.get("qrCodeColor")));
item.put("name", name);
item.put("value", Integer.parseInt(item.get("value").toString()));
});
List<Map<String, Object>> maps = new ArrayList<>();
Arrays.stream(QrcodeColorEnum.values()).forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("qrCodeColor", item.getCode());
map.put("name", item.getName());
map.put("value", collect.getOrDefault("qrCodeColor", 0));
map.put("value", collect.getOrDefault(item.getCode(), 0));
maps.add(map);
});
return ResponseHelper.buildResponse(maps);
......
......@@ -19,4 +19,7 @@ public interface TemporaryDataMapper extends BaseMapper<TemporaryData> {
List<ESWindSpeed> getAllData();
List<Map<String, String>> getStationWindSpeedStatistics (@RequestParam(value ="gatewayId") String gatewayId,
@RequestParam(value ="equipmentIndexName") String equipmentIndexName);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.TemporaryDataMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@EnableScheduling
@Slf4j
public class AnalysisFanStationImpl {
@Autowired
private TemporaryDataMapper temporaryDataMapper;
public Map<String,Object> getStationWindSpeedStatistics(String gatewayId){
List<Map<String, String>> list = temporaryDataMapper.getStationWindSpeedStatistics(gatewayId, "瞬时风速");
Map<String,Object> map = new HashMap<>();
List<String> valueList = new ArrayList<>();
Set<String> time = new TreeSet<>();
for (Map<String, String> stringStringMap : list) {
valueList.add(stringStringMap.get("value"));
time.add(stringStringMap.get("createdTime"));
}
map.put("seriesData", valueList);
map.put("axisData",time);
return map;
}
}
......@@ -58,4 +58,25 @@
`temporary_data`
</select>
<select id="getStationWindSpeedStatistics" resultType="map">
SELECT avg(value) as value ,
created_time as createdTime ,
equipmentIndexName
FROM
`temporary_data`
<where>
<if test="gatewayId != null and gatewayId != ''">
and gatewayId = #{gatewayId}
</if>
<if test="gatewayId == null or gatewayId == ''">
and equipmentNumber is not null and equipmentIndexName is not null
</if>
<if test="equipmentIndexName != null and equipmentIndexName != ''">
and equipmentIndexName = #{equipmentIndexName}
</if>
</where>
GROUP BY batch_no ,equipmentIndexName;
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment