Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/hisense/monitormanage/controller/Controller.java
This commit is contained in:
wuweida 2022-05-17 13:31:30 +08:00
commit 3a2f2b8e38
13 changed files with 181 additions and 148 deletions

18
pom.xml
View File

@ -104,6 +104,24 @@
<artifactId>hutool-all</artifactId>
<version>5.7.18</version>
</dependency>
<!--swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!--swagger-ui.html模式 -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<!--doc.html模式 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.2</version>
</dependency>
</dependencies>

View File

@ -6,8 +6,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@EnableSwagger2
@MapperScan("com.hisense.monitormanage.mapper")
@EnableCaching
@EnableScheduling

View File

@ -0,0 +1,55 @@
package com.hisense.monitormanage.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;//
import org.springframework.context.annotation.Configuration;//
import springfox.documentation.builders.ApiInfoBuilder;//
import springfox.documentation.builders.PathSelectors;//
import springfox.documentation.builders.RequestHandlerSelectors;//
import springfox.documentation.service.ApiInfo;//
import springfox.documentation.service.Contact;//
import springfox.documentation.spi.DocumentationType;//
import springfox.documentation.spring.web.plugins.Docket;//
import springfox.documentation.swagger2.annotations.EnableSwagger2;//
/**
* @author admin
* @version 1.0.0
* @ClassName SwaggerConfig.java
* @Description swagger配置类
* @createTime 2022年05月17日 09:39:00
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Value("${swagger.enable:false}")
private boolean enable;
@Bean
public Docket createRestApi(){
return new Docket(DocumentationType.SWAGGER_2)
.enable(enable)
.select()
.apis(RequestHandlerSelectors.basePackage("com.hisense.monitormanage.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
//构建 api文档的详细信息函数,注意这里的注解引用的是哪个
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
//页面标题
.title("Spring Boot Swagger2 接口文档")
//创建人
.contact(new Contact("Hisense", "", "332163564@qq.com"))
//版本号
.version("1.0")
//描述
.description("API 描述")
.build();
}
}

View File

@ -6,7 +6,6 @@ import com.hisense.monitormanage.entity.*;
import com.hisense.monitormanage.mapper.*;
import com.hisense.monitormanage.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@ -268,6 +267,26 @@ public class Controller {
return success;
}
/**
* 订阅任务下发接口
* @return
*/
@RequestMapping("subscribe")
public JSONObject subscribe(){
return monitorService.subscribe();
}
/**
* 事件模板分页查询接口
* @return
*/
@RequestMapping("tamplate")
public JSONObject tamplate(){
return monitorService.template();
}
//查询视频点播巡检结果只取异常的
// @RequestMapping("listChannelPlayStates")
// public Result listChannelPlayStates(

View File

@ -1,23 +1,47 @@
package com.hisense.monitormanage.controller;
import com.hisense.monitormanage.entity.CaseCityLaw;
import com.hisense.monitormanage.service.SJZTService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
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 java.util.List;
import java.util.Map;
@Api(tags = "数交中台-城市执法案件")
@RestController
@RequestMapping("api/project")
public class SJZTController {
@Autowired
private SJZTService sjztService;
//从接口获取案件数据
@GetMapping("listSJZTDatas")
@ApiOperation("获取案件数据,根据后台条件调用接口获取")
public List<Map> listSJZTDatas(){
return sjztService.listSJZTDatas();
}
//测试保存
@GetMapping("batchSaveSJZT")
@ApiOperation("测试保存,根据后台条件调用接口获取并保存到表,这个后台条件需要改动,也可能是做成自动任务调度")
public void batchSaveSJZT(){
sjztService.batchSave();
}
//从表中查询案件数据,需要根据要求增加条件
@GetMapping("listSJZTByDt")
@ApiOperation("获取案件数据根据ajjlsj从表中获取")
@ApiImplicitParam(name="ajjlsj",value="案件建立时间2021-01-01",paramType = "query",required = true,dataType = "string")
public List<CaseCityLaw> listSJZTByDt(
@RequestParam(value="ajjlsj") String ajjlsj
){
return sjztService.listSJZTByDt(ajjlsj);
}
}

View File

