glj-代码提交

This commit is contained in:
glj 2024-01-19 10:01:54 +08:00
parent d5b7a301d8
commit a4e99c6884
10 changed files with 895 additions and 118 deletions

View File

@ -3,6 +3,7 @@ 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.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@ -379,7 +380,15 @@ public class DisasterInfoController {
}
});
Email emailNewUser = new Email();
emailNewUser.setTos(new String[]{guestInfo.getEmail()});
emailNewUser.setSubject("Your disaster response application has been approved!");
emailNewUser.setText("Your disaster response application has been approved!");
try {
emailService.sendMimeMessage(email);
} catch (Exception e) {
return R.fail("Sending failed, please check if the email is correct!");
}
} else {
email.setTos(new String[]{guestInfo.getEmail()});
email.setSubject(disasterInfo.getRefuseTitle());
@ -398,9 +407,9 @@ public class DisasterInfoController {
private final EmailService emailService;
@ApiOperationSupport(order = 6)
@ApiOperation(value = "提交", notes = "传入Tool")
@ApiOperation(value = "提交", notes = "传入DisasterInfo")
@PostMapping("/submit")
public R submit(@ApiParam(value = "Tool对象", required = true) @RequestBody DisasterInfo disasterInfo) {
public R submit(@ApiParam(value = "DisasterInfo对象", required = true) @RequestBody DisasterInfo disasterInfo) {
Long chiefId = disasterInfo.getChiefId();
//判断是否是分配
String Allocation = disasterInfo.getAllocation();
@ -440,6 +449,32 @@ public class DisasterInfoController {
return R.status(disasterInfoService.saveOrUpdate(disasterInfo));
}
/**
* 取消管理员对灾害的管理权限
* @param id
* @return
*/
@GetMapping("/deleteDisasterInfoManage")
public R deleteDisasterInfoManage(Long id) {
LambdaQueryWrapper<GuestManageDisasterRef> qw = new LambdaQueryWrapper<>();
qw.eq(GuestManageDisasterRef::getDisasterId, id);
GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw);
one.setStatus(3);
one.setManagerId(null);
LambdaUpdateWrapper<GuestManageDisasterRef> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
lambdaUpdateWrapper.eq(GuestManageDisasterRef::getId,one.getId());
lambdaUpdateWrapper.set(GuestManageDisasterRef::getStatus,3);
lambdaUpdateWrapper.set(GuestManageDisasterRef::getManagerId,null);
guestManageDisasterRefService.update(lambdaUpdateWrapper);
LambdaUpdateWrapper<DisasterInfo> disasterInfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
disasterInfoLambdaUpdateWrapper.eq(DisasterInfo::getId,id);
disasterInfoLambdaUpdateWrapper.set(DisasterInfo::getChiefId,null);
disasterInfoLambdaUpdateWrapper.set(DisasterInfo::getChiefName,null);
return R.status(disasterInfoService.update(disasterInfoLambdaUpdateWrapper));
}
/**
* 后台管理系统-控制台灾害各项统计
*
@ -581,18 +616,19 @@ public class DisasterInfoController {
} catch (Exception e) {
return R.fail("Sending failed, please check if the email is correct!");
}
//审核不通过
}else if (disasterInfo.getIsEndApply()==3){
Administrator user = administratorService.getById(disasterInfo.getChiefId());
DisasterInfoVo disasterInfoVo = disasterInfoVoService.getById(disasterInfo.getId());
// Administrator user = administratorService.getById(disasterInfo.getChiefId());
// DisasterInfoVo disasterInfoVo = disasterInfoVoService.getById(disasterInfo.getId());
//发送邮件
Email email = new Email();
email.setSubject("You have a Disaster Response task pending");
String text = "Sorry, the disaster reduction task of "+disasterInfoVo.getDisasterCountry()+" "+disasterInfoVo.getDictValue()+"("+simpleDateFormat.format(disasterInfoVo.getDisasterTime())+")" +" you claimed will continue! Please continue to monitor the progress of the disaster!";
// String text = "Sorry, the disaster reduction task of "+disasterInfoVo.getDisasterCountry()+" "+disasterInfoVo.getDictValue()+"("+simpleDateFormat.format(disasterInfoVo.getDisasterTime())+")" +" you claimed will continue! Please continue to monitor the progress of the disaster!";
email.setText(text);
String[] to = new String[]{user.getEmail()};
email.setText(disasterInfo.getRefuseReason());
String[] to = new String[]{disasterInfo.getEmail()};
email.setTos(to);
try {

View File

@ -2,11 +2,15 @@ package com.kening.vordm.controller;
import cn.hutool.core.date.DateUtil;
import com.kening.vordm.vo.FileVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -15,14 +19,19 @@ import org.springframework.web.multipart.MultipartFile;
@RequestMapping("/ui/upload")
@RestController
@Slf4j
@RequiredArgsConstructor
public class FileController {
/**
* 对象存储模块
*/
@Autowired
private MinioTemplate minioTemplate;
private final MinioTemplate minioTemplate;
private final OssProperties ossProperties;
@Value("${oss.minio.image-url:}")
private String imageUrl;
/**
* 上传文件
@ -32,6 +41,8 @@ public class FileController {
@PostMapping("/uploadFile")
public R upload(MultipartFile file){
BladeFile bladeFile = minioTemplate.putFile(file);
bladeFile = format(bladeFile, imageUrl);
//获取文件大小
Long fileSize = file.getSize();
//获取文件类型
@ -47,4 +58,20 @@ public class FileController {
fileVo.setLink(link);
return R.data(bladeFile);
}
/**
* 格式化上传文件返回路径
* @param bladeFile 上传成功后返回的值
* @param showUrl 回显地址
* @return 上传后的文件内容
*/
private BladeFile format(BladeFile bladeFile, String showUrl) {
if (StringUtil.isNotBlank(showUrl)) {
String link = bladeFile.getLink();
String subUrl = link.replace(ossProperties.getEndpoint(), showUrl);
bladeFile.setLink(subUrl);
bladeFile.setDomain(showUrl);
}
return bladeFile;
}
}

View File

@ -103,4 +103,6 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
IPage<DisasterInfo> getUserDisasterInfoListNDR(IPage<Object> page,@Param("userId") String userId);
IPage<DisasterInfo> getUserDisasterInfoListNDRNew(IPage<Object> page,@Param("userId") String userId,@Param("respondStatus") String respondStatus);
List<Map<String, Long>> disasterInfoType(@Param("year") String year);
}

View File

@ -208,6 +208,9 @@
<if test="callForHelpVo.respondStatus!=null">
d.respond_status = #{callForHelpVo.respondStatus}
</if>
<if test="callForHelpVo.vordmId!=null and callForHelpVo.vordmId != ''">
and d.vordm_id like concat('%', #{callForHelpVo.vordmId},'%')
</if>
<if test="callForHelpVo.isEndApply!=null">
and d.is_end_apply = #{callForHelpVo.isEndApply}
</if>
@ -390,50 +393,62 @@
SELECT CONCAT(#{year}, '-01') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as response, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and (t.respond_status = 2 or t.respond_status = 3)
union ALL
@ -498,16 +513,13 @@
</select>
<select id="adminData" resultType="java.util.Map">
SELECT
b.`name`,
SELECT b.`name`,
count(*) AS val
FROM
disaster_info t
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
INNER JOIN blade_user b ON gi.email = b.email
WHERE
date_format( t.disaster_time, '%Y' ) = #{year}
WHERE date_format(t.disaster_time, '%Y') = #{year}
AND b.`name` != "超级管理员"
GROUP BY
@ -619,166 +631,235 @@
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-02') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-02')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-03') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-03')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-04') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-04')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-05') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-05')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-06') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-06')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-07') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-07')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-08') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-08')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-09') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-09')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-10') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-10')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-11') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-11')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as response, count(1) as initiate
SELECT CONCAT(#{year}, '-12') as `key`, 0 as response, count (1) as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
where date_format(t.disaster_time
, '%Y-%m') = CONCAT(#{year}
, '-12')
and gi.email = #{email}
and gmdr.status != 2
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-01') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-01')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-01')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-02') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-02')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-02')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-03') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-03')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-03')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-04') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-04')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-04')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-05') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-05')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-05')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-06') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-06')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-06')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-07') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-07')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-07')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-08') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-08')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-08')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-09') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-09')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-09')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-10') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-10')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-10')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-11') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-11')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-11')
and gmdr.manager_id = #{userId}
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, count(1) as response, 0 as initiate
SELECT CONCAT(#{year}, '-12') as `key`, count (1) as response, 0 as initiate
FROM disaster_info t
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-12')
LEFT JOIN guest_manage_disaster_ref gmdr
on gmdr.disaster_id = t.id
where date_format(t.respond_time
, '%Y-%m') = CONCAT(#{year}
, '-12')
and gmdr.manager_id = #{userId}
) d
GROUP BY d.`key`
@ -817,4 +898,526 @@
and di.is_end_apply = 0
</where>
</select>
<select id="disasterInfoType" resultType="java.util.Map">
select d.`key`, sum(d.Earthquake) as Earthquake, SUM(d.Volcano) as Volcano, SUM(d.Landslide) as Landslide, SUM(d.Flood) as Flood, SUM(d.Hurricane) as Hurricane, SUM(d.Drought) as Drought, SUM(d.Emergency) as Emergency
from (
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, count(1) as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '007'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, count(1) as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '006'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, count(1) as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '005'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, 0 as Volcano,
0 as Landslide, count(1) as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '004'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, 0 as Volcano,
count(1) as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '003'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as Earthquake, count(1) as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '002'
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
and t.disaster_type = '001'
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, count(1) as Earthquake, 0 as Volcano,
0 as Landslide, 0 as Flood, 0 as Hurricane, 0 as Drought, 0 as Emergency
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
and t.disaster_type = '001'
) d
GROUP BY d.`key`
ORDER BY d.`key`
</select>
</mapper>

