冲突解决

This commit is contained in:
qqGroup0 2023-04-11 09:51:08 +08:00
commit 9d750f10d6
12 changed files with 331 additions and 41 deletions

View File

@ -0,0 +1,127 @@
package com.kening.vordm.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName disaster_info_vo
*/
@TableName(value ="disaster_info_vo")
@Data
public class DisasterInfoVo implements Serializable {
/**
* 唯一值
*/
private Long id;
/**
* 灾害类型
*/
private String disasterType;
/**
* 灾害关键词
*/
private String disasterKeyword;
/**
* 灾害发生时间
*/
private LocalDate disasterTime;
/**
* 灾害发起时间
*/
private LocalDateTime uploadTime;
/**
* 灾害区域地理字段
*/
private String geometry;
/**
* 灾害强度或震级
*/
private String disasterLevel;
/**
* 受灾国家
*/
private String disasterCountry;
/**
* 响应状态0未审批1审批未通过2审批通过并正在响应3审批通过并且响应完成
*/
private Integer respondStatus;
/**
* 本灾害的用户访问次数
*/
private Integer visitCount;
/**
* 本灾害的数据下载次数
*/
private Integer downloadCount;
/**
* 爬虫类型
*/
private Integer spiderType;
/**
* 爬虫起始时间
*/
private Date tempendTime;
/**
* 爬虫终止时间
*/
private Date tempStartTime;
/**
* 数据条目创建时间
*/
private Date createTime;
/**
* 灾害id,审批通过后生成
*/
private String vordmId;
/**
* 灾害响应时间
*/
private Date respondTime;
/**
* 灾害申请组织
*/
private String sponsorOrganization;
/**
*
*/
private String disasterImg;
/**
* 字典名称
*/
private String dictValue;
/**
*
*/
private Long size;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

View File

@ -22,4 +22,14 @@ public class GroupByUse {
* 图标
*/
private String icon;
/**
* 字典值
*/
private String dicKey;
/**
* 类型
*/
private String type;
}

View File

@ -2,26 +2,27 @@ package com.kening.vordm.controller;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kening.vordm.entity.*;
import com.kening.vordm.service.*;
import com.kening.vordm.vo.CallForHelpVo;
import com.kening.vordm.vo.DisasterMangerInfo;
import com.kening.vordm.vo.DisasterInfoVo;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.UserTenantVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@ -33,6 +34,7 @@ public class DisasterInfoController {
private final WebsitesService websitesService;
private final NewsService newsService;
private final PictureInfoService pictureInfoService;
private final GuestInfoService guestInfoService;
@ -42,6 +44,8 @@ public class DisasterInfoController {
//下载次数记录
private final DownloadRecordService downloadRecordService;
private final DisasterInfoVoService disasterInfoVoService;
/**
* 首页数据轮播和定位相关
* @return
@ -81,6 +85,26 @@ public class DisasterInfoController {
*/
@GetMapping("/select-condition")
public R<List<GroupByUse>> getSelectCondition(DisasterInfo disasterInfo) {
//String dateType = String.valueOf(params.get("dateTyle"));
// LocalDate date = LocalDate.now();
// if(StringUtils.isNotBlank(dateType)){
// switch (dateType){
// case "1" :
// //Latest week 上一周
// date = LocalDate.now().minusWeeks(1);
// break;
// case "2":
// //Latest month 上一个月
// date = LocalDate.now().minusMonths(1);
// break;
// case "3":
// //Latest six month 上6个月
// date = LocalDate.now().minusMonths(6);
// break;
// default:
// break;
// }
// }
String disaster_time = null;
if (disasterInfo.getDisasterTime() != null) {
disaster_time = DateUtil.format(disasterInfo.getDisasterTime(),"yyyy-MM-dd");
@ -90,55 +114,58 @@ public class DisasterInfoController {
}
/**
* 指定条件返回数据
*
* @param query
* @param disasterInfo
* @return
*/
@GetMapping("/test")
public R<IPage<News>> getdata(Query query, DisasterInfo disasterInfo) {
List<Long> disasterIds = disasterInfoService.getDisasterId(disasterInfo);
return R.data(newsService.page(Condition.getPage(query), new QueryWrapper<News>().in("disaster_id", disasterIds)));
}
/**
* 灾害信息统计 国家/灾害类型
* 灾害信息统计 国家/灾害类型 左边栏
*
* @param name
* @param
* @return
*/
@GetMapping("/disasterStatistics")
public R<List<GroupByUse>> getDisasterStatistics(String name) {
List<GroupByUse> groupByUseList = new ArrayList<>();
if("searchSponsorOrganization".equals(name)){
//发起机构方法 第三个左边栏
groupByUseList = disasterInfoService.getLeft3Data();
} else if ("searchResponseOrganization".equals(name)) {
//发起机构方法 第四个左边栏
groupByUseList = disasterInfoService.getLeft4Data();
}else{
groupByUseList = disasterInfoService.getDisasterStatistics(name);
}
return R.data(groupByUseList);
public R<Map<String, List<GroupByUse>>> getDisasterStatistics() {
Map dataMap = new HashMap();
//按灾害类型查找 第一栏 取前7个
dataMap.put("type", disasterInfoService.getLeft1Data());
//按国家统计 第2栏 取前7个
dataMap.put("country", disasterInfoService.getLeft2Data());
//发起机构方法 第三个左边栏 取前3个
dataMap.put("sponsorOrganization",disasterInfoService.getLeft3Data());
//发起机构方法 第四个左边栏 取前3个
dataMap.put("responseOrganization",disasterInfoService.getLeft4Data());
//List<GroupByUse> groupByUseList = new ArrayList<>();
// if("searchSponsorOrganization".equals(name)){
// //发起机构方法 第三个左边栏
// groupByUseList = disasterInfoService.getLeft3Data();
// } else if ("searchResponseOrganization".equals(name)) {
// //发起机构方法 第四个左边栏
// groupByUseList = disasterInfoService.getLeft4Data();
// }else{
// groupByUseList = disasterInfoService.getDisasterStatistics(name);
// }
return R.data(dataMap);
}
/**
* 首页数据展示包括响应中和未响应
*
* @param query
* @param respondStatus
* @return
*/
@GetMapping("/homeDisasterInfo")
public R<BladePage<DisasterMangerInfo>> gethomeDisasterInfo(Query query, Integer respondStatus) {
IPage<DisasterMangerInfo> pages = disasterInfoService.getHomeDisaster(Condition.getPage(query), respondStatus);
return R.data(BladePage.of(pages));
public R<IPage<DisasterInfoVo>> gethomeDisasterInfo(Query query, @RequestParam Map<String, String> params) {
return R.data(disasterInfoVoService.page(Condition.getPage(query),Wrappers.<DisasterInfoVo>lambdaQuery()
.eq(DisasterInfoVo::getRespondStatus, Integer.valueOf(params.get("respondStatus")))
.ge(StringUtils.isNotBlank(String.valueOf(params.get("startTime"))),DisasterInfoVo::getDisasterTime,LocalDate.parse(String.valueOf(params.get("startTime"))))
.le(StringUtils.isNotBlank(String.valueOf(params.get("endTime"))),DisasterInfoVo::getDisasterTime,LocalDate.parse(String.valueOf(params.get("endTime"))))
.eq(StringUtils.isNotBlank(String.valueOf(params.get("disasterType"))),DisasterInfoVo::getDisasterType, String.valueOf(params.get("disasterType")))
.orderByDesc(DisasterInfoVo::getDisasterTime)
));
}
public static void main(String[] args) {
System.out.println(LocalDate.now().minusMonths(6).toString());
}
/**
* 获取债害详情信息
*

View File

@ -40,4 +40,8 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
List<GroupByUse> getLeft3Data();
List<GroupByUse> getLeft4Data();
List<GroupByUse> getLeft1Data();
List<GroupByUse> getLeft2Data();
}

View File

@ -78,7 +78,7 @@
</select>
<select id="getHomeDisaster" resultType="com.kening.vordm.vo.DisasterMangerInfo">
select <include refid="Home_Disaster_Info"></include>
select *
from (select distinct manager_id,disaster_id from guest_mamanager_info
on g.manager_id=m.id and g.disaster_id=d.id
where d.respond_status=#{respondStatus}
@ -95,10 +95,28 @@
GROUP BY bu.organization
</select>
<select id="getLeft3Data" resultType="com.kening.vordm.vo.GroupByUse">
select t.sponsor_organization as `name`, count(*) as cnt from disaster_info t GROUP BY t.sponsor_organization ORDER BY cnt desc LIMIT 3
select t.sponsor_organization as `name`, count(*) as cnt , 'sponsorOrganization' as `type` from disaster_info t GROUP BY t.sponsor_organization ORDER BY cnt desc LIMIT 3
</select>
<select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse">
select t.response_organization as `name`, count(*) as cnt from guest_manage_disaster_ref t GROUP BY t.response_organization ORDER BY cnt desc LIMIT 3
select t.response_organization as `name`, count(*) as cnt, 'responseOrganization' as `type` from guest_manage_disaster_ref t GROUP BY t.response_organization ORDER BY cnt desc LIMIT 3
</select>
<select id="getLeft1Data" resultType="com.kening.vordm.vo.GroupByUse">
select b.dict_key, b.dict_value as name, count(t.disaster_type) as cnt, 'type' as `type`,
CONCAT('/icon_disastertype/icon-',b.dict_key,'.png') as icon
from blade_dict_biz b left join disaster_info t on b.dict_key = t.disaster_type
where b.`code` = 'disaster' and b.dict_key is not null
group by b.dict_key, b.dict_value
order by cnt desc
limit 7
</select>
<select id="getLeft2Data" resultType="com.kening.vordm.vo.GroupByUse">
SELECT b.*, c.img as icon from country_icon c INNER JOIN
(select t.disaster_country as name, count(*) as cnt, 'country' as `type`
from disaster_info t
group by t.disaster_country
order by cnt desc
limit 7) b on c.flagname = b.`name`
</select>
</mapper>

View File

@ -0,0 +1,18 @@
package com.kening.vordm.mapper;
import com.kening.vordm.vo.DisasterInfoVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangns
* @description 针对表disaster_info_vo的数据库操作Mapper
* @createDate 2023-04-10 17:33:26
* @Entity com.kening.vordm.vo.DisasterInfoVo
*/
public interface DisasterInfoVoMapper extends BaseMapper<DisasterInfoVo> {
}

View File

@ -46,4 +46,8 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
List<GroupByUse> getLeft3Data();
List<GroupByUse> getLeft4Data();
List<GroupByUse> getLeft1Data();
List<GroupByUse> getLeft2Data();
}

View File

@ -0,0 +1,13 @@
package com.kening.vordm.service;
import com.kening.vordm.vo.DisasterInfoVo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangns
* @description 针对表disaster_info_vo的数据库操作Service
* @createDate 2023-04-10 17:33:26
*/
public interface DisasterInfoVoService extends IService<DisasterInfoVo> {
}

View File

@ -104,8 +104,15 @@ implements DisasterInfoService {
return this.baseMapper.getLeft4Data();
}
public List<GroupByUse> getLeftData() {
return this.baseMapper.getLeft4Data();
@Override
public List<GroupByUse> getLeft1Data() {
return this.baseMapper.getLeft1Data();
}
@Override
public List<GroupByUse> getLeft2Data() {
return this.baseMapper.getLeft2Data();
}
}

View File

@ -0,0 +1,22 @@
package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.vo.DisasterInfoVo;
import com.kening.vordm.service.DisasterInfoVoService;
import com.kening.vordm.mapper.DisasterInfoVoMapper;
import org.springframework.stereotype.Service;
/**
* @author wangns
* @description 针对表disaster_info_vo的数据库操作Service实现
* @createDate 2023-04-10 17:33:26
*/
@Service
public class DisasterInfoVoServiceImpl extends ServiceImpl<DisasterInfoVoMapper, DisasterInfoVo>
implements DisasterInfoVoService{
}

View File

@ -0,0 +1,40 @@
<?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.kening.vordm.mapper.DisasterInfoVoMapper">
<resultMap id="BaseResultMap" type="com.kening.vordm.vo.DisasterInfoVo">
<result property="id" column="id" jdbcType="BIGINT"/>
<result property="disasterType" column="disaster_type" jdbcType="VARCHAR"/>
<result property="disasterKeyword" column="disaster_keyword" jdbcType="VARCHAR"/>
<result property="disasterTime" column="disaster_time" jdbcType="DATE"/>
<result property="uploadTime" column="upload_time" jdbcType="TIMESTAMP"/>
<result property="geometry" column="geometry" jdbcType="VARCHAR"/>
<result property="disasterLevel" column="disaster_level" jdbcType="VARCHAR"/>
<result property="disasterCountry" column="disaster_country" jdbcType="VARCHAR"/>
<result property="respondStatus" column="respond_status" jdbcType="SMALLINT"/>
<result property="visitCount" column="visit_count" jdbcType="INTEGER"/>
<result property="downloadCount" column="download_count" jdbcType="INTEGER"/>
<result property="spiderType" column="spider_type" jdbcType="INTEGER"/>
<result property="tempendTime" column="tempend_time" jdbcType="TIMESTAMP"/>
<result property="tempStartTime" column="temp_start_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="vordmId" column="vordm_id" jdbcType="VARCHAR"/>
<result property="respondTime" column="respond_time" jdbcType="TIMESTAMP"/>
<result property="sponsorOrganization" column="sponsor_organization" jdbcType="VARCHAR"/>
<result property="disasterImg" column="disaster_img" jdbcType="VARCHAR"/>
<result property="dictValue" column="dict_value" jdbcType="VARCHAR"/>
<result property="size" column="size" jdbcType="DECIMAL"/>
</resultMap>
<sql id="Base_Column_List">
id,disaster_type,disaster_keyword,
disaster_time,upload_time,geometry,
disaster_level,disaster_country,respond_status,
visit_count,download_count,spider_type,
tempend_time,temp_start_time,create_time,
vordm_id,respond_time,sponsor_organization,
disaster_img,dict_value,size
</sql>
</mapper>