parent
4729c661a5
commit
884237a679
|
@ -147,6 +147,43 @@ public class BuildingController {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近一天工地噪声和扬尘的信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectDayAll")
|
||||||
|
@ApiOperation("查询近一天工地噪声和扬尘的信息")
|
||||||
|
public Result selectDayAll(){
|
||||||
|
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectDayAll();
|
||||||
|
Result success = Result.success(recordsDtos);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近一周工地噪声和扬尘的信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectWeekAll")
|
||||||
|
@ApiOperation("查询近一周工地噪声和扬尘的信息")
|
||||||
|
public Result selectWeekAll(){
|
||||||
|
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectWeekAll();
|
||||||
|
Result success = Result.success(recordsDtos);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询近一月工地噪声和扬尘的信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("selectMonthAll")
|
||||||
|
@ApiOperation("查询近一月工地噪声和扬尘的信息")
|
||||||
|
public Result selectMonthAll(){
|
||||||
|
List<BuildingRecordsDto> recordsDtos = buildingRecordsMapper.selectMonthAll();
|
||||||
|
Result success = Result.success(recordsDtos);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据工地名称搜索工地
|
* 根据工地名称搜索工地
|
||||||
* @param projectName
|
* @param projectName
|
||||||
|
|
|
@ -14,4 +14,5 @@ public class BuildingRecordsDto {
|
||||||
private String ssdq;//所属区域
|
private String ssdq;//所属区域
|
||||||
private double pm10;//扬尘
|
private double pm10;//扬尘
|
||||||
private double noice;//噪声
|
private double noice;//噪声
|
||||||
|
private String yjsg;//夜间施工
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName("t_building_site")
|
@TableName("t_building_new_site")
|
||||||
public class BuildingSite {
|
public class BuildingSite {
|
||||||
@TableId
|
@TableId
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
@ -25,4 +25,5 @@ public class BuildingSite {
|
||||||
private double jd;
|
private double jd;
|
||||||
private double wd;
|
private double wd;
|
||||||
private String ssdq;
|
private String ssdq;
|
||||||
|
private String yjsg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,38 +23,50 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
|
||||||
|
|
||||||
void batchUpdate(@Param("list") List<Map> list);
|
void batchUpdate(@Param("list") List<Map> list);
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc")
|
@Select("SELECT * FROM t_building_new_site bns JOIN t_building_records br ON bns.gdmc = br.project_name")
|
||||||
List<BuildingRecordsDto> selectAllBuilding();
|
List<BuildingRecordsDto> selectAllBuilding();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc " +
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc " +
|
||||||
" where to_days(br.push_time) = to_days(now()) order by br.pm10 desc")
|
" where to_days(br.push_time) = to_days(now()) order by br.pm10 desc")
|
||||||
List<BuildingRecordsDto> selectDayPm10();
|
List<BuildingRecordsDto> selectDayPm10();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(br.push_time) order by br.pm10 desc")
|
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(br.push_time) order by br.pm10 desc")
|
||||||
List<BuildingRecordsDto> selectWeekPm10();
|
List<BuildingRecordsDto> selectWeekPm10();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(br.push_time) order by br.pm10 desc")
|
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(br.push_time) order by br.pm10 desc")
|
||||||
List<BuildingRecordsDto> selectMonthPm10();
|
List<BuildingRecordsDto> selectMonthPm10();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc " +
|
@Select("select * from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc " +
|
||||||
" where to_days(br.push_time) = to_days(now()) order by br.noice desc")
|
" where to_days(br.push_time) = to_days(now()) order by br.noice desc")
|
||||||
List<BuildingRecordsDto> selectDayNoice();
|
List<BuildingRecordsDto> selectDayNoice();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(br.push_time) order by br.noice desc")
|
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(br.push_time) order by br.noice desc")
|
||||||
List<BuildingRecordsDto> selectWeekNoice();
|
List<BuildingRecordsDto> selectWeekNoice();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(br.push_time) order by br.noice desc")
|
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(br.push_time) order by br.noice desc")
|
||||||
List<BuildingRecordsDto> selectMonthNoice();
|
List<BuildingRecordsDto> selectMonthNoice();
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select * from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc " +
|
||||||
|
" where to_days(br.push_time) = to_days(now())")
|
||||||
|
List<BuildingRecordsDto> selectDayAll();
|
||||||
|
|
||||||
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
|
" where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(br.push_time)")
|
||||||
|
List<BuildingRecordsDto> selectWeekAll();
|
||||||
|
|
||||||
|
@Select("select * from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
|
" where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(br.push_time)")
|
||||||
|
List<BuildingRecordsDto> selectMonthAll();
|
||||||
|
|
||||||
|
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where br.project_name like concat('%',#{projectName},'%')")
|
" where br.project_name like concat('%',#{projectName},'%')")
|
||||||
List<BuildingRecordsDto> selectByProjectName(String projectName);
|
List<BuildingRecordsDto> selectByProjectName(String projectName);
|
||||||
|
|
||||||
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_site bs on br.project_name = bs.gdmc" +
|
@Select("select br.*,bs.sgwz,bs.jd,bs.wd,bs.ssdq from t_building_records br JOIN t_building_new_site bs on br.project_name = bs.gdmc" +
|
||||||
" where (bs.jd between #{jd} and #{jd1}) and (bs.wd between #{wd} and #{wd1} )")
|
" where (bs.jd between #{jd} and #{jd1}) and (bs.wd between #{wd} and #{wd1} )")
|
||||||
List<BuildingRecordsDto> selectByJdWd(@Param("jd") Double jd,
|
List<BuildingRecordsDto> selectByJdWd(@Param("jd") Double jd,
|
||||||
@Param("jd1") Double jd1,
|
@Param("jd1") Double jd1,
|
||||||
|
|
|
@ -15,6 +15,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
|
public interface BuildingSiteMapper extends BaseMapper<BuildingSite> {
|
||||||
|
|
||||||
@Select("select * from t_building_site")
|
@Select("select * from t_building_new_site")
|
||||||
List<BuildingSite> selectBuildSite();
|
List<BuildingSite> selectBuildSite();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ public class PassengerFlowService {
|
||||||
@Value("7eb78b134e0310904d46039ccea20c32")
|
@Value("7eb78b134e0310904d46039ccea20c32")
|
||||||
private String appSecret;
|
private String appSecret;
|
||||||
|
|
||||||
|
@Value("${scheduled.enable:ture}")
|
||||||
|
private Boolean enable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 最新的实时客流
|
* 最新的实时客流
|
||||||
|
@ -131,53 +134,54 @@ public class PassengerFlowService {
|
||||||
//提供的接口能查到当前时间2个小时之前的数据,每隔15分钟一次,我们只取整点从早8点到晚8点的整点数据
|
//提供的接口能查到当前时间2个小时之前的数据,每隔15分钟一次,我们只取整点从早8点到晚8点的整点数据
|
||||||
//10:31 到晚上10:31,每小时的31分执行一次
|
//10:31 到晚上10:31,每小时的31分执行一次
|
||||||
public void passengerFlowSchedule(){
|
public void passengerFlowSchedule(){
|
||||||
//JSONObject map = new JSONObject();
|
if (enable){
|
||||||
Map<String,Object> map = new HashMap<>();
|
//JSONObject map = new JSONObject();
|
||||||
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
Map<String,Object> map = new HashMap<>();
|
||||||
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
||||||
|
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||||
|
|
||||||
LocalDateTime dateNow = LocalDateTime.now();
|
LocalDateTime dateNow = LocalDateTime.now();
|
||||||
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
||||||
String[] tt = this.minusMinutesStr(dateNow,120);
|
String[] tt = this.minusMinutesStr(dateNow,120);
|
||||||
|
|
||||||
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
||||||
map.put("APIKEY",APIKEY);
|
map.put("APIKEY",APIKEY);
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("appId",appId);
|
jsonObject.put("appId",appId);
|
||||||
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
||||||
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
||||||
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
||||||
jsonObject.put("mac",md5Str);
|
jsonObject.put("mac",md5Str);
|
||||||
jsonObject.put("timeStamp",timeStamp);
|
jsonObject.put("timeStamp",timeStamp);
|
||||||
jsonObject.put("hourId",tt[1]);
|
jsonObject.put("hourId",tt[1]);
|
||||||
jsonObject.put("timeId",tt[0]);
|
jsonObject.put("timeId",tt[0]);
|
||||||
//jsonObject.put("apiType","***");
|
//jsonObject.put("apiType","***");
|
||||||
JSONObject para = new JSONObject();
|
JSONObject para = new JSONObject();
|
||||||
para.put("data",JSONObject.toJSONString(jsonObject));
|
para.put("data",JSONObject.toJSONString(jsonObject));
|
||||||
map.put("ParamJson",para);
|
map.put("ParamJson",para);
|
||||||
|
|
||||||
System.out.println("multimap->"+map.toString());
|
System.out.println("multimap->"+map.toString());
|
||||||
ResponseEntity<String> responseEntity;
|
ResponseEntity<String> responseEntity;
|
||||||
List<Map> list = new ArrayList<>();
|
List<Map> list = new ArrayList<>();
|
||||||
try{
|
try{
|
||||||
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
||||||
//System.out.println(responseEntity.getStatusCodeValue());
|
//System.out.println(responseEntity.getStatusCodeValue());
|
||||||
if(responseEntity.getStatusCodeValue() == 200){
|
if(responseEntity.getStatusCodeValue() == 200){
|
||||||
String result = responseEntity.getBody();
|
String result = responseEntity.getBody();
|
||||||
//System.out.println("passengerFlow ->"+result);
|
//System.out.println("passengerFlow ->"+result);
|
||||||
JSONObject jsonResult = JSONObject.parseObject(result);
|
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||||
System.out.println(jsonResult.keySet().toString());
|
System.out.println(jsonResult.keySet().toString());
|
||||||
if(jsonResult.getIntValue("code") == 0){
|
if(jsonResult.getIntValue("code") == 0){
|
||||||
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
||||||
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||||
List<List<Map>> lists = Lists.partition(list,200);
|
List<List<Map>> lists = Lists.partition(list,200);
|
||||||
lists.forEach(ll ->passengerFlowMapper.batchSave(ll));
|
lists.forEach(ll ->passengerFlowMapper.batchSave(ll));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.error("[passengerFlowSchedule] Exception:"+e.getMessage());
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
|
||||||
log.error("[passengerFlowSchedule] Exception:"+e.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//保存实时客流
|
//保存实时客流
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
|
@ -24,3 +24,6 @@ mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
|
||||||
#??????swagger,true???false??
|
#??????swagger,true???false??
|
||||||
swagger.enable=true
|
swagger.enable=true
|
||||||
|
|
||||||
|
scheduled.enable=false
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue