Commit eef34124 by Jbb

查询代码 有点问题

parent 11939a4e
package com.founder.commonutils.util;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
public class ReadRequest {
public static String ReadAsChars(HttpServletRequest request) {
BufferedReader bf = null;
StringBuilder sb = new StringBuilder();
try {
bf = request.getReader();
String st;
while ((st = bf.readLine()) != null) {
sb.append(new String(st.getBytes(), "UTF-8"));
}
bf.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != bf) {
try {
bf.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return sb.toString();
}
}
......@@ -20,6 +20,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
......
package com.founder.commonutils.viewEntity;
import java.io.Serializable;
import java.util.Date;
public class AccidentPoint implements Serializable {
private String xxzjbh;
private double lat; //纬度
private double lon; //经度
private String title; //事故提示
private Date time; //事故时间
public String getXxzjbh() {
return xxzjbh;
}
public void setXxzjbh(String xxzjbh) {
this.xxzjbh = xxzjbh;
}
public double getLat() {
return lat;
}
public void setLat(double lat) {
this.lat = lat;
}
public double getLon() {
return lon;
}
public void setLon(double lon) {
this.lon = lon;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
}
package com.founder.commonutils.viewEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用来查询的图层信息的实体
*/
public class LayerInfo implements Serializable {
private String name;//图层名称
private String lrr;//录入人
private int count;
private String xxzjbh;//主键编号
private String gl_xxzjbh;//关联主键
private BigDecimal x;//经度
private BigDecimal y;//维度
private String title;//标题
private String time;//数据时间
public LayerInfo() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLrr() {
return lrr;
}
public void setLrr(String lrr) {
this.lrr = lrr;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getXxzjbh() {
return xxzjbh;
}
public void setXxzjbh(String xxzjbh) {
this.xxzjbh = xxzjbh;
}
public String getGl_xxzjbh() {
return gl_xxzjbh;
}
public void setGl_xxzjbh(String gl_xxzjbh) {
this.gl_xxzjbh = gl_xxzjbh;
}
public BigDecimal getX() {
return x;
}
public void setX(BigDecimal x) {
this.x = x;
}
public BigDecimal getY() {
return y;
}
public void setY(BigDecimal y) {
this.y = y;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
package com.founder.commonutils.viewEntity;
import lombok.Data;
import java.io.Serializable;
/**
* 分页实体
*/
@Data
public class PageInfo implements Serializable {
private Integer size;
private Integer pageNo;
}
......@@ -15,7 +15,7 @@ import java.util.List;
@Accessors(chain = true)
@TableName("tb_st_layer")
@ApiModel(value="图层对象", description="图层信息数据")
public class TbStLayer {
public class TbStLayer extends PageInfo {
@TableId(value = "xxzjbh")
private String xxzjbh;
private String name;
......@@ -29,5 +29,7 @@ public class TbStLayer {
private String gxdwdc;
private Date gxsj;
private List<TbStLayerData> stLayerDataList;
private String startTime;
private String endTime;
private Integer count;
}
package com.founder.commonutils.viewEntity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_st_layer_data")
@ApiModel(value="图层数据对象", description="图层数据")
public class TbStLayerData implements Serializable {
@TableId(value = "xxzjbh")
private String xxzjbh;
private String gl_xxzjbh;
private double x; //经度
......
......@@ -77,6 +77,11 @@
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.2.1</version>
</dependency>
<!-- 数据库驱动包 -->
<!-- <dependency>
......
......@@ -67,6 +67,11 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.2.1</version>
</dependency>
<!--ojdbc-->
<!-- <dependency>
<groupId>org.oracle</groupId>
......
......@@ -26,4 +26,6 @@ public class EduConfig {
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
package com.founder.view.controller;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.util.KeyUtil;
import com.founder.commonutils.util.LngLonUtil;
import com.founder.commonutils.viewEntity.AccidentPoint;
import com.founder.view.service.AccidentPointService;
import io.swagger.annotations.Api;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Api(description = "经纬度上传")
@RestController
@RequestMapping("/xy")
public class AccidentPointController {
@Resource
AccidentPointService accidentPointService;
@RequestMapping("/uploadExcel")
public MapRestResult uploadDown(@RequestParam("excelFile") MultipartFile excelFile, HttpServletResponse response) {
try {
InputStream is = excelFile.getInputStream();
XSSFWorkbook sheets = new XSSFWorkbook(is);
XSSFSheet sheetAt = sheets.getSheetAt(0);
//获取excel有多少行
int lastRowNum = sheetAt.getLastRowNum();
List<AccidentPoint> pointList = new ArrayList<>();
for (int i = 1; i <= lastRowNum; i++) {
AccidentPoint point = new AccidentPoint();
String id = KeyUtil.getUUIDKey("xy");
point.setXxzjbh(id);
XSSFRow row = sheetAt.getRow(i);
//获取excel有多少列
short lastCellNum = row.getLastCellNum();
//判断经纬度是否符合要求
//检车一下数据是否能正常读取.....
/*double x = 0.0;
double y = 0.0;
String title = "";
String dateTime = "";
if(row.getCell(0) != null && row.getCell(1) != null){
x = row.getCell(0).getNumericCellValue();
y = row.getCell(1).getNumericCellValue();
title = row.getCell(2).getStringCellValue();
dateTime = row.getCell(3).getStringCellValue();
System.out.println(x + "==========" + y + "=========" + title + "=========" + dateTime);
}*/
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
//验证经纬度是否是八位小数以内
boolean isTrue = LngLonUtil.verifyLongAndLat(row.getCell(0).getNumericCellValue(), row.getCell(1).getNumericCellValue());
if(isTrue){//这里可以不用for循环 因为excel列数比较少
for (int j = 0; j < lastCellNum; j++) {
if(j == 0){
double x = row.getCell(0).getNumericCellValue();
point.setLon(x);
}
if(j == 1){
double y = row.getCell(1).getNumericCellValue();
point.setLat(y);
}
if(j == 2){
String title = row.getCell(2).getStringCellValue();
point.setTitle(title);
}
if(j == 3){
String dateTimeStr = row.getCell(3).getStringCellValue();
Date dateTime = df.parse(dateTimeStr);
point.setTime(dateTime);
}
}
}else {
//经度小数点后超过了八位
double x = 0;
double y = 0;
if(row.getCell(0).getNumericCellValue() + "" .length() > 12){
String xStr = row.getCell(0).getNumericCellValue() + "".substring(0, 12);
x = Double.parseDouble(xStr);
}
if(row.getCell(1).getNumericCellValue() + "" .length() > 11){
String yStr = row.getCell(0).getNumericCellValue() + "".substring(0, 11);
y = Double.parseDouble(yStr);
}
for (int j = 0; j < lastCellNum; j++) {
if(j == 0){
//x = row.getCell(0).getNumericCellValue();
point.setLon(x);
}
if(j == 1){
//y = row.getCell(1).getNumericCellValue();
point.setLat(y);
}
if(j == 2){
String title = row.getCell(2).getStringCellValue();
point.setTitle(title);
}
if(j == 3){
String dateTimeStr = row.getCell(3).getStringCellValue();
Date dateTime = df.parse(dateTimeStr);
point.setTime(dateTime);
}
}
}
accidentPointService.save(point);
} catch (Exception e) {
//具体的错误数据保存到这里
//e.printStackTrace();
pointList.add(point);
}
}
//输出流写入到excel中
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
//给个标题头
HSSFRow rowTitle = sheet.createRow(0);
rowTitle.createCell(0).setCellValue("经度");
rowTitle.createCell(1).setCellValue("纬度");
rowTitle.createCell(2).setCellValue("标题");
rowTitle.createCell(3).setCellValue("时间");
for (int i = 0; i < pointList.size(); i++) {
AccidentPoint accidentPoint = pointList.get(i);
double lon = accidentPoint.getLon();
double lat = accidentPoint.getLat();
String title = accidentPoint.getTitle();
Date time = accidentPoint.getTime();
HSSFRow rowData = sheet.createRow(i + 1);
rowData.createCell(0).setCellValue(lon);
rowData.createCell(1).setCellValue(lat);
rowData.createCell(2).setCellValue(title);
rowData.createCell(3).setCellValue(time);
}
//通过输出流下载
ServletOutputStream outputStream = response.getOutputStream();
//设置文件响应输出格式
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;filename=error.xls");
wb.write(outputStream);
outputStream.flush();
outputStream.close();
wb.close();
} catch (Exception e) {
e.printStackTrace();
}
return MapRestResult.ok();
}
}
package com.founder.view.controller;
import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.util.ReadRequest;
import com.founder.commonutils.viewEntity.LayerInfo;
import com.founder.view.service.QueryByTimeUserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
@Api(description = "根据时间和用户查询")
@Controller
@RequestMapping("/layer")
public class QueryDataController {
@Autowired
QueryByTimeUserService queryByTimeUserService;
@RequestMapping(value = "/query", method = RequestMethod.POST, produces = "text/plain;charset=UTF-8")
@CrossOrigin
public MapRestResult queryByTimeUser(HttpServletRequest request, HttpServletResponse response) throws Exception {
JSONObject json = new JSONObject();
try {
String para = ReadRequest.ReadAsChars(request);
JSONObject object = JSONObject.parseObject(para);
String starTime = object.getString("starTime");
String endTime = object.getString("endTime");
String userName = object.getString("userName");
List<LayerInfo> resList = queryByTimeUserService.queryByTimeUser(starTime,endTime,userName);
return MapRestResult.build(200,"查询成功",resList);
}catch (Exception e){
e.printStackTrace();
return MapRestResult.error("查询失败");
}
}
}
package com.founder.view.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.view.service.SysUsersService;
import com.founder.view.service.TbStAsjBzService;
import com.founder.view.service.TbStAsjService;
import com.founder.commonutils.asjEntity.AsjQuery;
import com.founder.commonutils.asjEntity.CbxszAndXlaj;
import com.founder.commonutils.asjEntity.TbStAsj;
import com.founder.commonutils.asjEntity.TbXwAsjbz;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.Receiving;
import com.founder.commonutils.publicEntity.SysUser;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 案事件基本信息 前端控制器
* </p>
*
* @author Guojunfeng
* @since 2021-03-03
*/
@Api(description = "案事件管理")
@RestController
@RequestMapping("/asj")
public class TbStAsjController {
@Autowired
private SysUsersService sysUsersService;
@Autowired
private TbStAsjService tbStAsjService;
@Autowired
private TbStAsjBzService tbStAsjBzService;
@Value("${ssdw}")
private String ssdw;
//案件查询(存储reids)
@OperLog(message = "案件查询",operation = OperationType.QUERY)
@ApiOperation(value = "案件查询(存储reids)")
@PostMapping("/ajxx")
public MapRestResult selectAsjxx(@RequestBody Receiving receiving) {
receiving.setSsdw(ssdw);//设置所属单位,用于案件类别代码转译
//return tbStAsjService.selectAsjxxList(receiving);
List<TbStAsj> asjList = tbStAsjService.selectAsjxxList(receiving);
return MapRestResult.ok(asjList);
}
//案件查询(同类案件 chent20200507)
@OperLog(message = "案件查询(同类案件)",operation = OperationType.QUERY)
@ApiOperation(value = "案件查询(同类案件)")
@PostMapping("/tlajxx")
public MapRestResult selectTlAsjxx(@RequestBody Receiving receiving) {
return tbStAsjService.selectTlAsjxxList(receiving);
}
@OperLog(message = "按条件查询案件",operation = OperationType.QUERY)
@ApiOperation(value = "按条件查询案件")
@PostMapping("/getAsj")
public MapRestResult getAsj(@RequestBody AsjQuery asjQuery) {
QueryWrapper<TbStAsj> wrapper = new QueryWrapper<>();
String asjbh = asjQuery.getAsjbh();
String ajmc = asjQuery.getAjmc();
String xsjqlbdm = asjQuery.getXsjqlbdm();
Date begin = asjQuery.getBegin();
Date end = asjQuery.getEnd();
//判断条件值是否为空,如果不为空拼接条件
if (!StringUtils.isEmpty(asjbh)) {
wrapper.eq("asjbh", asjbh);
}
if (!StringUtils.isEmpty(ajmc)) {
wrapper.like("ajmc", ajmc);
}
if (!StringUtils.isEmpty(xsjqlbdm)) {
wrapper.eq("xsjqlbdm", xsjqlbdm);
}
if (!StringUtils.isEmpty(begin)) {
wrapper.ge("ASJFSSJ_ASJFSKSSJ", begin);
}
if (!StringUtils.isEmpty(end)) {
wrapper.le("ASJFSSJ_ASJFSJSSJ", end);
}
List<TbStAsj> list = tbStAsjService.list(wrapper);
return MapRestResult.ok(list);
}
@OperLog(message = "获取所有案件(带分页)",operation = OperationType.QUERY)
@ApiOperation(value = "获取所有案件(带分页)")
@GetMapping("getPageAsj/{current}/{limit}")
public MapRestResult getPageAsj(@PathVariable long current,
@PathVariable long limit) {
//创建page对象
Page<TbStAsj> pageAsj = new Page<>(current, limit);
tbStAsjService.page(pageAsj, null);
long total = pageAsj.getTotal();//总记录数
List<TbStAsj> records = pageAsj.getRecords(); //数据list集合
return MapRestResult.build(202,"成功获取案件信息",total,records);
}
@OperLog(message = "带条件查询所有案件(带分页)",operation = OperationType.QUERY)
@ApiOperation(value = "带条件查询所有案件(带分页)")
@PostMapping("getPageAsjCondition/{current}/{limit}")
public MapRestResult getPageAsjCondition(@PathVariable long current, @PathVariable long limit,
@RequestBody(required = false) AsjQuery asjQuery) {
//创建page对象
Page<TbStAsj> pageAsj = new Page<>(current, limit);
//构建条件
QueryWrapper<TbStAsj> wrapper = new QueryWrapper<>();
String asjbh = asjQuery.getAsjbh();
String ajmc = asjQuery.getAjmc();
String xsjqlbdm = asjQuery.getXsjqlbdm();
Date begin = asjQuery.getBegin();
Date end = asjQuery.getEnd();
//判断条件值是否为空,如果不为空拼接条件
if (!StringUtils.isEmpty(asjbh)) {
wrapper.eq("asjbh", asjbh);
}
if (!StringUtils.isEmpty(ajmc)) {
wrapper.like("ajmc", ajmc);
}
if (!StringUtils.isEmpty(xsjqlbdm)) {
wrapper.eq("xsjqlbdm", xsjqlbdm);
}
if (!StringUtils.isEmpty(begin)) {
wrapper.ge("ASJFSSJ_ASJFSKSSJ", begin);
}
if (!StringUtils.isEmpty(end)) {
wrapper.le("ASJFSSJ_ASJFSJSSJ", end);
}
//调用方法实现条件查询分页
tbStAsjService.page(pageAsj,wrapper);
long total = pageAsj.getTotal();//总记录数
List<TbStAsj> records = pageAsj.getRecords(); //数据list集合
return MapRestResult.build(202,"成功获取案件信息",total,records);
}
@OperLog(message = "修改案件",operation = OperationType.QUERY)
@ApiOperation(value = "修改案件")
@PutMapping("updateAsj")
public MapRestResult updateAsj(@RequestBody TbStAsj tbStAsj) {
boolean flag = tbStAsjService.updateById(tbStAsj);
if (flag) {
return MapRestResult.ok();
} else {
return MapRestResult.error();
}
}
@ApiOperation(value = "获取案件标注信息")
@PostMapping("getAsjbzxx")
public MapRestResult get(@ApiParam(name = "asjbh", value = "案事件编号",required = true)
@RequestParam String asjbh) {
QueryWrapper<TbXwAsjbz> wrapper = new QueryWrapper<>();
//判断条件值是否为空,如果不为空拼接条件
if (!StringUtils.isEmpty(asjbh)) {
wrapper.eq("asjbh", asjbh);
}
//设置需要查询的字段
wrapper.select("ASJBH","AJZLB","AJXZLB","XALBDMBCMS",
"(select name from sys_dictitem where groupid='CODE_AJZLB'"+ "and code=AJZLB) as XSZALXDMSTR"
,"(select name from sys_dictitem where groupid='CODE_AJXZLB'"+"and code=AJXZLB) as XSLALXDMSTR"
,"(select name from sys_dictitem where groupid='CODE_XALBDMBCMS'"+"and code=XALBDMBCMS) as XALBDMBCMSSTR");
TbXwAsjbz asjbz = tbStAsjBzService.getOne(wrapper);
return MapRestResult.build(202,"成功获取案件标注信息","1",asjbz);
}
// 查询案事件标注信息
@OperLog(message = "获取串并线索组信息",operation = OperationType.QUERY)
@ApiOperation(value = "获取串并线索组信息")
@PostMapping("/getAsjxxCbzAndXlaj")
public MapRestResult getAsjxxCbzAndXlaj(@ApiParam(name = "asjbh", value = "案事件编号")
@RequestParam(required = true) String asjbh) {
JSONObject acb = new JSONObject();
JSONObject a = new JSONObject();
Map xszajbhMap = new HashMap<>();
// 通过案件编号去TB_YW_XSZ_CBAJ查询XSZAJBH
List<String> xszajbh = tbStAsjService.getXszajbhByAsjbh(asjbh);
if(xszajbh.size()>0){
xszajbhMap.put("listxszajbh",xszajbh);
xszajbhMap.put("asjbhs",asjbh);
// 通过该线索组编号在查询TB_YW_XSZ_CBAJ中 相关比重类型和案事件编号(出去传入的案件)
List<CbxszAndXlaj> listXszXgaj = tbStAsjService.GetlistXszXgaj(xszajbhMap);
// 将查回的线索组封装成json
JSONArray jsonArray = new JSONArray();
for(CbxszAndXlaj xsz : listXszXgaj){
JSONObject jo = new JSONObject();
if(!"".equals(xsz.getAsjbh())&&null!=xsz.getAsjbh()) {
jo.put("asjbh", xsz.getAsjbh());
}else{
jo.put("asjbh", "");
}
if(!"".equals(xsz.getCblx())&&null!=xsz.getCblx()) {
jo.put("cblx", xsz.getCblx());
}else{
jo.put("cblx", "");
}
if(!"".equals(xsz.getCblx_str())&&null!=xsz.getCblx_str()) {
jo.put("cblx_str", xsz.getCblx_str());
}else{
jo.put("cblx_str", "");
}
if(!"".equals(xsz.getAjmc())&&null!=xsz.getAjmc()) {
jo.put("ajmc", xsz.getAjmc());
}else{
jo.put("ajmc", "");
}
if(!"".equals(xsz.getAsjfssj_asjfskssj())&&null!=xsz.getAsjfssj_asjfskssj()) {
jo.put("asjfssj_asjfskssj", xsz.getAsjfssj_asjfskssj());
}else{
jo.put("asjfssj_asjfskssj", "");
}
if(!"".equals(xsz.getZcjdmc())&&null!=xsz.getZcjdmc()) {
jo.put("zcjdmc", xsz.getZcjdmc());
}else{
jo.put("zcjdmc", "");
}
if(!"".equals(xsz.getAjzlbmc())&&null!=xsz.getAjzlbmc()) {
jo.put("ajzlbmc", xsz.getAjzlbmc());
}else{
jo.put("ajzlbmc", "");
}
if(!"".equals(xsz.getAjxzlbmc())&&null!=xsz.getAjxzlbmc()) {
jo.put("ajxzlbmc", xsz.getAjxzlbmc());
}else{
jo.put("ajxzlbmc", "");
}
if(!"".equals(xsz.getXalbdmbcmsmc())&&null!=xsz.getXalbdmbcmsmc()) {
jo.put("xalbdmbcmsmc", xsz.getXalbdmbcmsmc());
}else{
jo.put("xalbdmbcmsmc", "");
}
if(!"".equals(xsz.getX())&&null!=xsz.getX()) {
jo.put("X", xsz.getX());
}else{
jo.put("X", "");
}
if(!"".equals(xsz.getY())&&null!=xsz.getY()) {
jo.put("Y", xsz.getY());
}else{
jo.put("Y", "");
}
if(!"".equals(xsz.getJyaq())&&null!=xsz.getJyaq()) {
jo.put("jyaq", xsz.getJyaq());
}else{
jo.put("jyaq", "");
}
jsonArray.add(jo);
}
a.put("xszaj",jsonArray);
System.out.println("线索组返回的list="+a.toString());
}
// 同样过案件编号去TB_YW_CBZ_CBAJ查询XLAJBH
List<String> listXlajbh = tbStAsjService.getXlajbhByAsjbh(asjbh);
if(listXlajbh.size()>0){
xszajbhMap.put("listXlajbh",listXlajbh);
xszajbhMap.put("asjbhs",asjbh);
// 通过该系列案件编号在查询TB_YW_CBZ_CBAJ中 相关串并依据和案事件编号(除去传入的案件)
List<CbxszAndXlaj> listCbzByXlajbh = tbStAsjService.GetlistCbzXgaj(xszajbhMap);
for (CbxszAndXlaj CbxszAndXlaj : listCbzByXlajbh) {
// 串并组系列案件编号 CBLX可能为多值进行翻译
// 这里是处理多个串并类型的方法
if(CbxszAndXlaj.getCblx() != null && !CbxszAndXlaj.getCblx().isEmpty()){
String[] cbyj;
if(CbxszAndXlaj.getCblx().contains(",")){
cbyj = CbxszAndXlaj.getCblx().split(",");
for (int i = 0; i < cbyj.length; i++) {
if(!StringUtils.isEmpty(cbyj[i])){
Map<String,String> map = new HashMap<String,String>();
map.put("groupid", "CODE_CBYP_CBLX");
map.put("code", cbyj[i]);
String name = tbStAsjService.getNameByCode(map);
if(name != null){
cbyj[i] = name;
}
}
}
}else{
cbyj = new String[1];
if(!StringUtils.isEmpty(CbxszAndXlaj.getCblx())){
Map<String,String> map = new HashMap<String,String>();
map.put("groupid", "CODE_CBYP_CBLX");
map.put("code", CbxszAndXlaj.getCblx());
String name = tbStAsjService.getNameByCode(map);
if(name != null){
cbyj[0] = name;
}
}else{
cbyj[0] = CbxszAndXlaj.getCblx();
}
}
if(cbyj != null && cbyj.length > 0){
String cbyjStr = "";
for (String str : cbyj) {
cbyjStr = cbyjStr + "、" + str;
}
CbxszAndXlaj.setCblx_str(cbyjStr.substring(1));
}else{
CbxszAndXlaj.setCblx_str("");
}
}
}
JSONArray jsonArrayCb = new JSONArray();
for(CbxszAndXlaj cbz : listCbzByXlajbh){
JSONObject jo = new JSONObject();
if(!"".equals(cbz.getAsjbh())&&null!=cbz.getAsjbh()) {
jo.put("asjbh", cbz.getAsjbh());
}else{
jo.put("asjbh", "");
}
if(!"".equals(cbz.getCblx())&&null!=cbz.getCblx()) {
jo.put("cblx", cbz.getCblx());
}else{
jo.put("cblx", "");
}
if(!"".equals(cbz.getCblx_str())&&null!=cbz.getCblx_str()) {
jo.put("cblx_str", cbz.getCblx_str());
}else{
jo.put("cblx_str", "");
}
if(!"".equals(cbz.getAjmc())&&null!=cbz.getAjmc()) {
jo.put("ajmc", cbz.getAjmc());
}else{
jo.put("ajmc", "");
}
if(!"".equals(cbz.getAsjfssj_asjfskssj())&&null!=cbz.getAsjfssj_asjfskssj()) {
jo.put("asjfssj_asjfskssj", cbz.getAsjfssj_asjfskssj());
}else{
jo.put("asjfssj_asjfskssj", "");
}
if(!"".equals(cbz.getZcjdmc())&&null!=cbz.getZcjdmc()) {
jo.put("zcjdmc", cbz.getZcjdmc());
}else{
jo.put("zcjdmc", "");
}
if(!"".equals(cbz.getAjzlbmc())&&null!=cbz.getAjzlbmc()) {
jo.put("ajzlbmc", cbz.getAjzlbmc());
}else{
jo.put("ajzlbmc", "");
}
if(!"".equals(cbz.getAjxzlbmc())&&null!=cbz.getAjxzlbmc()) {
jo.put("ajxzlbmc", cbz.getAjxzlbmc());
}else{
jo.put("ajxzlbmc", "");
}
if(!"".equals(cbz.getXalbdmbcmsmc())&&null!=cbz.getXalbdmbcmsmc()) {
jo.put("xalbdmbcmsmc", cbz.getXalbdmbcmsmc());
}else{
jo.put("xalbdmbcmsmc", "");
}
if(!"".equals(cbz.getX())&&null!=cbz.getX()) {
jo.put("X", cbz.getX());
}else{
jo.put("X", "");
}
if(!"".equals(cbz.getY())&&null!=cbz.getY()) {
jo.put("Y", cbz.getY());
}else{
jo.put("Y", "");
}
if(!"".equals(cbz.getJyaq())&&null!=cbz.getJyaq()) {
jo.put("jyaq", cbz.getJyaq());
}else{
jo.put("jyaq", "");
}
jsonArrayCb.add(jo);
}
acb.put("cbzaj",jsonArrayCb);
System.out.println("串并组组返回的list="+acb.toString());
acb.putAll(a);
}else{
acb.putAll(a);
}
System.out.println("线索组和串并组返回的Alllist="+acb.toString());
return MapRestResult.ok(acb);
}
@ApiOperation(value = "登录名拿到身份证号码接口")
@PostMapping("/loginSfzhm")
public MapRestResult getPageAsj(@ApiParam(name = "userName",value = "userName",required = true)
@RequestParam String userName) {
QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
//判断条件值是否为空,如果不为空拼接条件
if (!StringUtils.isEmpty(userName)) {
wrapper.eq("USERNAME", userName);
}
//设置需要查询的字段
wrapper.select("IDENTITYCARD");
SysUser user = sysUsersService.getOne(wrapper);
return MapRestResult.build(200,"成功",1,user.getIdentitycard());
}
// 根据身份证查询全省案件
//@OperLog(message = "全省案件",operation = OperationType.QUERY)
@ApiOperation(value = "全省案件")
@PostMapping("/qsAjxx")
public MapRestResult qsAjxx(@ApiParam(name = "zjhm",value = "zjhm",required = true)
@RequestParam String zjhm) {
List<Map<String,Object>> asjList = tbStAsjService.getAsjxxByZjhm(zjhm);
return MapRestResult.build(200,"成功",asjList.size(),asjList);
}
// 根据身份证查询全国案件
//@OperLog(message = "全国案件",operation = OperationType.QUERY)
@ApiOperation(value = "全国案件")
@PostMapping("/qgAjxx")
public MapRestResult qgAjxx(@ApiParam(name = "zjhm",value = "zjhm",required = true)
@RequestParam String zjhm) {
List<Map<String,Object>> asjList = tbStAsjService.getqgAsjxxByZjhm(zjhm,ssdw.substring(0,2));
return MapRestResult.build(200,"成功",asjList.size(),asjList);
}
}
package com.founder.view.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.util.KeyUtil;
import com.founder.commonutils.util.LngLonUtil;
import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.commonutils.viewEntity.TbStLayerData;
import com.founder.view.service.TbStLayerDataService;
import com.founder.view.service.TbStLayerService;
import io.swagger.annotations.Api;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Api(description = "图层数据")
@RestController
@RequestMapping("/tbStLayer")
public class TbStLayerController {
@Resource
TbStLayerDataService tbStLayerDataService;
@Resource
TbStLayerService tbStLayerService;
@RequestMapping("getLayer")
public MapRestResult getLayer() {
return null;
@RequestMapping("/getLayers")
public MapRestResult getLayers(@RequestBody TbStLayer tbStLayer) {
return tbStLayerService.getLayers(tbStLayer,tbStLayer.getPageNo(),tbStLayer.getSize());
}
}
package com.founder.view.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.asjEntity.TbXwAsjbz;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 案事件标注Mapper 接口
* </p>
*
* @author yangyang
* @since 2021-03-05
*/
@Mapper
public interface TbStAsjBzMapper extends BaseMapper<TbXwAsjbz> {
}
package com.founder.view.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.asjEntity.CbxszAndXlaj;
import com.founder.commonutils.asjEntity.TbStAsj;
import com.founder.commonutils.publicEntity.Receiving;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* <p>
* 案事件基本信息 Mapper 接口
* </p>
*
* @author Guojunfeng
* @since 2021-03-03
*/
@Mapper
public interface TbStAsjMapper extends BaseMapper<TbStAsj> {
List<String> getXszajbhByAsjbh(@Param(value = "asjbh")String asjbh);
List<String> getXlajbhByAsjbh(@Param(value = "asjbh")String asjbh);
List<CbxszAndXlaj> GetlistXszXgaj(Map map);
List<CbxszAndXlaj> GetlistCbzXgaj(Map map);
String getNameByCode(Map<String,String> map);
List<TbStAsj> selectAsjxxByReceivingList(Receiving receiving);
List<TbStAsj> selectTlAsjxx(Receiving receiving);
List<Map<String,Object>> getAsjxxByZjhm(@Param(value = "zjhm")String zjhm);
}
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.viewEntity.TbStLayerData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 用户登录 Mapper 接口
......@@ -18,4 +20,6 @@ public interface TbStLayerDataMapper extends BaseMapper<TbStLayerData> {
void deleteByGlId(String layerId);
List<TbStLayerData> selectByGlId(String layerId);
}
package com.founder.view.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.commonutils.viewEntity.TbStLayerData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 用户登录 Mapper 接口
......@@ -18,4 +22,5 @@ import org.apache.ibatis.annotations.Mapper;
public interface TbStLayerMapper extends BaseMapper<TbStLayer> {
List<TbStLayer> selectLayers(TbStLayer tbStLayer);
}
<?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.founder.view.mapper.AccidentPointMapper">
</mapper>
<?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.founder.view.mapper.TbStAsjBzMapper">
</mapper>
<?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.founder.view.mapper.TbStAsjMapper">
<select id="getXszajbhByAsjbh" parameterType="java.lang.String" resultType="String">
select
distinct XSZAJBH
from TB_YW_XSZ_CBAJ where 1=1 AND XXSC_PDBZ = 0
<if test="asjbh!=null and asjbh!=''">
and asjbh = #{asjbh}
</if>
</select>
<select id="getXlajbhByAsjbh" parameterType="java.lang.String" resultType="String">
select
distinct XLAJBH
from TB_YW_CBZ_CBAJ where 1=1 AND XXSC_PDBZ = 0
<if test="asjbh!=null and asjbh!=''">
and asjbh = #{asjbh}
</if>
</select>
<select id="GetlistXszXgaj" parameterType="java.util.Map" resultType="com.founder.commonutils.asjEntity.CbxszAndXlaj">
select
distinct a.ASJBH,
a.CBLX,
(select name from sys_dictitem where groupid='CODE_CBYP_CBLX' and code=a.CBLX) as cblx_str,
b.AJMC as ajmc,
b.ASJFSDD_DQJD as x,
b.ASJFSDD_DQWD as y,
to_char(b.JYAQ) as jyaq,
to_char(b.ASJFSSJ_ASJFSKSSJ,'yyyy-MM-dd hh24:mi:ss') as asjfssj_asjfskssj,
(select name from SYS_DICTITEM where groupid='CODE_ZCJDDM' AND code = b.ZCJDDM) as zcjdmc,
(select name from SYS_DICTITEM where groupid='CODE_AJZLB' AND code = bz.AJZLB) as ajzlbmc,
(select name from SYS_DICTITEM where groupid='CODE_AJXZLB' AND code = bz.AJXZLB) as ajxzlbmc,
(select name from SYS_DICTITEM where groupid='CODE_XALBDMBCMS' AND code = bz.XALBDMBCMS) as xalbdmbcmsmc
from TB_YW_XSZ_CBAJ a,TB_ST_ASJ b,TB_ST_ASJBZ bz where 1=1 AND a.asjbh = b.asjbh
AND a.asjbh = bz.asjbh
AND a.XXSC_PDBZ = 0
AND a.ASJBH != #{asjbhs}
AND a.XSZAJBH IN
<foreach collection="listxszajbh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="GetlistCbzXgaj" parameterType="java.util.Map" resultType="com.founder.commonutils.asjEntity.CbxszAndXlaj">
select
distinct a.ASJBH,
a.CBLX,
b.AJMC as ajmc,
b.ASJFSDD_DQJD as x,
b.ASJFSDD_DQWD as y,
to_char(b.JYAQ) as jyaq,
to_char(b.ASJFSSJ_ASJFSKSSJ,'yyyy-MM-dd hh24:mi:ss') as asjfssj_asjfskssj,
(select name from SYS_DICTITEM where groupid='CODE_ZCJDDM' AND code = b.ZCJDDM) as zcjdmc,
(select name from SYS_DICTITEM where groupid='CODE_AJZLB' AND code = bz.AJZLB) as ajzlbmc,
(select name from SYS_DICTITEM where groupid='CODE_AJXZLB' AND code = bz.AJXZLB) as ajxzlbmc,
(select name from SYS_DICTITEM where groupid='CODE_XALBDMBCMS' AND code = bz.XALBDMBCMS) as xalbdmbcmsmc
from TB_YW_CBZ_CBAJ a,TB_ST_ASJ b,TB_ST_ASJBZ bz where 1=1 AND a.asjbh = b.asjbh
AND a.asjbh = bz.asjbh
AND a.XXSC_PDBZ = 0
AND a.ASJBH != #{asjbhs}
AND a.XLAJBH IN
<foreach collection="listXlajbh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- 根据code和groupid查询name值-->
<select id="getNameByCode" parameterType="java.util.Map" resultType="java.lang.String">
select name from SYS_DICTITEM where scbz='0'
<if test="groupid!=null and groupid!=''">and groupid = #{groupid}</if>
<if test="code!=null and code!=''">and code = #{code}</if>
</select>
<select id="selectAsjxxByReceivingList" parameterType="com.founder.commonutils.publicEntity.Receiving" resultType="com.founder.commonutils.asjEntity.TbStAsj">
SELECT
KYMYQZ_WPSL
,T.ASJBH
,KYZZQZ_WPSL
,KYFZQZ_WPSL
,KYQTQZ_WPSL
,SLSJ
,SLDW_GAJGJGDM
,SLDW_GAJGMC
,LARQ
,LADW_GAJGJGDM
,LADW_GAJGMC
,ZARY_RS
,SJCWJZRMBY
,ZCZJ_ZCXWYJMS
,ZCZJ_ZXSJ01
,ZCZJDW_GAJGJGDM
,ZCZJDW_GAJGMC
,YSSCQSRQ
,YSSCQSAJSCFHJDDM
,SFCXAJ_PDBZ
,CXAJYYDM
,CXAJDW_GAJGJGDM
,CXAJDW_GAJGMC
,CXAJRQ
,XSAJXSGZJGDM
,ZBR_XM
,ZBR_GMSFHM
,ZBR_LXDH
,XBR_XM
,XBR_GMSFHM
,XBR_LXDH
,XSJSFZR_XM
,XSJSFZR_GMSFHM
,XSJSFZR_LXDH
,GAJGFZR_XM
,GAJGFZR_GMSFHM
,GAJGFZR_LXDH
,T.JJBH
,XCKYBH
,ASJLYDM
,XSJQLBDM
,ZCJDDM
,XSAJLASCJGDM
,AJLBDM
,ZATZ_JYQK
,TSSDDM
,ZATZZDFL_JYQK
,ZATZBCMS_JYQK
,ZATZ_AJZATZJHBD
,AJMC
,FXASJSJ
,FXASJDD_XZQHDM
,FXASJDD_DZMC
,ASJFSSJ_ASJFSKSSJ
,ASJFSSJ_ASJFSJSSJ
,ASJFSSJ_RSDDM
,ASJFSSJ_ZASJ_ZASJLBDM
,ASJFSSJ_ZASJ_DMBCMS
,ASJFSDD_XZQHDM
,ASJFSDD_DZMC
,ASJFSDD_DQJD
,ASJFSDD_DQWD
,ASJFSDD_DQJD as x
,ASJFSDD_DQWD as y
,ASJFSDD_DYLBDM
,ASJFSDD_SACS_SACSLBDM
,ASJFSDD_SACS_DMBCMS
,ASJFSDD_KJBW_KJBWLBDM
,ASJFSDD_KJBW_DMBCMS
,ASJFSDD_SFJZWN_PDBZ
,ASJFSDD_JZWCS
,ASJFSDD_ASJFSLC
,ASJFSDD_SFZLZZ_PDBZ
,JYAQ
,SFSQ_PDBZ
,SFSB_PDBZ
,SFMA_PDBZ
,SFSH_PDBZ
,SFSJDQPCL_PDBZ
,SFSW_PDBZ
,SFGM_PDBZ
,SWASJSWQK
,ASJDBJBDM
,LLFS_LLFSDM
,LLFS_DMBCMS
,LLSJ
,SY_JYQK
,FZXYRTSXW_FZXYRTSXWDM
,FZXYRTSXW_DMBCMS
,FZXYRSXZAHJQK
,QTSDTD_JYQK
,ASJFSSJFX_ASJFSKSSJ
,ASJFSSJFX_ASJFSJSSJ
,ZARFX_RSXX
,ZARFX_RSSX
,FZXYRTZ_JYQK
,FZXYRTSZC_FZXYRTSZCDM
,FZXYRTSZC_DMBCMS
,ZAGJ_SAWPDM
,ZAGJ_JYQK
,ZADJMS
,ZAMDMS
,KJFWDM
,LCZA_JYQK
,JHZA_JYQK
,GTFZFZXYRZHXSDM
,GTFZFZXYRGC_GTFZFZXYRGCDM
,GTFZFZXYRGC_DMBCMS
,XZWPFX_SAWP_SAWPDM
,XZWPFX_SAWP_DMBCMS
,SSWPQX_JYQK
,FZXYRYLWP_JYQK
,XCKYWP_JYQK
,FXXS_JYQK
,ASJSWRY_RS
,ASJSSRY_RS
,ASJSSCW_JYQK
,SSJZRMBY
,KYZSQZ_WPSL
,JJSD_JJSDDM
,JSSD_JSSDDM
,ZPSD_ZPSDDM
,LKJZKJFS_LKJZKJFSDM
,ZAZBSD_ZAZBSDDM
,JRJZKJFSJSD_JRJZKJFSJSDDM
<if test="ssdw != '441900000000'">
,(select name from sys_dictitem where groupid='CODE_AJLB' and code=T.ajlbdm) as ajlbdmStr
</if>
FROM tb_st_asj T WHERE 1=1
<include refid="queryWhereByReceiving"/>
</select>
<sql id="queryWhereByReceiving">
<if test="asjbh!= null">
AND T.ASJBH= #{ asjbh , jdbcType=VARCHAR }
</if>
<if test="ajlbdm!= null">
AND T.AJLBDM= #{ ajlbdm , jdbcType=VARCHAR }
</if>
<if test="jyaq!= null">
AND T.JYAQ LIKE '%' || #{jyaq , jdbcType=VARCHAR } || '%'
</if>
<if test="asjfssj_asjfskssj_start!= null">
AND T.ASJFSSJ_ASJFSKSSJ <![CDATA[>=]]> to_date(#{asjfssj_asjfskssj_start},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="asjfssj_asjfskssj_end!= null">
AND T.ASJFSSJ_ASJFSKSSJ <![CDATA[<]]> to_date(#{asjfssj_asjfskssj_end},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="ajslsj_start!= null">
AND T.SLSJ <![CDATA[>=]]> to_date(#{ajslsj_start},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="ajslsj_end!= null">
AND T.SLSJ <![CDATA[<]]> to_date(#{ajslsj_end},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="larq_start!= null">
AND T.LARQ <![CDATA[>=]]> to_date(#{larq_start},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="larq_end!= null">
AND T.LARQ <![CDATA[<]]> to_date(#{larq_end},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="ladw_gajgjgdm!= null">
AND T.LADW_GAJGJGDM= #{ ladw_gajgjgdm , jdbcType=VARCHAR }
</if>
<if test="afdxzqhdm!= null">
AND T.ASJFSDD_XZQHDM= #{ afdxzqhdm , jdbcType=VARCHAR }
</if>
<if test="asjfsd_dzmc!= null">
AND T.ASJFSDD_DZMC LIKE '%' || #{asjfsd_dzmc , jdbcType=VARCHAR } || '%'
</if>
<if test="x!= null and x!=0.0">
AND T.ASJFSDD_DQJD= #{ x , jdbcType=DOUBLE }
</if>
<if test="y!= null and y!=0.0">
AND T.ASJFSDD_DQWD= #{ y , jdbcType=DOUBLE }
</if>
<if test="zcjddm!= null">
AND T.ZCJDDM= #{ zcjddm , jdbcType=VARCHAR }
</if>
<if test="xckybh!= null">
AND T.XCKYBH= #{ xckybh , jdbcType=VARCHAR }
</if>
</sql>
<!--同类案件-->
<select id="selectTlAsjxx" parameterType="com.founder.commonutils.publicEntity.Receiving" resultType="com.founder.commonutils.asjEntity.TbStAsj">
SELECT
KYMYQZ_WPSL
,T.ASJBH
,KYZZQZ_WPSL
,KYFZQZ_WPSL
,KYQTQZ_WPSL
,SLSJ
,SLDW_GAJGJGDM
,SLDW_GAJGMC
,LARQ
,LADW_GAJGJGDM
,LADW_GAJGMC
,ZARY_RS
,SJCWJZRMBY
,ZCZJ_ZCXWYJMS
,ZCZJ_ZXSJ01
,ZCZJDW_GAJGJGDM
,ZCZJDW_GAJGMC
,YSSCQSRQ
,YSSCQSAJSCFHJDDM
,SFCXAJ_PDBZ
,CXAJYYDM
,CXAJDW_GAJGJGDM
,CXAJDW_GAJGMC
,CXAJRQ
,XSAJXSGZJGDM
,ZBR_XM
,ZBR_GMSFHM
,ZBR_LXDH
,XBR_XM
,XBR_GMSFHM
,XBR_LXDH
,XSJSFZR_XM
,XSJSFZR_GMSFHM
,XSJSFZR_LXDH
,GAJGFZR_XM
,GAJGFZR_GMSFHM
,GAJGFZR_LXDH
,T.JJBH
,XCKYBH
,ASJLYDM
,XSJQLBDM
,ZCJDDM
,XSAJLASCJGDM
,AJLBDM
,ZATZ_JYQK
,TSSDDM
,ZATZZDFL_JYQK
,ZATZBCMS_JYQK
,ZATZ_AJZATZJHBD
,AJMC
,FXASJSJ
,FXASJDD_XZQHDM
,FXASJDD_DZMC
,ASJFSSJ_ASJFSKSSJ
,ASJFSSJ_ASJFSJSSJ
,ASJFSSJ_RSDDM
,ASJFSSJ_ZASJ_ZASJLBDM
,ASJFSSJ_ZASJ_DMBCMS
,ASJFSDD_XZQHDM
,ASJFSDD_DZMC
,ASJFSDD_DQJD
,ASJFSDD_DQWD
,ASJFSDD_DQJD as x
,ASJFSDD_DQWD as y
,ASJFSDD_DYLBDM
,ASJFSDD_SACS_SACSLBDM
,ASJFSDD_SACS_DMBCMS
,ASJFSDD_KJBW_KJBWLBDM
,ASJFSDD_KJBW_DMBCMS
,ASJFSDD_SFJZWN_PDBZ
,ASJFSDD_JZWCS
,ASJFSDD_ASJFSLC
,ASJFSDD_SFZLZZ_PDBZ
,JYAQ
,SFSQ_PDBZ
,SFSB_PDBZ
,SFMA_PDBZ
,SFSH_PDBZ
,SFSJDQPCL_PDBZ
,SFSW_PDBZ
,SFGM_PDBZ
,SWASJSWQK
,ASJDBJBDM
,LLFS_LLFSDM
,LLFS_DMBCMS
,LLSJ
,SY_JYQK
,FZXYRTSXW_FZXYRTSXWDM
,FZXYRTSXW_DMBCMS
,FZXYRSXZAHJQK
,QTSDTD_JYQK
,ASJFSSJFX_ASJFSKSSJ
,ASJFSSJFX_ASJFSJSSJ
,ZARFX_RSXX
,ZARFX_RSSX
,FZXYRTZ_JYQK
,FZXYRTSZC_FZXYRTSZCDM
,FZXYRTSZC_DMBCMS
,ZAGJ_SAWPDM
,ZAGJ_JYQK
,ZADJMS
,ZAMDMS
,KJFWDM
,LCZA_JYQK
,JHZA_JYQK
,GTFZFZXYRZHXSDM
,GTFZFZXYRGC_GTFZFZXYRGCDM
,GTFZFZXYRGC_DMBCMS
,XZWPFX_SAWP_SAWPDM
,XZWPFX_SAWP_DMBCMS
,SSWPQX_JYQK
,FZXYRYLWP_JYQK
,XCKYWP_JYQK
,FXXS_JYQK
,ASJSWRY_RS
,ASJSSRY_RS
,ASJSSCW_JYQK
,SSJZRMBY
,KYZSQZ_WPSL
,JJSD_JJSDDM
,JSSD_JSSDDM
,ZPSD_ZPSDDM
,LKJZKJFS_LKJZKJFSDM
,ZAZBSD_ZAZBSDDM
,JRJZKJFSJSD_JRJZKJFSJSDDM
<if test="ssdw != '441900000000'">
,(select name from sys_dictitem where groupid='CODE_AJLB' and code=T.ajlbdm) as ajlbdmStr
</if>
, (select name from sys_dictitem where groupid='CODE_ZCJDDM' and code=T.ZCJDDM) as zcjddmStr
FROM tb_st_asj T
left join tb_st_asjbz T1 on T1.asjbh=T.asjbh
WHERE 1=1 and ASJFSDD_DQJD is not null and ASJFSDD_DQWD is not null
<include refid="queryWhereByTlasj"/>
</select>
<sql id="queryWhereByTlasj">
<if test="asjfssj_asjfskssj_start!= null">
AND T.ASJFSSJ_ASJFSKSSJ <![CDATA[>=]]> to_date(#{asjfssj_asjfskssj_start},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="asjfssj_asjfskssj_end!= null">
AND T.ASJFSSJ_ASJFSKSSJ <![CDATA[<]]> to_date(#{asjfssj_asjfskssj_end},'yyyy-MM-dd hh24:mi:ss')
</if>
<if test="qsjd!=null and qsjd!='' and jsjd!=null and jsjd!='' and qswd!=null and qswd!='' and jswd!=null and jswd!=''">
AND T.ASJFSDD_DQJD <![CDATA[>=]]>#{qsjd,jdbcType=VARCHAR} AND T.ASJFSDD_DQJD <![CDATA[<=]]>#{jsjd,jdbcType=VARCHAR}
AND T.ASJFSDD_DQWD <![CDATA[>=]]>#{qswd,jdbcType=VARCHAR} AND T.ASJFSDD_DQWD <![CDATA[<=]]>#{jswd,jdbcType=VARCHAR}
</if>
<if test="ajzlb!= null and ajzlb!=''" >
AND T1.ajzlb= #{ ajzlb , jdbcType=VARCHAR }
</if>
<if test="ajxzlb!= null and ajxzlb!=''" >
AND T1.ajxzlb= #{ ajxzlb , jdbcType=VARCHAR }
</if>
<if test="xalbdmbcms!= null and xalbdmbcms!=''">
AND T1.xalbdmbcms= #{ xalbdmbcms , jdbcType=VARCHAR }
</if>
<if test="gjc!= null and gjc.length>0">
and(
<foreach collection="gjc" item="item" index="index" separator=" or ">
T.jyaq like '%${item}%'
</foreach>
)
</if>
<if test="zcjddm!= null and zcjddm!=''">
and T.zcjddm in (${zcjddm})
</if>
</sql>
<select id="getAsjxxByZjhm" parameterType="java.lang.String" resultType="map">
SELECT
T.asjbh AS asjbh,
TO_CHAR(XYR.ZHRQ,'YYYY-MM-DD HH24:mi:ss') AS zhrq,
(select name from SYS_DICTITEM where groupid='CODE_DAZT' AND code = XYR.zhfzxyr_Fzxyrdaztdm) AS zhfzxyrFzxyrdaztdmMc,
T.ajmc AS ajmc,
(select name from SYS_DICTITEM where groupid='CODE_AJLB' AND code = T.ajlbdm) AS ajlbdmMc,
TO_CHAR(T.asjfssj_Asjfskssj,'YYYY-MM-DD HH24:mi:ss') AS asjfssjAsjfskssj,
TO_CHAR(T.larq,'YYYY-MM-DD HH24:mi:ss') AS larq,
T.ZUZDW_ZBR_XM AS zuzdwZbrXm,
(select name from SYS_DICTITEM where groupid='CODE_UNIT' AND code = T.zuzdw_Gajgjgdm) AS zuzdwGajgjgdmMc,
(select name from SYS_DICTITEM where groupid='CODE_ZCJDDM' AND code = T.zcjddm) AS zcjddmMc,
(select name from SYS_DICTITEM where groupid='CODE_UNIT' AND code = T.ladw_Gajgjgdm) AS ladwGajgjgdmMc,
ASJBZ.ajzlb AS ajzlb,
(select name from SYS_DICTITEM where groupid='CODE_AJZLB' AND code = ASJBZ.ajzlb) AS ajzlbMc,
ASJBZ.ajxzlb AS ajxzlb,
(select name from SYS_DICTITEM where groupid='CODE_AJXZLB' AND code = ASJBZ.ajxzlb) AS ajxzlbMc,
ASJBZ.xalbdmbcms AS xalbdmbcms,
(select name from SYS_DICTITEM where groupid='CODE_XALBDMBCMS' AND code = ASJBZ.xalbdmbcms) AS xalbdmbcmsMc
FROM TB_ST_ASJ T,TB_ST_ASJBZ ASJBZ,TB_XW_ZBFZXYR XYR
where
T.ASJBH = ASJBZ.ASJBH(+)
AND
T.ASJBH = XYR.ASJBH
AND
T.XXSC_PDBZ = 0
AND
XYR.XXSC_PDBZ = 0
<if test="zjhm != null and zjhm != ''">
and XYR.zhfzxyr_Cyzj_Zjhm = #{zjhm}
</if>
</select>
</mapper>
......@@ -4,4 +4,7 @@
<delete id="deleteByGlId" parameterType="String">
delete from tb_st_layer_data where gl_xxzjbh = #{layerId}
</delete>
<select id="selectByGlId" parameterType="String" resultType="com.founder.commonutils.viewEntity.TbStLayerData">
select * from tb_st_layer_data where gl_xxzjbh = #{layerId}
</select>
</mapper>
<?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.founder.view.mapper.TbStLayerMapper">
<resultMap id="tbStLayer" type="com.founder.commonutils.viewEntity.TbStLayer">
<result column="xxzjbh" property="xxzjbh" jdbcType="VARCHAR"></result>
<result column="name" property="name" jdbcType="VARCHAR"></result>
<result column="threshold" property="threshold" jdbcType="DOUBLE"></result>
<result column="lrr" property="lrr" jdbcType="VARCHAR"></result>
<result column="lrdwdm" property="lrdwdm" jdbcType="VARCHAR"></result>
<result column="lrdwdc" property="lrdwdc" jdbcType="VARCHAR"></result>
<result column="lrsj" property="lrsj" jdbcType="TIMESTAMP"></result>
<result column="gxr" property="gxr" jdbcType="VARCHAR"></result>
<result column="gxdwdm" property="gxdwdm" jdbcType="VARCHAR"></result>
<result column="gxdwdc" property="gxdwdc" jdbcType="VARCHAR"></result>
<result column="gxsj" property="gxsj" jdbcType="VARCHAR"></result>
<result column="count" property="count" jdbcType="TIMESTAMP"></result>
</resultMap>
<select id="selectLayers" parameterType="com.founder.commonutils.viewEntity.TbStLayer" resultMap="tbStLayer">
select * from tb_st_layer t1 where 1=1
<if test="lrr!='' and lrr!=null">
and t1.lrr like CONCAT('%',#{lrr},'%')
</if>
<if test="startTime!='' and startTime!=null">
and t1.lrsj <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime!='' and endTime!=null">
and t1.lrsj <![CDATA[<=]]> #{endTime}
</if>
</select>
</mapper>
package com.founder.view.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.viewEntity.AccidentPoint;
public interface AccidentPointService extends IService<AccidentPoint> {
}
package com.founder.view.service;
import java.util.List;
public interface QueryByTimeUserService {
public List queryByTimeUser(String starTime, String endTime, String userName);
}
package com.founder.view.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.publicEntity.SysUser;
public interface SysUsersService extends IService<SysUser> {
}
package com.founder.view.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.asjEntity.TbXwAsjbz;
/**
* <p>
* 案事件基本信息 服务类
* </p>
*
* @author yangyang
* @since 2021-03-0
*/
public interface TbStAsjBzService extends IService<TbXwAsjbz> {
}
package com.founder.view.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.asjEntity.CbxszAndXlaj;
import com.founder.commonutils.asjEntity.TbStAsj;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.Receiving;
import java.util.List;
import java.util.Map;
/**
* <p>
* 案事件基本信息 服务类
* </p>
*
* @author Guojunfeng
* @since 2021-03-03
*/
public interface TbStAsjService extends IService<TbStAsj> {
List<String> getXszajbhByAsjbh(String asjbh);
List<String> getXlajbhByAsjbh(String asjbh);
List<CbxszAndXlaj> GetlistXszXgaj(Map map);
List<CbxszAndXlaj> GetlistCbzXgaj(Map map);
String getNameByCode(Map<String,String> map);
List<TbStAsj> selectAsjxxList(Receiving receiving);
MapRestResult selectTlAsjxxList(Receiving receiving);
List<Map<String,Object>> getAsjxxByZjhm(String zjhm);
List<Map<String,Object>> getqgAsjxxByZjhm(String zjhm,String ssdw);
}
package com.founder.view.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.commonutils.viewEntity.TbStLayerData;
import java.util.List;
public interface TbStLayerService extends IService<TbStLayer> {
MapRestResult<TbStLayer> getLayers(TbStLayer tbStLayer, Integer pageNo, Integer size);
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.viewEntity.AccidentPoint;
import com.founder.view.mapper.AccidentPointMapper;
import com.founder.view.service.AccidentPointService;
import org.springframework.stereotype.Service;
@Service
public class AccidentPointServiceImpl extends ServiceImpl<AccidentPointMapper, AccidentPoint> implements AccidentPointService {
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.viewEntity.TbStLayerData;
import com.founder.commonutils.viewEntity.LayerInfo;
import com.founder.view.mapper.TbStLayerDataMapper;
import com.founder.view.service.QueryByTimeUserService;
import org.springframework.stereotype.Service;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
@Service("queryByTimeUserService")
public class QueryByTimeUserServiceImpl extends ServiceImpl<TbStLayerDataMapper, TbStLayerData> implements QueryByTimeUserService {
@Override
public List<LayerInfo> queryByTimeUser(String starTime, String endTime, String userName) {
List<LayerInfo> resList = new ArrayList<LayerInfo>();
Connection con=null;//连接接口
PreparedStatement pstmt=null;//准备语句接口
ResultSet rs=null;//结果集
try {
Class.forName("com.mysql.cj.jdbc.Driver");//加载驱动类
//test数据库地址
String url="jdbc:mysql://47.92.48.137:3900/gkpt?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai";
con= DriverManager.getConnection(url,"root","gkptCcYy123");//连接数据库
String sql = "SELECT count(*) as count,t2.name,t2.lrr,t1.* " +
"FROM(select * from tb_st_layer_data WHERE time > ? and time <= ?) as t1 left join tb_st_layer t2 on t1.gl_xxzjbh=t2.xxzjbh WHERE t2.lrr=?";
pstmt=con.prepareStatement(sql);//创建准备语句对象
//pstmt.setString(1,"张三");//查询条件,1指的是第一个?,有几个?必须指定几个值。
//pstmt.setString(1,"男");
pstmt.setString(1,starTime);//查询条件
pstmt.setString(2,endTime);
pstmt.setString(3,userName);
rs=pstmt.executeQuery();
LayerInfo layerInfo = new LayerInfo();
while (rs.next()){//按行输出
layerInfo.setCount(rs.getInt("count"));
layerInfo.setName(rs.getString("name"));
layerInfo.setLrr(rs.getString("lrr"));
layerInfo.setXxzjbh(rs.getString("xxzjbh"));
layerInfo.setGl_xxzjbh(rs.getString("gl_xxzjbh"));
layerInfo.setX(rs.getBigDecimal("x"));
layerInfo.setY(rs.getBigDecimal("y"));
layerInfo.setTitle(rs.getString("title"));
layerInfo.setTime(rs.getString("time"));
resList.add(layerInfo);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
} finally{
if (rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if(pstmt!=null){
try {
pstmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (con!=null){
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
return resList;
}
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.view.mapper.SysUsersMapper;
import com.founder.view.service.SysUsersService;
import com.founder.commonutils.publicEntity.SysUser;
import org.springframework.stereotype.Service;
@Service
public class SysUsersServiceImpl extends ServiceImpl<SysUsersMapper, SysUser> implements SysUsersService {
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.view.mapper.TbStAsjBzMapper;
import com.founder.view.service.TbStAsjBzService;
import com.founder.commonutils.asjEntity.TbXwAsjbz;
import org.springframework.stereotype.Service;
/**
* <p>
* 案事件基本信息 服务实现类
* </p>
*
* @author yangyang
* @since 2021-03-03
*/
@Service
public class TbStAsjBzServiceImpl extends ServiceImpl<TbStAsjBzMapper, TbXwAsjbz> implements TbStAsjBzService {
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.view.mapper.TbStAsjMapper;
//import com.founder.view.qgxzMapper.TbStAsjqgMapper;
import com.founder.view.service.TbStAsjService;
import com.founder.commonutils.asjEntity.CbxszAndXlaj;
import com.founder.commonutils.asjEntity.TbStAsj;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.Receiving;
import com.founder.commonutils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 案事件基本信息 服务实现类
* </p>
*
* @author Guojunfeng
* @since 2021-03-03
*/
@Service
public class TbStAsjServiceImpl extends ServiceImpl<TbStAsjMapper, TbStAsj> implements TbStAsjService {
@Autowired
private TbStAsjMapper tbStAsjMapper;
//@Autowired
//private TbStAsjqgMapper tbStAsjqgMapper;
@Override
public List<String> getXszajbhByAsjbh(String asjbh) {
return tbStAsjMapper.getXszajbhByAsjbh(asjbh);
}
@Override
public List<String> getXlajbhByAsjbh(String asjbh) {
return tbStAsjMapper.getXlajbhByAsjbh(asjbh);
}
@Override
public List<CbxszAndXlaj> GetlistXszXgaj(Map map) {
return tbStAsjMapper.GetlistXszXgaj(map);
}
@Override
public List<CbxszAndXlaj> GetlistCbzXgaj(Map map) {
return tbStAsjMapper.GetlistCbzXgaj(map);
}
@Override
public String getNameByCode(Map<String,String> map){
return tbStAsjMapper.getNameByCode(map);
}
@Override
public List<TbStAsj> selectAsjxxList(Receiving receiving) {
return tbStAsjMapper.selectAsjxxByReceivingList(receiving);
}
//utils.StringUtil
@Override
public MapRestResult selectTlAsjxxList(Receiving receiving) {
if(StringUtil.isEmpty(receiving.getQsjd())||StringUtil.isEmpty(receiving.getJsjd())||StringUtil.isEmpty(receiving.getQswd())||StringUtil.isEmpty(receiving.getJswd())){
return MapRestResult.error("起始经纬度不能为空");
}else if(StringUtil.isEmpty(receiving.getAsjfssj_asjfskssj_start())||StringUtil.isEmpty(receiving.getAsjfssj_asjfskssj_end())){
return MapRestResult.error("时间段不能为空");
}else if(StringUtil.isEmpty(receiving.getAjzlb())&&StringUtil.isEmpty(receiving.getAjxzlb())&&StringUtil.isEmpty(receiving.getXalbdmbcms())){
return MapRestResult.error("案件标签为空,无法推算同类案件");
}else{
return MapRestResult.build(200,"同类案件查询成功",tbStAsjMapper.selectTlAsjxx(receiving));
}
}
@Override
public List<Map<String, Object>> getAsjxxByZjhm(String zjhm) {
return tbStAsjMapper.getAsjxxByZjhm(zjhm);
}
@Override
public List<Map<String, Object>> getqgAsjxxByZjhm(String zjhm, String ssdw) {
return null;
}
/*@Override
public List<Map<String, Object>> getqgAsjxxByZjhm(String zjhm,String ssdw) {
return tbStAsjqgMapper.getqgAsjxxByZjhm(zjhm,ssdw);
}*/
}
package com.founder.view.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.viewEntity.TbStLayer;
import com.founder.commonutils.viewEntity.TbStLayerData;
import com.founder.view.mapper.TbStLayerDataMapper;
import com.founder.view.mapper.TbStLayerMapper;
import com.founder.view.service.TbStLayerDataService;
import com.founder.view.service.TbStLayerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class TbStLayerServiceImpl extends ServiceImpl<TbStLayerMapper, TbStLayer> implements TbStLayerService {
@Resource
TbStLayerMapper tbStLayerMapper;
@Resource
TbStLayerDataMapper tbStLayerDataMapper;
@Override
public MapRestResult<TbStLayer> getLayers(TbStLayer tbStLayer, Integer pageNo, Integer size) {
try {
pageNo = 1;
size= 10;
PageHelper.startPage(pageNo,size);
//List<TbStLayer> tbStLayerList = new ArrayList<>();
List<TbStLayer> tbStLayers = tbStLayerMapper.selectLayers(tbStLayer);
if(tbStLayers != null && tbStLayers.size() > 0){
for (TbStLayer stLayer : tbStLayers) {
List<TbStLayerData> tbStLayerDataList = tbStLayerDataMapper.selectByGlId(stLayer.getXxzjbh());
tbStLayer.setCount(tbStLayerDataList.size());
}
}
PageInfo<TbStLayer> pageInfo = new PageInfo<>(tbStLayers);
return MapRestResult.build(200,"图层信息查询成功!",pageInfo.getTotal(),pageInfo);
} catch (Exception e) {
e.printStackTrace();
return MapRestResult.build(500,"图层信息查询失败!",null,null);
}
}
}
......@@ -9,8 +9,21 @@ import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.DateType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.founder.commonutils.util.KeyUtil;
import com.founder.commonutils.viewEntity.TbStLayerData;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.junit.Test;
import java.io.FileInputStream;
import java.io.InputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
* @author
* @since 2018/12/13
......@@ -87,4 +100,55 @@ public class CodeGenerator {
// 6、执行
mpg.execute();
}
@Test
public void testExcel() throws Exception {
InputStream is = new FileInputStream("C:\\Users\\JBB\\Desktop\\工作目录\\excel\\模板.xlsx");
XSSFWorkbook sheets = new XSSFWorkbook(is);
XSSFSheet sheetAt = sheets.getSheetAt(0);
//获取excel有多少行
int lastRowNum = sheetAt.getLastRowNum();
List<TbStLayerData> pointList = new ArrayList<>();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (int i = 1; i <= lastRowNum; i++) {
TbStLayerData point = new TbStLayerData();
String id = KeyUtil.getUUIDKey("D");
point.setXxzjbh(id);
//point.setGl_xxzjbh(layerId);
XSSFRow row = sheetAt.getRow(i);
//获取excel有多少列
short lastCellNum = row.getLastCellNum();
//判断经纬度是否符合要求
//检车一下数据是否能正常读取.....
/*double jd = 0.0;
double wd = 0.0;*/
String jdStr = "";
String wdStr = "";
String titleStr = "";
String dateStr = "";
if (row.getCell(0) != null && row.getCell(1) != null) {
row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
row.getCell(1).setCellType(Cell.CELL_TYPE_STRING);
/*int cellType = row.getCell(0).getCellType();
int cellType2 = row.getCell(1).getCellType();
if (cellType == 0) {
jd = row.getCell(0).getNumericCellValue();
} else if (cellType == 1) {
jdStr = row.getCell(0).getStringCellValue();
point.setxStr(jdStr);
}
if (cellType2 == 0) {
wd = row.getCell(1).getNumericCellValue();
} else if (cellType2 == 1) {
wdStr = row.getCell(1).getStringCellValue();
point.setyStr(wdStr);
}*/
jdStr = row.getCell(0).getStringCellValue();
wdStr = row.getCell(1).getStringCellValue();
titleStr = row.getCell(2).getStringCellValue();
dateStr = row.getCell(3).getStringCellValue();
System.out.println(jdStr + "====" + wdStr + "=====" + titleStr + "=========" + dateStr);
//System.out.println(jd + "====" + jdStr + "======" + wd + "====" + wdStr + "=====" + titleStr + "=========" + dateStr);
}
}
}
}
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