@ -13,6 +13,7 @@ import com.hisense.monitormanage.mapper.CameraMapper;
import com.hisense.monitormanage.mapper.ProjectMapper;
import com.hisense.monitormanage.mapper.ScenicMapper;
import com.hisense.monitormanage.service.MonitorService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -2,7 +2,11 @@ package com.hisense.monitormanage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
@ -13,11 +17,13 @@ import java.time.LocalDateTime;
* @Description 城市执法案件类
* @createTime 2022年05月13日 15:32:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_case_cityLaw")
public class CaseCityLaw {
@TableId(type = IdType.ASSIGN_ID)
private Long id;
private String ajbs;
private String rwh;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ajjlsj;
private String dzms;
@ -26,140 +32,29 @@ public class CaseCityLaw {
private String wtlymc;
private String ajlxbs;
private String ajlxmc;
private String wtlxbs;
private String wtlxmc;
private String dlbs;
private String dlmc;
private String xlbs;
private String xlmc;
private String wtlxdm;
private String bjbm;
private String qbs;
private String qmc;
private String jdbs;
private String jdmc;
private String sqbs;
private String sqmc;
private String wgbs;
private String wgmc;
private String zrwgbs;
private String zrwgmc;
private String dlbs2;
private String dlmc2;
private String dllxbs;
private String dllxmc;
private double xzb;
private double yzb;
private String hdsxbs;
private String wtdjbs;
private String wtdjmc;
private String xzb;
private String yzb;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime pqsj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ajjssj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ajzfsj;
private String ywbs;
private String ywmc;
private String tlxsys;
private String latjbs;
private String latjmc;
private String jatjbs;
private String jatjmc;
private String ajxsbh;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ajzxhdsj;
private String ajgkbs;
private String jjhts;
private String jjyqs;
private String yjzbbs;
private String yjzbmc;
private String ejzbbs;
private String ejzbmc;
private String mqsbzrzt;
private String zsqybs;
private String zsqymc;
private String zsjdbs;
private String zsjdmc;
private String zssqbs;
private String zssqmc;
private String dxlx;
private String dxly;
private String dxsbrxm;
private String sfbmbs;
private String czsxcqjaaqjacqwjayqja;
private String sbtpsl;
private String cztpsl;
private String clssqy;
private String clssgs;
private String sbqy;
private String sfxhfsf;
private String sqbhfsf;
private String mydmyybbmy;
private String hfnr;
private String bslly;
private String sfggdxl;
private String bmyly;
private String zjbjs;
private String tsyqs;
private String jalxbs;
private String zdajshztzzy;
private String sfzdajzzy;
private String zflas;
private String zfajh;
private String zfrwh;
private String czgwbs;
private String czgw;
private String dbs;
private String dfdbs;
private String asdfdbs;
private String csdfdbs;
private String mydpf;
private String glajbs;
private String yqcs;
private String gzcs;
private String jxid;
private String jxmc;
private String csbs;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime dbsj;
private String dbrybs;
private String dbryxm;
private String fjfz;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime ldsj;
private String sfdybs;
private String cxbls;
private String ldbs;
private String ldmc;
private String xybs;
private String xymc;
private String gdlxbs;
private String gdlx;
private String zajrwh;
private String zajbzw1zrw0zrw1ptrw;
private String zxpccgh;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime scpqsj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime zhycpqsj;
private String bqzd;
private String dpbs;
private String wjlxid;
private String bjys;
private String ztys;
private String sbrssbm;
private String yczjdzpwgkehtbs1htg0whtg;
private String yczjdzpwgkehtcs;
private String wgxggajfsdgaryhdpch;
private String wgxggdhhm;
private String xflb;
private String yjjbajje;
private String yqajstgyqdzpdbjrw1;
private String sqjaj;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime operatetime;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private LocalDateTime updatetime;
}

View File

@ -14,5 +14,7 @@ import java.util.Map;
* @createTime 2022年05月13日 16:22:00
*/
public interface CaseCityLawMapper extends BaseMapper<CaseCityLaw> {
//public void batchSave(List<Map> list);
public void batchSave(List<Map> list);
public void singleSave(Map map);
}

View File

@ -585,7 +585,7 @@ public class MonitorService {
}
}
//渣土车轨迹数据
//渣土车轨迹数据,最新的
public List<Map> resCatalogApplyZTYS () {
String token = this.qidiToken();
HttpHeaders headers = new HttpHeaders();

View File

@ -3,7 +3,11 @@ package com.hisense.monitormanage.service;
import cn.hutool.crypto.SecureUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.google.common.collect.Lists;
import com.hisense.monitormanage.entity.CaseCityLaw;
import com.hisense.monitormanage.mapper.CaseCityLawMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -83,21 +87,10 @@ public class SJZTService {
Map<String,Object> map = new HashMap<>();
JSONObject search = new JSONObject();
search.put("opt","LIKE");
search.put("key","AJJLSJ");
search.put("key","WTLYMC");
// search.put("val",this.dateStr());
search.put("val","2017");
search.put("val","微信举报");
// search.put("opt","EQ");
// search.put("key","SPEED");
// search.put("val","0");
// JSONArray searchArray = new JSONArray();
// searchArray.add(search);
// String encode = "";
// try {
// encode = URLEncoder.encode(JSONObject.toJSONString(searchArray), "UTF-8").replace("+", "%20");
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
map.put("json",search);
int i = 1;
int roundCount = 0;
@ -114,7 +107,6 @@ public class SJZTService {
JSONObject jsonObject = responseEntity.getBody();
count = jsonObject.getIntValue("count");
JSONArray jsonArray = jsonObject.getJSONArray("list");
log.info("[listSJZTDatas] 返回数据的数量:{}",jsonArray.size());
maps.addAll(JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class));
i++;
roundCount = i*10000;
@ -123,11 +115,12 @@ public class SJZTService {
return null;
}
} while(roundCount <=count);
System.out.println(maps.size());
log.info("[listSJZTDatas] 返回数据的数量:{}",maps.size());
return maps;
}
//保存案件数据
//从接口获取案件数据并保存
public void batchSave(){
String token = this.sjztToken();
HttpHeaders headers = new HttpHeaders();
@ -137,6 +130,7 @@ public class SJZTService {
JSONObject search = new JSONObject();
search.put("opt","LIKE");
search.put("key","AJJLSJ");
// search.put("val",this.dateStr());
search.put("val","2017");
map.put("json",search);
@ -163,14 +157,25 @@ public class SJZTService {
}
} while(roundCount <=count);
System.out.println(mapList.size());
List<List<Map>> lists = Lists.partition(mapList,200);
IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
mapList.forEach(m-> m.put("id",identifierGenerator.nextId(new Object())));//给id赋值
List<List<Map>> lists = Lists.partition(mapList,50);
try{
lists.forEach(l->caseCityLawMapper.batchSave(l));
}catch (Exception e){
e.printStackTrace();
log.error("[SJZTService batchsave Exception]:",e.getMessage());
}
}
public List<CaseCityLaw> listSJZTByDt(String ajjlsj){
QueryWrapper<CaseCityLaw> wrapper = new QueryWrapper<>();
wrapper.like("ajjlsj",ajjlsj);
return caseCityLawMapper.selectList(wrapper);
}
//获取当前日期的时间串2022-05-08 00:00:00

