1、代码修改
This commit is contained in:
parent
661b02bdad
commit
9ebcaf4fe3
|
@ -0,0 +1,44 @@
|
|||
package com.hisense.monitormanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.hisense.monitormanage.entity.Result;
|
||||
import com.hisense.monitormanage.service.SanitationService;
|
||||
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.RestController;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName SanitationController.java
|
||||
* @Description 环卫
|
||||
* @createTime 2022年05月19日 11:22:00
|
||||
*/
|
||||
@Api(tags = "环卫")
|
||||
@RequestMapping("api/project/santation")
|
||||
@RestController
|
||||
public class SanitationController {
|
||||
@Autowired
|
||||
private SanitationService sanitationService;
|
||||
|
||||
@GetMapping("/saveSantation")
|
||||
@ApiOperation("测试获取环卫车辆基础数据并保存到表中")
|
||||
public Result saveSantation(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@GetMapping("/saveSanitationRoad")
|
||||
@ApiOperation("测试获取环卫道路数据并保存到表中")
|
||||
public Result saveSanitationRoad(){
|
||||
return sanitationService.saveSanitationRoad();
|
||||
}
|
||||
|
||||
@GetMapping("saveSanitationTask")
|
||||
@ApiOperation("测试获取环卫车作业数据并保存到表中")
|
||||
public Result saveSanitationTask(){
|
||||
return sanitationService.saveSanitationTask();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName Sanitation.java
|
||||
* @Description 环卫车基础信息类
|
||||
* @createTime 2022年05月19日 11:24:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_sanitation_info")
|
||||
@ApiModel("环卫车辆基础数据")
|
||||
public class Sanitation {
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Integer id;
|
||||
@ApiModelProperty("车牌号")
|
||||
private String cph;
|
||||
@ApiModelProperty("驾驶员")
|
||||
private String jsy;
|
||||
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty("购买日期")
|
||||
private LocalDateTime gmri;
|
||||
@ApiModelProperty("车辆类型")
|
||||
private String cllx;
|
||||
@ApiModelProperty("所属区域编号")
|
||||
private String ssqybh;
|
||||
@ApiModelProperty("所属环卫公司编号")
|
||||
private String sshwgsbh;
|
||||
@ApiModelProperty("备注")
|
||||
private String bz;
|
||||
@ApiModelProperty("是否考核")
|
||||
private Integer sfkh;
|
||||
@ApiModelProperty("车辆编号")
|
||||
private String clbh;
|
||||
@ApiModelProperty("吨数")
|
||||
private String ds;
|
||||
@ApiModelProperty("是否加装GPS并连入市监管平台")
|
||||
private String sfjzgpsblrsjgpt;
|
||||
@ApiModelProperty("简介")
|
||||
private String jj;
|
||||
@ApiModelProperty("车辆型号")
|
||||
private String clxh;
|
||||
@ApiModelProperty("车辆大类")
|
||||
private String cldl;
|
||||
@ApiModelProperty("是否机扫")
|
||||
private Integer sfjs;
|
||||
@ApiModelProperty("是否洒水")
|
||||
private Integer sfss;
|
||||
@ApiModelProperty("是否冲洗")
|
||||
private Integer sfcx;
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName SanitationRoad.java
|
||||
* @Description 环卫道路
|
||||
* @createTime 2022年05月20日 09:57:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_sanitation_road")
|
||||
@ApiModel("环卫道路数据")
|
||||
public class SanitationRoad {
|
||||
@TableField
|
||||
private Integer id;
|
||||
private String bh;
|
||||
private String dlmc;
|
||||
private String qdlkdlmc;
|
||||
private String zdlkdlmc;
|
||||
private String zcgdlxzc;
|
||||
private String bjdj;
|
||||
private double dlzd;
|
||||
private double dlkd;
|
||||
private double dlzmj;
|
||||
private double cxdmj;
|
||||
private double rxdmj;
|
||||
private double jsmj;
|
||||
private double ssmj;
|
||||
private double gycxmj;
|
||||
private Integer bjysl;
|
||||
private Integer gpxsl;
|
||||
private String ssqybh;
|
||||
private String ssjdbsc;
|
||||
private String sshwgsbh;
|
||||
private String zbjh;
|
||||
private String sfqy;
|
||||
private String bz;
|
||||
private String bh1;
|
||||
private Integer dtdlhzkd;
|
||||
private String zcgd;
|
||||
private String jsqz;
|
||||
private String cxqz;
|
||||
private String jj;
|
||||
private String tplj;
|
||||
private String zbdfxbz0zx1fx;
|
||||
private String fxzbxxid;
|
||||
private String ys;
|
||||
private double btmx;
|
||||
private Integer jsts;
|
||||
private String jspc;
|
||||
private Integer sfjs0bjs1js;
|
||||
private Integer sfss0bss1ss;
|
||||
private Integer sfcx0bcx1cx;
|
||||
private String sspc;
|
||||
private String cxpc;
|
||||
private Integer ssts;
|
||||
private Integer cxts;
|
||||
private String sfkh;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName SanitationTask.java
|
||||
* @Description 环卫车作业数据
|
||||
* @createTime 2022年05月20日 13:33:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_sanitation_task")
|
||||
@ApiModel("环卫车辆作业数据")
|
||||
public class SanitationTask {
|
||||
@TableId
|
||||
@ApiModelProperty("id")
|
||||
private Integer id;
|
||||
@ApiModelProperty("道路名称")
|
||||
private String dlmc;
|
||||
@ApiModelProperty("开始道路")
|
||||
private String ksdl;
|
||||
@ApiModelProperty("终止道路")
|
||||
private String zzdl;
|
||||
@ApiModelProperty("所属区市")
|
||||
private String ssqs;
|
||||
@ApiModelProperty("车牌号")
|
||||
private String cph;
|
||||
@ApiModelProperty("作业完成率")
|
||||
private double zywcl;
|
||||
@JsonFormat(pattern="yyyy-MM-dd mm:HH:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty("作业日期")
|
||||
private LocalDateTime zyrq;
|
||||
@ApiModelProperty("作业类型")
|
||||
private String zylx;
|
||||
@ApiModelProperty("作业时间")
|
||||
private String zysj;
|
||||
@ApiModelProperty("作业趟数")
|
||||
private double zyts;
|
||||
@ApiModelProperty("作业频次")
|
||||
private double zypc;
|
||||
@ApiModelProperty("作业长度")
|
||||
private double zyzd;
|
||||
@ApiModelProperty("作业宽度")
|
||||
private double zykd;
|
||||
@ApiModelProperty("作业面积")
|
||||
private double zymj;
|
||||
@ApiModelProperty("未作业点数")
|
||||
private double wzyds;
|
||||
@ApiModelProperty("作业超速点数")
|
||||
private double zycsds;
|
||||
@ApiModelProperty("作业GPS点数")
|
||||
private double zygpsds;
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.Sanitation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName SanitationMapper.java
|
||||
* @Description TODO
|
||||
* @createTime 2022年05月19日 11:24:00
|
||||
*/
|
||||
public interface SanitationMapper extends BaseMapper<Sanitation> {
|
||||
void batchSave(@Param("list") List<Map> list);
|
||||
void batchSaveSanitationRoad(@Param("list") List<Map> list);
|
||||
void batchSaveSanitationTask(@Param("list") List<Map> list);
|
||||
}
|
|
@ -684,24 +684,26 @@ public class MonitorService {
|
|||
//环卫车辆数据1,基础
|
||||
public List<Map> resCatalogApplyHJWSBase () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1?search=[{json}]";
|
||||
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1?search=[{json}]";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000365_1";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","updatetime");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","SSQY");
|
||||
// search.put("val","胶州市");
|
||||
// search.put("opt","LIKE");
|
||||
// search.put("key","updatetime");
|
||||
// search.put("val",this.dateStr());
|
||||
search.put("opt","EQ");
|
||||
search.put("key","SSQY");
|
||||
search.put("val","胶州市");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
//responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
|
@ -715,17 +717,18 @@ public class MonitorService {
|
|||
public List<Map> resCatalogApplyHJWSZY () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1?search=[{json}]";
|
||||
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000363_1?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","ZYRQ");
|
||||
search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","CPH");
|
||||
// search.put("val","鲁BW7681");
|
||||
// search.put("opt","LIKE");
|
||||
// search.put("key","ZYRQ");
|
||||
// search.put("val",this.dateStr());
|
||||
search.put("opt","EQ");
|
||||
search.put("key","SSQS");
|
||||
search.put("val","市北区");
|
||||
map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
|
@ -744,30 +747,32 @@ public class MonitorService {
|
|||
//环卫道路明细数据
|
||||
public List<Map> resCatalogApplyHJWSRoad () {
|
||||
String token = this.qidiToken();
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2?search=[{json}]";
|
||||
String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2";
|
||||
//String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000370_2?search=[{json}]";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Authorization", "Bearer " + token);
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
JSONObject search = new JSONObject();
|
||||
search.put("opt","LIKE");
|
||||
search.put("key","updatetime");
|
||||
search.put("val",this.dateStr());
|
||||
// JSONObject search = new JSONObject();
|
||||
// search.put("opt","LIKE");
|
||||
// search.put("key","updatetime");
|
||||
// search.put("val",this.dateStr());
|
||||
// search.put("opt","EQ");
|
||||
// search.put("key","QDLKDLMC");
|
||||
// search.put("val","宜昌路");
|
||||
map.put("json",search);
|
||||
// map.put("json",search);
|
||||
|
||||
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
|
||||
ResponseEntity<JSONObject> responseEntity;
|
||||
try {
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
//responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map);
|
||||
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
|
||||
JSONObject jsonObject = responseEntity.getBody();
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("list");
|
||||
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);
|
||||
} catch (Exception e) {
|
||||
log.info("[resCatalogApplyHJWSRoad] exception:{}", e.getMessage());
|
||||
return null;
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
//获取当前日期的时间串,2022-05-08 00:00:00
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.hisense.monitormanage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.hisense.monitormanage.entity.Result;
|
||||
import com.hisense.monitormanage.mapper.SanitationMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName SanitationService.java
|
||||
* @Description TODO
|
||||
* @createTime 2022年05月19日 11:23:00
|
||||
*/
|
||||
@Service
|
||||
public class SanitationService {
|
||||
@Autowired
|
||||
private SanitationMapper sanitationMapper;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private MonitorService monitorService;
|
||||
|
||||
|
||||
public Result saveSantation(){
|
||||
List<Map> list = monitorService.resCatalogApplyHJWSBase();
|
||||
if(list.size() > 0){
|
||||
List<List<Map>> maps = Lists.partition(list,100);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Result saveSanitationRoad(){
|
||||
List<Map> list = monitorService.resCatalogApplyHJWSRoad();
|
||||
try{
|
||||
if(list.size() > 0){
|
||||
List<List<Map>> maps = Lists.partition(list,100);
|
||||
maps.forEach(m->sanitationMapper.batchSaveSanitationRoad(m));
|
||||
}
|
||||
return Result.success();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public Result saveSanitationTask(){
|
||||
List<Map> list = monitorService.resCatalogApplyHJWSZY();
|
||||
try{
|
||||
if(list.size() > 0){
|
||||
List<List<Map>> maps = Lists.partition(list,100);
|
||||
maps.forEach(m->sanitationMapper.batchSaveSanitationTask(m));
|
||||
}
|
||||
return Result.success();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hisense.monitormanage.mapper.SanitationMapper">
|
||||
<insert id="batchSave" parameterType="java.util.List">
|
||||
insert into t_sanitation_info
|
||||
(cph,jsy,gmri,cllx,ssqybh,sshwgsbh,bz,sfkh,clbh,ds,sfjzgpsblrsjgpt,jj,
|
||||
clxh,cldl,sfjs,sfss,sfcx
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},
|
||||
#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph},#{item.cph}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchSaveSanitationRoad" parameterType="java.util.List">
|
||||
insert into t_sanitation_road
|
||||
(bh,dlmc,qdlkdlmc,zdlkdlmc,zcgdlxzc,bjdj,dlzd,dlkd,dlzmj,cxdmj,rxdmj,jsmj,ssmj,
|
||||
gycxmj,bjysl,gpxsl,ssqybh,ssjdbsc,sshwgsbh,zbjh,sfqy,bh1,dtdlhzkd,
|
||||
zcgd,jsqz,cxqz,jj,tplj,zbdfxbz0zx1fx,fxzbxxid,ys,btmx,jsts,jspc,
|
||||
sfjs0bjs1js,sfss0bss1ss,sfcx0bcx1cx,sspc,cxpc,ssts,cxts,sfkh
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.BH},#{item.DLMC},#{item.QDLKDLMC},#{item.ZDLKDLMC},#{item.ZCGDLXZC},#{item.BJDJ},#{item.DLZD},
|
||||
#{item.DLKD},#{item.DLZMJ},#{item.CXDMJ},#{item.RXDMJ},#{item.JSMJ},#{item.SSMJ},
|
||||
#{item.GYCXMJ},#{item.BJYSL},#{item.GPXSL},#{item.SSQYBH},#{item.SSJDBSC},#{item.SSHWGSBH},
|
||||
#{item.ZBJH},#{item.SFQY},#{item.BH1},#{item.DTDLHZKD},#{item.ZCGD},#{item.JSQZ},
|
||||
#{item.CXQZ},#{item.JJ},#{item.TPLJ},#{item.ZBDFXBZ0ZX1FX},#{item.FXZBXXID},#{item.YS},
|
||||
#{item.BTMX},#{item.JSTS},#{item.JSPC},#{item.SFJS0BJS1JS},#{item.SFSS0BSS1SS},#{item.SFCX0BCX1CX},
|
||||
#{item.SSPC},#{item.CXPC},#{item.SSTS},#{item.CXTS},#{item.SFKH}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchSaveSanitationTask" parameterType="java.util.List">
|
||||
insert into t_sanitation_task
|
||||
(dlmc,ksdl,zzdl,ssqs,cph,zywcl,zyrq,zylx,zysj,zyts,zypc,zyzd,
|
||||
zykd,zymj,wzyds,zycsds,zygpsds
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.DLMC},#{item.KSDL},#{item.ZZDL},#{item.SSQS},#{item.CPH},#{item.ZYWCL},
|
||||
#{item.ZYRQ},#{item.ZYLX},#{item.ZYSJ},#{item.ZYTS},#{item.ZYPC},#{item.ZYZD},
|
||||
#{item.ZYKD},#{item.ZYMJ},#{item.WZYDS},#{item.ZYCSDS},#{item.ZYGPSDS}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in New Issue