View File

@ -344,6 +344,9 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
List<Map<String, Long>> adminfMap = this.baseMapper.adminData(year);
List<Map<String, Long>> typeMap = this.baseMapper.disasterInfoType(year);
//统计当年的灾害响应次数 按月查询
//List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin);
resultMap.put("header", headMap);
@ -359,6 +362,7 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
resultMap.put("country", countryData);
//灾害类型分类
resultMap.put("disasterNum", disasterNum);
resultMap.put("type", typeMap);
return resultMap;
}

View File

@ -15,14 +15,17 @@ import com.kening.vordm.service.EntityDataService;
import com.kening.vordm.vo.EntityDataUserVo;
import com.kening.vordm.vo.UserTenantVo;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.record.DVALRecord;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -39,22 +42,24 @@ import java.util.stream.Collectors;
*/
@Slf4j
@Service
@AllArgsConstructor
@RequiredArgsConstructor
public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityData>
implements EntityDataService {
private GuestInfoMapper guestInfoMapper;
private final GuestInfoMapper guestInfoMapper;
private RemoteSensingSourceDataMapper remoteSensingSourceDataMapper;
/**
* 验证码
*/
private final BladeRedis bladeRedis;
private final RemoteSensingSourceDataMapper remoteSensingSourceDataMapper;
private final OssProperties ossProperties;
/**
* 对象存储模块
*/
private MinioTemplate minioTemplate;
private final MinioTemplate minioTemplate;
@Value("${oss.minio.image-url:}")
private String imageUrl;
@Override
public IPage<EntityData> getEntityDataList(IPage<Object> page, EntityData entityData) {
@ -125,6 +130,7 @@ public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityD
List<MultipartFile> filesArray = entityDataUserVo.getFilesArray();
filesArray.stream().forEach(files -> {
BladeFile bladeFile = minioTemplate.putFile(files);
bladeFile = format(bladeFile, imageUrl);
//获取文件大小
Long fileSize = files.getSize();
link.add(bladeFile.getLink());
@ -146,6 +152,23 @@ public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityD
}
}
/**
* 格式化上传文件返回路径
* @param bladeFile 上传成功后返回的值
* @param showUrl 回显地址
* @return 上传后的文件内容
*/
private BladeFile format(BladeFile bladeFile, String showUrl) {
if (StringUtil.isNotBlank(showUrl)) {
String link = bladeFile.getLink();
String subUrl = link.replace(ossProperties.getEndpoint(), showUrl);
bladeFile.setLink(subUrl);
bladeFile.setDomain(showUrl);
}
return bladeFile;
}
@Override
public List<Map<String, Long>> getStatisticsByUserId(Long id, String year) {
return baseMapper.getStatisticsByUserId(id, year);

View File

@ -7,11 +7,14 @@ import com.kening.vordm.entity.EntityData;
import com.kening.vordm.entity.OtherData;
import com.kening.vordm.mapper.OtherDataMapper;
import com.kening.vordm.service.OtherDataService;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@ -28,13 +31,18 @@ import java.util.Map;
*/
@Slf4j
@Service
@AllArgsConstructor
@RequiredArgsConstructor
public class OtherDataServiceImpl extends ServiceImpl<OtherDataMapper, EntityData> implements OtherDataService {
/**
* 对象存储模块
*/
private MinioTemplate minioTemplate;
private final MinioTemplate minioTemplate;
private final OssProperties ossProperties;
@Value("${oss.minio.image-url:}")
private String imageUrl;
/**
* 灾害分页列表查询
@ -88,6 +96,8 @@ public class OtherDataServiceImpl extends ServiceImpl<OtherDataMapper, EntityDat
List<Long> size = new ArrayList<>();
for (MultipartFile multipartFile : OtherData.getFile()) {
BladeFile bladeFile = minioTemplate.putFile(multipartFile);
bladeFile = format(bladeFile, imageUrl);
//获取文件大小
Long fileSize = multipartFile.getSize();
link.add(bladeFile.getLink());
@ -113,4 +123,21 @@ public class OtherDataServiceImpl extends ServiceImpl<OtherDataMapper, EntityDat
entityData.setSourceOrganization(OtherData.getSourceOrganization());
return save(entityData);
}
/**
* 格式化上传文件返回路径
* @param bladeFile 上传成功后返回的值
* @param showUrl 回显地址
* @return 上传后的文件内容
*/
private BladeFile format(BladeFile bladeFile, String showUrl) {
if (StringUtil.isNotBlank(showUrl)) {
String link = bladeFile.getLink();
String subUrl = link.replace(ossProperties.getEndpoint(), showUrl);
bladeFile.setLink(subUrl);
bladeFile.setDomain(showUrl);
}
return bladeFile;
}
}

View File

@ -6,9 +6,13 @@ import com.kening.vordm.entity.PictureInfo;
import com.kening.vordm.mapper.PictureInfoMapper;
import com.kening.vordm.service.PictureInfoService;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -22,15 +26,20 @@ import java.util.List;
*/
@Slf4j
@Service
@AllArgsConstructor
@RequiredArgsConstructor
public class PictureInfoServiceImpl extends ServiceImpl<PictureInfoMapper, PictureInfo>
implements PictureInfoService {
/**
* 对象存储模块
*/
private MinioTemplate minioTemplate;
private final MinioTemplate minioTemplate;
private final OssProperties ossProperties;
@Value("${oss.minio.image-url:}")
private String imageUrl;
/**
* 修改图片信息
*
@ -44,6 +53,7 @@ public class PictureInfoServiceImpl extends ServiceImpl<PictureInfoMapper, Pictu
MultipartFile multipartFile = pictureInfo.getFile();
if (multipartFile!=null){
BladeFile bladeFile = minioTemplate.putFile(multipartFile);
bladeFile = format(bladeFile, imageUrl);
picture.setLink(bladeFile.getLink());
picture.setSize(multipartFile.getSize());
picture.setType(multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().indexOf(".") + 1));
@ -66,6 +76,7 @@ public class PictureInfoServiceImpl extends ServiceImpl<PictureInfoMapper, Pictu
List<PictureInfo> pictureInfoList = new ArrayList<>();
for (MultipartFile multipartFile : otherData.getFile()) {
BladeFile bladeFile = minioTemplate.putFile(multipartFile);
bladeFile = format(bladeFile, imageUrl);
PictureInfo pictureInfo = new PictureInfo();
pictureInfo.setLink(bladeFile.getLink());
pictureInfo.setDisasterId(otherData.getDisasterId());
@ -81,4 +92,21 @@ public class PictureInfoServiceImpl extends ServiceImpl<PictureInfoMapper, Pictu
}
return saveBatch(pictureInfoList);
}
/**
* 格式化上传文件返回路径
* @param bladeFile 上传成功后返回的值
* @param showUrl 回显地址
* @return 上传后的文件内容
*/
private BladeFile format(BladeFile bladeFile, String showUrl) {
if (StringUtil.isNotBlank(showUrl)) {
String link = bladeFile.getLink();
String subUrl = link.replace(ossProperties.getEndpoint(), showUrl);
bladeFile.setLink(subUrl);
bladeFile.setDomain(showUrl);
}
return bladeFile;
}
}

View File

@ -13,6 +13,7 @@ import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.mapper.RemoteSensingSourceDataMapper;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import com.kening.vordm.vo.productResolutionVo;
import lombok.RequiredArgsConstructor;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
@ -24,10 +25,12 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springblade.common.utils.ExcelCellUtil;
import org.springblade.core.oss.MinioTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.IoUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -46,14 +49,20 @@ import java.util.concurrent.atomic.AtomicReference;
* @createDate 2023-04-04 15:54:31
*/
@Service
@RequiredArgsConstructor
public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensingSourceDataMapper, RemoteSensingSourceData>
implements RemoteSensingSourceDataService {
/**
* 对象存储模块
*/
@Autowired
private MinioTemplate minioTemplate;
private final MinioTemplate minioTemplate;
private final OssProperties ossProperties;
@Value("${oss.minio.image-url:}")
private String imageUrl;
@Override
public List<RemoteSensingSourceData> getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime) {
@ -275,6 +284,9 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensin
String caselsh = name.substring(0, name.lastIndexOf("."));
BladeFile bladeFile = minioTemplate.putFile(multipartFile);
bladeFile = format(bladeFile, imageUrl);
for (int i = 0; i < remoteSensingSourceData.size(); i++) {
if (caselsh.equals(remoteSensingSourceData.get(i).getPictureName())) {
RemoteSensingSourceData remoteSensingSourceData1 = remoteSensingSourceData.get(i);
@ -354,4 +366,21 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl<RemoteSensin
e.printStackTrace();
}
}
/**
* 格式化上传文件返回路径
* @param bladeFile 上传成功后返回的值
* @param showUrl 回显地址
* @return 上传后的文件内容
*/
private BladeFile format(BladeFile bladeFile, String showUrl) {
if (StringUtil.isNotBlank(showUrl)) {
String link = bladeFile.getLink();
String subUrl = link.replace(ossProperties.getEndpoint(), showUrl);
bladeFile.setLink(subUrl);
bladeFile.setDomain(showUrl);
}
return bladeFile;
}
}

View File

@ -38,8 +38,6 @@ public class VisualDataServiceImpl extends ServiceImpl<VisualDataMapper, EntityD
/**
* 对象存储模块
*/
private MinioTemplate minioTemplate;
private WordCloudsService wordCloudsService;
private HotspotService hotspotService;