View File

@ -11,7 +11,7 @@ spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.name=defaultDataSource
# 数据库连接地址
#spring.datasource.url=jdbc:mysql://15.72.183.91:3306/monitor_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://15.72.183.91:3306/monitor_manage?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://15.72.183.91:3306/monitor_manage?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=true&serverTimezone=GMT%2B8
# 数据库用户名&密码:
spring.datasource.username=root
spring.datasource.password=w@CmM1mBVQkPhdrc
@ -21,4 +21,6 @@ hwx.file.work-path=D:/tupian/
hwx.file.pic-host=http://127.0.0.1:7009
spring.resources.static-locations=classpath:/static,classpath:/public,file:${hwx.file.work-path}
mybatis-plus.mapper-locations=classpath*:/mapper/*.xml
#??????swagger,true???false??
swagger.enable=true

View File

@ -4,19 +4,35 @@
<insert id="batchSave" parameterType="java.util.List">
INSERT INTO t_case_citylaw
(ajjlsj,dzms,wtms,wtlybs,wtlymc,ajlxbs,ajlxmc,dlbs,dlmc,xlbs,xlmc,qbs,qmc,jdbs,
jdmc,sqbs,sqmc,xab,yzb,pqsj,sjjssj,ajzfsj,casxcqjaaqjacqwjayqja,sbtpsl,catpsl
(id,ajjlsj,dzms,wtms,wtlybs,wtlymc,ajlxbs,ajlxmc,dlbs,dlmc,xlbs,xlmc,qbs,qmc,jdbs,
jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl
)
VALUES
<foreach collection="list" item="item" separator="," >
(
#{item.AJJLSJ},#{item.DZMS},#{item.WTMS},#{item.WTLYBS},#{item.WTLYMC},
#{item.id},#{item.AJJLSJ},#{item.DZMS},#{item.WTMS},#{item.WTLYBS},#{item.WTLYMC},
#{item.AJLXBS},#{item.AJLXMC},#{item.DLBS},#{item.DLMC},#{item.XLBS},
#{item.XLMC},#{item.QBS},#{item.QMC},#{item.JDBS},#{item.JDMC},#{item.SQBS},
#{item.SQMC},#{item.XZB},#{item.YZB},#{item.PQSJ},#{item.AJJSSJ},#{item.AJZFSJ},
#{item.CZSXCQJAAQJACQWJAYQJA},#{item.SBTPSL},#{item.CZTPSL}
)
</foreach>
</insert>
<insert id="singleSave" parameterType="java.util.Map">
INSERT INTO t_case_citylaw
(id,ajjlsj,dzms,wtms,wtlybs,wtlymc,ajlxbs,ajlxmc,dlbs,dlmc,xlbs,xlmc,qbs,qmc,jdbs,
jdmc,sqbs,sqmc,xzb,yzb,pqsj,ajjssj,ajzfsj,czsxcqjaaqjacqwjayqja,sbtpsl,cztpsl
)
VALUES
(
#{id},#{AJJLSJ},#{DZMS},#{WTMS},#{WTLYBS},#{WTLYMC},
#{AJLXBS},#{AJLXMC},#{DLBS},#{DLMC},#{XLBS},
#{XLMC},#{QBS},#{QMC},#{JDBS},#{JDMC},#{SQBS},
#{SQMC},#{XZB},#{YZB},#{PQSJ},#{AJJSSJ},#{AJZFSJ},
#{itCZSXCQJAAQJACQWJAYQJA},#{SBTPSL},#{CZTPSL}
)
</insert>
</mapper>

View File

@ -37,11 +37,5 @@ class MonitorManageApplicationTests {
}
@Test
public void reverseGeocodeTest(){
String location = "location";
Map<String,Object> map = new HashMap<>();
map.put("location",location);
monitorService.reverseGeocode(map);
}
}