glj-代码提交

This commit is contained in:
glj 2023-12-26 15:36:36 +08:00
parent 3832d2d547
commit d5b7a301d8
33 changed files with 1409 additions and 202 deletions

View File

@ -6,5 +6,6 @@ import lombok.Data;
public class DisasterData { public class DisasterData {
private String type; private String type;
private Integer value; private Integer value;
private Integer valueNew;
private String date; private String date;
} }

View File

@ -121,6 +121,20 @@ public class DisasterInfo implements Serializable {
*/ */
private Long chiefId; private Long chiefId;
/**
* 是否发起灾害响应结束申请0未发起/1发起审批/2审批通过/3审批不通过
*/
private Integer isEndApply;
private String chiefName;
/**
* 完成时间
*/
private Date respondedTime;
/** /**
* 管理用户 * 管理用户
*/ */
@ -156,13 +170,6 @@ public class DisasterInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String chiefName;
/**
* 完成时间
*/
private Date respondedTime;
/** /**
* Allocation 是否是分配 * Allocation 是否是分配
@ -180,6 +187,23 @@ public class DisasterInfo implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String refuseReason; private String refuseReason;
/**
* 灾害类型名称
*/
@TableField(exist = false)
private String disasterName;
@TableField(exist = false)
private Boolean isNci;
@TableField(exist = false)
private Boolean isNdr;
@TableField(exist = false)
private Boolean isNr;
@TableField(exist = false)
private String email;
} }

View File

@ -237,5 +237,7 @@ public class RemoteSensingSourceData implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private Integer beforeOrAfter =1; private Integer beforeOrAfter =1;
//多个Id
@TableField(exist = false)
private String idsList;
} }

View File

@ -103,4 +103,8 @@ public class CallForHelpVo extends DisasterInfo {
private Long parentId; private Long parentId;
private String roleAlias; private String roleAlias;
private Integer respondStatus;
private Integer isEndApply;
} }

View File

@ -144,6 +144,10 @@ public class CenterDisasterInfo implements Serializable {
* 审批管理员时间 * 审批管理员时间
*/ */
private LocalDateTime reviewTime; private LocalDateTime reviewTime;
/**
* 管理员
*/
private Long sponsorId;
/** /**
* 用户邮件 * 用户邮件
@ -152,4 +156,13 @@ public class CenterDisasterInfo implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableField(exist = false)
private Boolean isNci;
@TableField(exist = false)
private Boolean isNdr;
@TableField(exist = false)
private Boolean isNr;
} }

View File

@ -0,0 +1,155 @@
package com.kening.vordm.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
* @TableName center_disaster_info
*/
@TableName(value ="center_disaster_info_user")
@Data
public class CenterDisasterInfoUser implements Serializable {
/**
* 唯一值
*/
private Long id;
/**
* 灾害类型
*/
private String disasterType;
/**
* 灾害关键词
*/
private String disasterKeyword;
/**
* 灾害发生时间
*/
private Date disasterTime;
/**
* 灾害发起时间
*/
private Date 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 dictValue;
/**
* 数据存储链接
*/
private String disasterImg;
/**
*
*/
private Long size;
/**
*
*/
private String news;
/**
* 用户名称
*/
private String userName;
/**
* 审核状态 0未审核 1审核通过 2审核不通过 3未认领
*/
private Integer status;
/**
* 申请管理员时间
*/
private LocalDateTime applyTime;
/**
* 审批管理员时间
*/
private LocalDateTime reviewTime;
/**
* 用户邮件
*/
private String email;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

View File

@ -77,7 +77,7 @@ public class CaptchaController extends BladeController {
emailService.sendMimeMessage(email); emailService.sendMimeMessage(email);
} catch (Exception e) { } catch (Exception e) {
log.error("发送邮件失败:{}", e); log.error("发送邮件失败:{}", e);
return R.fail("发送失败"); return R.fail("Sending failed, please check if the email is correct!");
} }
// 将key返回给前端 // 将key返回给前端
return R.success("OK"); return R.success("OK");
@ -111,7 +111,7 @@ public class CaptchaController extends BladeController {
emailService.sendMimeMessage(email); emailService.sendMimeMessage(email);
} catch (Exception e) { } catch (Exception e) {
log.error("发送邮件失败:{}", e); log.error("发送邮件失败:{}", e);
return R.fail("发送失败"); return R.fail("Sending failed, please check if the email is correct!");
} }
return R.success("OK"); return R.success("OK");
} }

View File

@ -5,12 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.Tool; import com.kening.vordm.entity.Tool;
import com.kening.vordm.service.CenterDisasterInfoService; import com.kening.vordm.service.*;
import com.kening.vordm.service.DisasterInfoVoService;
import com.kening.vordm.service.GuestInfoService;
import com.kening.vordm.service.ToolService;
import com.kening.vordm.vo.CenterDisasterInfo; import com.kening.vordm.vo.CenterDisasterInfo;
import com.kening.vordm.vo.CenterDisasterInfoUser;
import com.kening.vordm.vo.DisasterInfoVo; import com.kening.vordm.vo.DisasterInfoVo;
import com.kening.vordm.vo.UserVo; import com.kening.vordm.vo.UserVo;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -32,7 +31,11 @@ import java.util.Map;
@AllArgsConstructor @AllArgsConstructor
@RequestMapping("/ui/center") @RequestMapping("/ui/center")
public class CenterController { public class CenterController {
private final CenterDisasterInfoService centerDisasterInfoService; private final CenterDisasterInfoService centerDisasterInfoService;
private final CenterDisasterInfoUserService centerDisasterInfoUserService;
private final GuestInfoService guestInfoService; private final GuestInfoService guestInfoService;
/** /**
@ -51,6 +54,23 @@ public class CenterController {
)); ));
} }
//个人中心列表普通用户
@GetMapping("/respondingUserList")
public R<IPage<CenterDisasterInfoUser>> respondingUserList(Query query, @RequestParam Map<String, String> params) {
return R.data(centerDisasterInfoUserService.page(Condition.getPage(query), Wrappers.<CenterDisasterInfoUser>lambdaQuery()
// .eq(CenterDisasterInfoUser::getRespondStatus,3)
.eq(CenterDisasterInfoUser::getStatus,1)
.eq(CenterDisasterInfoUser::getEmail,String.valueOf(params.get("email")))
.orderByDesc(CenterDisasterInfoUser::getApplyTime)
));
}
//个人中心列表普通用户
@GetMapping("/respondedUserList")
public R<IPage<DisasterInfo>> respondedUserList(Query query, @RequestParam Map<String, Object> params) {
return R.data(centerDisasterInfoUserService.respondedUserList(Condition.getPage(query), params));
}
/** /**
* 个人中心 Responded列表 * 个人中心 Responded列表
* 必传email * 必传email

View File

@ -91,7 +91,7 @@ public class ContactController{
emailService.sendMimeMessage(email); emailService.sendMimeMessage(email);
return R.status(contactService.saveOrUpdate(contact)); return R.status(contactService.saveOrUpdate(contact));
} catch (Exception e) { } catch (Exception e) {
return R.fail("发送失败"); return R.fail("Sending failed, please check if the email is correct!");
} }
} }
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)

View File

@ -10,15 +10,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.kening.vordm.entity.*; import com.kening.vordm.entity.*;
import com.kening.vordm.service.*; import com.kening.vordm.service.*;
import com.kening.vordm.vo.CallForHelpVo; import com.kening.vordm.vo.*;
import com.kening.vordm.vo.DisasterInfoVo;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.UserTenantVo;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.hssf.record.DVALRecord;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
@ -28,11 +26,10 @@ import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Date; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -83,13 +80,13 @@ public class DisasterInfoController {
public R<IPage<CallForHelpVo>> list(CallForHelpVo CallForHelpVo, Query query) { public R<IPage<CallForHelpVo>> list(CallForHelpVo CallForHelpVo, Query query) {
String userRole1 = AuthUtil.getUserRole(); String userRole1 = AuthUtil.getUserRole();
if (CallForHelpVo.getChiefIdEquals()!=null){ if (CallForHelpVo.getChiefIdEquals() != null) {
CallForHelpVo userRole = disasterInfoService.getByUserIdRole(CallForHelpVo.getChiefIdEquals()); CallForHelpVo userRole = disasterInfoService.getByUserIdRole(CallForHelpVo.getChiefIdEquals());
if (userRole1.equals("TENANT_ADMIN") && userRole.getRoleAlias().equals("TENANT_ADMIN")){ if (userRole1.equals("TENANT_ADMIN") && userRole.getRoleAlias().equals("TENANT_ADMIN")) {
CallForHelpVo.setChiefIdEquals(null); CallForHelpVo.setChiefIdEquals(null);
} }
}else { } else {
if (userRole1.equals("TENANT_ADMIN")){ if (userRole1.equals("TENANT_ADMIN")) {
CallForHelpVo.setChiefIdEquals(null); CallForHelpVo.setChiefIdEquals(null);
} }
} }
@ -163,7 +160,7 @@ public class DisasterInfoController {
dataMap.put("country", disasterInfoService.getLeft2Data()); dataMap.put("country", disasterInfoService.getLeft2Data());
//发起机构方法 第三个左边栏 取前3个 //发起机构方法 第三个左边栏 取前3个
dataMap.put("sponsorOrganization", disasterInfoService.getLeft3Data()); dataMap.put("sponsorOrganization", disasterInfoService.getLeft3Data());
//发起机构方法 第四个左边栏 取前3个 //普通用户发起得灾害信息
dataMap.put("responseOrganization", disasterInfoService.getLeft4Data()); dataMap.put("responseOrganization", disasterInfoService.getLeft4Data());
//List<GroupByUse> groupByUseList = new ArrayList<>(); //List<GroupByUse> groupByUseList = new ArrayList<>();
// if("searchSponsorOrganization".equals(name)){ // if("searchSponsorOrganization".equals(name)){
@ -319,7 +316,7 @@ public class DisasterInfoController {
DisasterInfo disasterInfo = new DisasterInfo(); DisasterInfo disasterInfo = new DisasterInfo();
BeanUtil.copyProperties(callForHelpVo, disasterInfo); BeanUtil.copyProperties(callForHelpVo, disasterInfo);
disasterInfo.setUploadTime(new Date()); disasterInfo.setUploadTime(new Date());
if (callForHelpVo.getDisasterLevel() != null){ if (callForHelpVo.getDisasterLevel() != null) {
disasterInfo.setDisasterLevel(callForHelpVo.getDisasterLevel()); disasterInfo.setDisasterLevel(callForHelpVo.getDisasterLevel());
} }
Boolean flag3 = disasterInfoService.save(disasterInfo); Boolean flag3 = disasterInfoService.save(disasterInfo);
@ -335,7 +332,8 @@ public class DisasterInfoController {
return R.data(callForHelp); return R.data(callForHelp);
} }
private final AdministratorService administratorService; private final AdministratorService administratorService;
@PostMapping("review") @PostMapping("review")
public R<Boolean> review(@RequestBody DisasterInfo disasterInfo) { public R<Boolean> review(@RequestBody DisasterInfo disasterInfo) {
//审核邮件实例化 //审核邮件实例化
@ -344,29 +342,61 @@ public class DisasterInfoController {
QueryWrapper<GuestInfo> qw = new QueryWrapper<>(); QueryWrapper<GuestInfo> qw = new QueryWrapper<>();
qw.apply("id = (select sponsor_id from guest_manage_disaster_ref where disaster_id = {0})", disasterInfo.getId()); qw.apply("id = (select sponsor_id from guest_manage_disaster_ref where disaster_id = {0})", disasterInfo.getId());
GuestInfo guestInfo = guestInfoService.getOne(qw); GuestInfo guestInfo = guestInfoService.getOne(qw);
email.setTos(new String[]{ guestInfo.getEmail()});
//审批通过 响应状态0未审批1审批未通过2审批通过并正在响应3审批通过并且响应完成 //审批通过 响应状态0未审批1审批未通过2审批通过并正在响应3审批通过并且响应完成
if (disasterInfo.getRespondStatus() == 2) { if (disasterInfo.getRespondStatus() == 2) {
String numbering = serialNumberService.generateNumbering(disasterInfo.getDisasterType()); String numbering = serialNumberService.generateNumbering(disasterInfo.getDisasterType());
disasterInfo.setVordmId(numbering); disasterInfo.setVordmId(numbering);
disasterInfo.setRespondTime(new Date()); disasterInfo.setRespondTime(new Date());
DisasterInfoVo disasterInfoVo = disasterInfoVoService.getById(disasterInfo.getId());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String html = "<a href='http://121.89.234.154:6300/vordm/Responding'>here</a>";
email.setSubject("Your disaster response application has been approved!"); email.setSubject("Your disaster response application has been approved!");
email.setText("Your disaster response application has been approved!");
}else{ String content = "The disaster reduction request for the " + disasterInfoVo.getDisasterCountry()+ " " +disasterInfoVo.getDictValue()+"("+simpleDateFormat.format(disasterInfoVo.getDisasterTime())+")" +"has been approved by the VoRDM office. Click " +html+" to check!";
email.setText(content);
email.setHtmlText(true);
//获取所有管理员信息
List<UserVo> allUserEmail = disasterInfoService.getAllUserEmail();
List<String> userEmails = new ArrayList<>();
allUserEmail.stream().forEach(userVo -> {
//发送信息
// if (userVo.getEmail() != null) {
// userEmails.add(userVo.getEmail());
// }
// 获取灾害详情
email.setTos(new String[]{userVo.getEmail()});
try {
emailService.sendMimeMessage(email);
} catch (Exception e) {
userEmails.add(userVo.getEmail());
}
});
} else {
email.setTos(new String[]{guestInfo.getEmail()});
email.setSubject(disasterInfo.getRefuseTitle()); email.setSubject(disasterInfo.getRefuseTitle());
email.setText(disasterInfo.getRefuseReason()); email.setText(disasterInfo.getRefuseReason());
try {
emailService.sendMimeMessage(email);
} catch (Exception e) {
return R.fail("Sending failed, please check if the email is correct!");
}
} }
Boolean flag = disasterInfoService.updateById(disasterInfo); Boolean flag = disasterInfoService.updateById(disasterInfo);
//保证数据在更新完后发送邮件防止数据更新失败邮件发送成功 //保证数据在更新完后发送邮件防止数据更新失败邮件发送成功
try {
emailService.sendMimeMessage(email);
} catch (Exception e) {
return R.fail("发送失败");
}
return R.data(flag); return R.data(flag);
} }
private final EmailService emailService; private final EmailService emailService;
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@ApiOperation(value = "提交", notes = "传入Tool") @ApiOperation(value = "提交", notes = "传入Tool")
@PostMapping("/submit") @PostMapping("/submit")
@ -375,7 +405,7 @@ public class DisasterInfoController {
//判断是否是分配 //判断是否是分配
String Allocation = disasterInfo.getAllocation(); String Allocation = disasterInfo.getAllocation();
LambdaQueryWrapper<GuestManageDisasterRef> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GuestManageDisasterRef> qw = new LambdaQueryWrapper<>();
qw.eq(GuestManageDisasterRef::getDisasterId,disasterInfo.getId()); qw.eq(GuestManageDisasterRef::getDisasterId, disasterInfo.getId());
GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw); GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw);
one.setStatus(1); one.setStatus(1);
one.setManagerId(chiefId); one.setManagerId(chiefId);
@ -384,29 +414,28 @@ public class DisasterInfoController {
//获得disasterInfo //获得disasterInfo
disasterInfo = disasterInfoService.getById(disasterInfo.getId()); disasterInfo = disasterInfoService.getById(disasterInfo.getId());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
if(!StringUtil.isEmpty(Allocation)){ if (!StringUtil.isEmpty(Allocation)) {
Administrator user = administratorService.getById(chiefId); Administrator user = administratorService.getById(chiefId);
//获取灾害详情
DisasterInfoVo disasterInfoVo = disasterInfoVoService.getById(disasterInfo.getId());
//发送邮件 //发送邮件
Email email = new Email(); Email email = new Email();
email.setSubject("You have a Disaster Response task pending"); email.setSubject("You have a Disaster Response task pending");
String text ="Disaster Keyword:" + disasterInfo.getDisasterKeyword()+"<br>";
text+= "Disaster Time:" + disasterInfo.getDisasterTime()+"<br>"; String html = "<a href='http://121.89.234.154:6300/vordm/Responding'>go and check</a>";
//disaster_country String text = "Dear administrator "+user.getName()+", you have been assigned by the VoRDM office to respond to the "+disasterInfoVo.getDisasterCountry()+" "+ disasterInfoVo.getDictValue()+"("+simpleDateFormat.format(disasterInfoVo.getDisasterTime()) +")"+". Please "+html+" in a timely manner.";
text+= "Disaster Country:" + disasterInfo.getDisasterCountry()+"<br>";
//vordm_id
text+= "VORDM ID:" + disasterInfo.getVordmId()+"<br>";
email.setText(text); email.setText(text);
String [] to = new String[]{user.getEmail()}; String[] to = new String[]{user.getEmail()};
email.setTos(to); email.setTos(to);
email.setHtmlText(true); email.setHtmlText(true);
try { try {
emailService.sendMimeMessage(email); emailService.sendMimeMessage(email);
} catch (Exception e) { } catch (Exception e) {
return R.fail("发送失败"); return R.fail("Sending failed, please check if the email is correct!");
} }
} }
return R.status(disasterInfoService.saveOrUpdate(disasterInfo)); return R.status(disasterInfoService.saveOrUpdate(disasterInfo));
} }
@ -421,6 +450,11 @@ public class DisasterInfoController {
return R.data(disasterInfoService.statistics(year)); return R.data(disasterInfoService.statistics(year));
} }
@GetMapping("/statisticsByUser")
public R statisticsByUser(String year,Long userId,String email) {
return R.data(disasterInfoService.statisticsByUser(year,userId,email));
}
/** /**
* 批量更新灾害的chief管理者 * 批量更新灾害的chief管理者
* *
@ -431,7 +465,7 @@ public class DisasterInfoController {
public R updateBatch(@RequestBody List<DisasterInfo> disasterInfoList) { public R updateBatch(@RequestBody List<DisasterInfo> disasterInfoList) {
disasterInfoList.stream().forEach(disasterInfo -> { disasterInfoList.stream().forEach(disasterInfo -> {
LambdaQueryWrapper<GuestManageDisasterRef> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GuestManageDisasterRef> qw = new LambdaQueryWrapper<>();
qw.eq(GuestManageDisasterRef::getDisasterId,disasterInfo.getId()); qw.eq(GuestManageDisasterRef::getDisasterId, disasterInfo.getId());
GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw); GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw);
one.setStatus(1); one.setStatus(1);
one.setManagerId(disasterInfo.getChiefId()); one.setManagerId(disasterInfo.getChiefId());
@ -474,14 +508,120 @@ public class DisasterInfoController {
return R.data(disasterInfoService.updateById(disasterInfo)); return R.data(disasterInfoService.updateById(disasterInfo));
} }
//chief管理个人中心统计
@GetMapping("/getByUserDisasterInfoStatistics") @GetMapping("/getByUserDisasterInfoStatistics")
public R getByUserDisasterInfo(Long userId) { public R getByUserDisasterInfo(Long userId, String email) {
return R.data(disasterInfoService.getByUserDisasterInfoStatistics(userId)); return R.data(disasterInfoService.getByUserDisasterInfoStatistics(userId,email));
} }
//普通用户个人中心统计
@GetMapping("/getByOrdinaryUserDisasterInfoStatistics")
public R getByOrdinaryUserDisasterInfoStatistics(Long userId, String email) {
return R.data(disasterInfoService.getByOrdinaryUserDisasterInfoStatistics(userId,email));
}
//根据ID删除 //根据ID删除
@DeleteMapping("/deleteByIds") @DeleteMapping("/deleteByIds")
public R deleteByIds(@RequestBody List<Long> ids) { public R deleteByIds(@RequestBody List<Long> ids) {
return R.status(disasterInfoService.removeByIds(ids)); return R.status(disasterInfoService.removeByIds(ids));
} }
//个人中心列表统计
@GetMapping("/getDisasterInfoByUserId")
public R<List<DisasterInfo>> getDisasterInfoByUserId(Long userId, String email) {
return R.data(disasterInfoService.getDisasterInfoByUserId(userId,email));
}
//个人中心列表统计-根据国家分类饼状图
@GetMapping("/getDisasterInfoByUserIdCountry")
public R<Map<String, List<DisasterInfo>>> getDisasterInfoByUserIdCountry(Long userId, String email) {
List<DisasterInfo> disasterInfoByUserId = disasterInfoService.getDisasterInfoByUserId(userId,email);
Map<String, List<DisasterInfo>> collect = disasterInfoByUserId.stream().collect(Collectors.groupingBy(DisasterInfo::getDisasterCountry));
return R.data(collect);
}
/**
* 按月统计当年每个月的响应或者申请量
*
* @return
*/
@GetMapping("/getDisasterInfoByMouth")
public R<List<Map<String, Object>>> getDisasterInfoByMouth(Integer type, Long userId, String email) {
return R.data(disasterInfoService.getDisasterInfoByMouth(type, userId, email));
}
/**
* 管理员发起灾害结束申请
* @param disasterInfo
* @return
*/
@PostMapping("/examineDisasterInfoEnd")
public R<Boolean> examineDisasterInfoEnd(@RequestBody DisasterInfo disasterInfo) {
//是否发起灾害响应结束申请0未发起/1发起审批/2审批通过/3审批不通过
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (disasterInfo.getIsEndApply()==2){
DisasterInfoVo disasterInfoVo = disasterInfoVoService.getById(disasterInfo.getId());
//发送邮件
Email email = new Email();
email.setSubject("You have a Disaster Response task pending");
String text = "The disaster reduction task of "+disasterInfoVo.getDisasterCountry()+" "+disasterInfoVo.getDictValue()+"("+simpleDateFormat.format(disasterInfoVo.getDisasterTime())+")" +" you claimed has been completed!";
email.setText(text);
String[] to = new String[]{disasterInfo.getEmail()};
email.setTos(to);
try {
disasterInfo.setRespondStatus(3);
emailService.sendMimeMessage(email);
disasterInfoService.updateById(disasterInfo);
} 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());
//发送邮件
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!";
email.setText(text);
String[] to = new String[]{user.getEmail()};
email.setTos(to);
try {
emailService.sendMimeMessage(email);
disasterInfoService.updateById(disasterInfo);
} catch (Exception e) {
return R.fail("Sending failed, please check if the email is correct!");
}
}
return R.data(disasterInfoService.updateById(disasterInfo));
}
@GetMapping("/getUserDisasterInfoList")
public R<IPage<DisasterInfo>> getUserDisasterInfoList(Query query, @RequestParam Map<String, String> params) {
String type = params.get("type");
if (type.equals("0")){
IPage<DisasterInfo> centerDisasterInfoIPage = disasterInfoService.getUserDisasterInfoListNCI(Condition.getPage(query),params.get("email"));
return R.data(centerDisasterInfoIPage);
}else {
if (params.get("respondStatus") != null){
IPage<DisasterInfo> centerDisasterInfoIPage = disasterInfoService.getUserDisasterInfoListNDRNew(Condition.getPage(query),params.get("userId"),params.get("respondStatus"));
return R.data(centerDisasterInfoIPage);
}else {
IPage<DisasterInfo> centerDisasterInfoIPage = disasterInfoService.getUserDisasterInfoListNDR(Condition.getPage(query),params.get("userId"));
return R.data(centerDisasterInfoIPage);
}
}
}
} }

View File

@ -81,11 +81,24 @@ public class RemoteSensingSourceDataController {
return R.status(remoteSensingSourceDataService.updateById(remoteSensingSourceData)); return R.status(remoteSensingSourceDataService.updateById(remoteSensingSourceData));
} }
@PostMapping("/approvalMultiple")
public R approvalMultiple(@RequestBody RemoteSensingSourceData remoteSensingSourceData){
String idsList = remoteSensingSourceData.getIdsList();
List<String> collect = Stream.of(idsList.split(",")).collect(Collectors.toList());
collect.stream().forEach(id->{
remoteSensingSourceData.setId(Long.parseLong(id));
remoteSensingSourceDataService.updateById(remoteSensingSourceData);
});
return R.status(true);
}
@PostMapping("/addRemoteSensingSourceData") @PostMapping("/addRemoteSensingSourceData")
public R addRemoteSensingSourceData(@RequestBody RemoteSensingSourceData remoteSensingSourceData){ public R addRemoteSensingSourceData(@RequestBody RemoteSensingSourceData remoteSensingSourceData){
return R.status(remoteSensingSourceDataService.save(remoteSensingSourceData)); return R.status(remoteSensingSourceDataService.save(remoteSensingSourceData));
} }
/** /**
* 导入 * 导入
* @param file * @param file

View File

@ -51,6 +51,9 @@ public class ToolController{
if(!StringUtils.isEmpty(tool.getLabel())){ if(!StringUtils.isEmpty(tool.getLabel())){
queryWrapper.like("Introduction", tool.getLabel()).or().like("label", tool.getLabel()); queryWrapper.like("Introduction", tool.getLabel()).or().like("label", tool.getLabel());
} }
if(tool.getUploader()!=null) {
queryWrapper.eq("uploader", tool.getUploader());
}
String checkd = tool.getChecked(); String checkd = tool.getChecked();
if(checkd != null && checkd.equals("1")){ if(checkd != null && checkd.equals("1")){
queryWrapper.isNull("review_time"); queryWrapper.isNull("review_time");
@ -170,5 +173,20 @@ public class ToolController{
public R getStatisticsByUserId(Long id, String year) { public R getStatisticsByUserId(Long id, String year) {
return R.data(toolService.getStatisticsByUserId(id, year)); return R.data(toolService.getStatisticsByUserId(id, year));
} }
//普通用户个人中心统计
@GetMapping("/getStatisticsByUserIdPancake")
public R getStatisticsByUserIdPancake(Long userId) {
return R.data(toolService.getStatisticsByUserIdPancake(userId));
}
//管理员获取未被审批得工具信息
@GetMapping("/getUnauditedTool")
public R getUnauditedTool() {
return R.data(toolService.getUnauditedTool());
}
} }

View File

@ -1,7 +1,11 @@
package com.kening.vordm.mapper; package com.kening.vordm.mapper;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.vo.CenterDisasterInfo; import com.kening.vordm.vo.CenterDisasterInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author wangns * @author wangns
@ -11,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface CenterDisasterInfoMapper extends BaseMapper<CenterDisasterInfo> { public interface CenterDisasterInfoMapper extends BaseMapper<CenterDisasterInfo> {
} }

View File

@ -31,17 +31,20 @@
<result property="status" column="status" jdbcType="INTEGER"/> <result property="status" column="status" jdbcType="INTEGER"/>
<result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/> <result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
<result property="reviewTime" column="review_time" jdbcType="TIMESTAMP"/> <result property="reviewTime" column="review_time" jdbcType="TIMESTAMP"/>
<result property="sponsorId" column="sponsor_id" jdbcType="BIGINT"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,disaster_type,disaster_keyword, di.id,di.disaster_type,di.disaster_keyword,
disaster_time,upload_time,geometry, di.disaster_time,di.upload_time,di.geometry,
disaster_level,disaster_country,respond_status, di.disaster_level,di.disaster_country,di.respond_status,
visit_count,download_count,spider_type, di.visit_count,di.download_count,di.spider_type,
tempend_time,temp_start_time,create_time, di.tempend_time,di.temp_start_time,di.create_time,
vordm_id,respond_time,sponsor_organization, di.vordm_id,di.respond_time,di.sponsor_organization,
dict_value,disaster_img,size, di.dict_value,di.disaster_img,di.size,
news,user_name,status, di.news,di.user_name,di.status,
apply_time,review_time di.apply_time,di.review_time
</sql> </sql>
</mapper> </mapper>

View File

@ -0,0 +1,23 @@
package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.vo.CenterDisasterInfoUser;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Mapper
* @createDate 2023-04-19 11:46:32
* @Entity com.kening.vordm.vo.CenterDisasterInfo
*/
public interface CenterDisasterInfoUserMapper extends BaseMapper<CenterDisasterInfoUser> {
IPage<CenterDisasterInfoUser> respondedUserList(IPage<CenterDisasterInfoUser> page,@Param("params") Map<String, Object> params);
}

View File

@ -0,0 +1,62 @@
<?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.CenterDisasterInfoUserMapper">
<resultMap id="BaseResultMap" type="com.kening.vordm.vo.CenterDisasterInfoUser">
<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="dictValue" column="dict_value" jdbcType="VARCHAR"/>
<result property="disasterImg" column="disaster_img" jdbcType="VARCHAR"/>
<result property="size" column="size" jdbcType="DECIMAL"/>
<result property="news" column="news" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="applyTime" column="apply_time" jdbcType="TIMESTAMP"/>
<result property="reviewTime" column="review_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
cdiu.id,cdiu.disaster_type,cdiu.disaster_keyword,
cdiu.disaster_time,cdiu.upload_time,cdiu.geometry,
cdiu.disaster_level,cdiu.disaster_country,cdiu.respond_status,
cdiu.visit_count,cdiu.download_count,cdiu.spider_type,
cdiu.tempend_time,cdiu.temp_start_time,cdiu.create_time,
cdiu.vordm_id,cdiu.respond_time,cdiu.sponsor_organization,
cdiu.dict_value,cdiu.disaster_img,cdiu.size,
cdiu.news,cdiu.user_name,cdiu.status,
cdiu.apply_time,cdiu.review_time
</sql>
<select id="respondedUserList" resultType="com.kening.vordm.vo.CenterDisasterInfoUser">
select
<include refid="Base_Column_List"/>
from center_disaster_info_user cdiu
<where>
and cdiu.status = 1
<if test='params.idList != null and params.idList.size() > 0'>
and cdiu.id IN
<foreach collection="params.idList" index="index" item="Id" open="(" separator="," close=")">
#{Id}
</foreach>
</if>
</where>
</select>
</mapper>

View File

@ -83,4 +83,24 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
CallForHelpVo getByUserIdRole(@Param("chiefIdEquals") Long chiefIdEquals); CallForHelpVo getByUserIdRole(@Param("chiefIdEquals") Long chiefIdEquals);
IPage<DisasterInfo> respondedUserList(IPage<DisasterInfo> page, Map<String, Object> params);
List<DisasterInfo> getDisasterInfoByUserIdNCI(@Param("userId") Long userId,@Param("email") String email);
List<DisasterInfo> getDisasterInfoByUserIdNDR(@Param("userId") Long userId);
List<DisasterInfo> getDisasterInfoByUserIdNR(@Param("userId") Long userId);
List<Map<String, Object>> getDisasterInfoByMouthNew(@Param("start") String start,@Param("end") String end,@Param("userId") Long userId,@Param("email") String email);
List<UserVo> getAllUserEmail();
List<Map<String, Long>> initiateAndResponseDataByUser(@Param("year") String year,@Param("userId") Long userId,@Param("email") String email);
IPage<DisasterInfo> getUserDisasterInfoListNCI(IPage<Object> page,@Param("email") String email);
IPage<DisasterInfo> getUserDisasterInfoListNDR(IPage<Object> page,@Param("userId") String userId);
IPage<DisasterInfo> getUserDisasterInfoListNDRNew(IPage<Object> page,@Param("userId") String userId,@Param("respondStatus") String respondStatus);
} }

View File

@ -24,6 +24,7 @@
<result property="respondTime" column="respond_time" jdbcType="TIMESTAMP"/> <result property="respondTime" column="respond_time" jdbcType="TIMESTAMP"/>
<result property="sponsorOrganization" column="sponsor_organization" jdbcType="TIMESTAMP"/> <result property="sponsorOrganization" column="sponsor_organization" jdbcType="TIMESTAMP"/>
<result property="respondedTime" column="responded_time" jdbcType="TIMESTAMP"/> <result property="respondedTime" column="responded_time" jdbcType="TIMESTAMP"/>
<result property="isEndApply" column="is_end_apply" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -35,7 +36,8 @@
di.disaster_level,di.disaster_country,di.respond_status, di.disaster_level,di.disaster_country,di.respond_status,
di.visit_count,di.spider_type,di.tempend_time, di.visit_count,di.spider_type,di.tempend_time,
di.temp_start_time,di.create_time,di.vordm_id, di.temp_start_time,di.create_time,di.vordm_id,
di.respond_time,di.download_count,di.sponsor_organization,di.responded_time di.respond_time,di.download_count,di.sponsor_organization,
di.responded_time,di.is_end_apply
</sql> </sql>
<sql id="Home_Disaster_Info"> <sql id="Home_Disaster_Info">
@ -129,7 +131,7 @@
left join guest_info gi on gi.id = gmdr.sponsor_id left join guest_info gi on gi.id = gmdr.sponsor_id
where gi.username != '' where gi.username != ''
GROUP BY gi.username GROUP BY gi.username
ORDER BY cnt desc LIMIT 5 ORDER BY cnt desc LIMIT 10
</select> </select>
<select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse"> <select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse">
@ -139,12 +141,12 @@
FROM disaster_info t FROM disaster_info t
INNER JOIN guest_manage_disaster_ref gm ON gm.disaster_id = t.id INNER JOIN guest_manage_disaster_ref gm ON gm.disaster_id = t.id
INNER JOIN guest_info g ON g.id = gm.sponsor_id INNER JOIN guest_info g ON g.id = gm.sponsor_id
WHERE gm.`status` != 2 WHERE gm.`status` != 2 and gm.`status` != 0
GROUP BY GROUP BY
gm.sponsor_id gm.sponsor_id
ORDER BY ORDER BY
cnt DESC cnt DESC
LIMIT 5 LIMIT 10
</select> </select>
<select id="getLeft1Data" resultType="com.kening.vordm.vo.GroupByUse"> <select id="getLeft1Data" resultType="com.kening.vordm.vo.GroupByUse">
@ -159,7 +161,7 @@
and b.parent_id != 0 and b.parent_id != 0
group by b.dict_key, b.dict_value group by b.dict_key, b.dict_value
order by cnt desc order by cnt desc
limit 7 limit 10
</select> </select>
<select id="getLeft2Data" resultType="com.kening.vordm.vo.GroupByUse"> <select id="getLeft2Data" resultType="com.kening.vordm.vo.GroupByUse">
@ -168,7 +170,7 @@
INNER JOIN INNER JOIN
(select t.disaster_country as name, count(*) as cnt, 'country' as `type` (select t.disaster_country as name, count(*) as cnt, 'country' as `type`
from disaster_info t from disaster_info t
group by t.disaster_country limit 7) b on c.flagname = b.`name` group by t.disaster_country limit 10) b on c.flagname = b.`name`
order by b.cnt desc order by b.cnt desc
</select> </select>
@ -194,6 +196,7 @@
d.geometry, d.geometry,
d.respond_status, d.respond_status,
d.responded_time, d.responded_time,
d.is_end_apply,
ud.review_time AS reviewTime, ud.review_time AS reviewTime,
bdb.dict_value as dictValue bdb.dict_value as dictValue
From From
@ -205,6 +208,9 @@
<if test="callForHelpVo.respondStatus!=null"> <if test="callForHelpVo.respondStatus!=null">
d.respond_status = #{callForHelpVo.respondStatus} d.respond_status = #{callForHelpVo.respondStatus}
</if> </if>
<if test="callForHelpVo.isEndApply!=null">
and d.is_end_apply = #{callForHelpVo.isEndApply}
</if>
<if test="callForHelpVo.chiefIdEquals != null"> <if test="callForHelpVo.chiefIdEquals != null">
and d.chief_id = #{callForHelpVo.chiefIdEquals} and d.chief_id = #{callForHelpVo.chiefIdEquals}
</if> </if>
@ -276,11 +282,107 @@
where date_format(t.disaster_time, '%Y') = #{year} where date_format(t.disaster_time, '%Y') = #{year}
</select> </select>
<select id="visitAndDownLoad" resultType="java.util.Map"> <select id="visitAndDownLoad" resultType="java.util.Map">
SELECT d.dict_value, SUM(t.visit_count) as visit, SUM(t.download_count) as download select d.`key`, sum(d.response) as response, SUM(d.initiate) as initiate
FROM disaster_info t from (
INNER JOIN blade_dict_biz d on t.disaster_type = d.dict_key SELECT CONCAT(#{year}, '-01') as `key`, 0 as response, sum(t.visit_count) as initiate
where date_format(t.disaster_time, '%Y') = #{year} FROM disaster_info t
GROUP BY d.dict_value where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02')
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03')
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04')
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, 0 as response, sum(t.visit_count) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
union ALL
SELECT CONCAT(#{year}, '-01') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-01')
union ALL
SELECT CONCAT(#{year}, '-02') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-02')
union ALL
SELECT CONCAT(#{year}, '-03') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-03')
union ALL
SELECT CONCAT(#{year}, '-04') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-04')
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-05')
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-06')
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-07')
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-08')
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-09')
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-10')
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-11')
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, sum(t.download_count) as response, 0 as initiate
FROM disaster_info t
where date_format(t.respond_time, '%Y-%m') = CONCAT(#{year}, '-12')) d
GROUP BY d.`key`
ORDER BY d.`key`
</select> </select>
<select id="initiateAndResponseData" resultType="java.util.Map"> <select id="initiateAndResponseData" resultType="java.util.Map">
select d.`key`, sum(d.response) as response, SUM(d.initiate) as initiate select d.`key`, sum(d.response) as response, SUM(d.initiate) as initiate
@ -388,7 +490,7 @@
<select id="chiefData" resultType="java.util.Map"> <select id="chiefData" resultType="java.util.Map">
SELECT b.`name`, count(*) as val SELECT b.`name`, count(*) as val
FROM disaster_info t FROM disaster_info t
INNER JOIN blade_user b on t.chief_id = b.id INNER JOIN blade_user b on t.chief_id = b.id
where date_format(t.disaster_time, '%Y') = #{year} where date_format(t.disaster_time, '%Y') = #{year}
and b.`name` != "超级管理员" and b.`name` != "超级管理员"
GROUP BY b.`name` GROUP BY b.`name`
@ -396,58 +498,23 @@
</select> </select>
<select id="adminData" resultType="java.util.Map"> <select id="adminData" resultType="java.util.Map">
select d.`key` AS 'name', SUM(d.initiate) as val SELECT
from ( b.`name`,
SELECT CONCAT(#{year}, '-01') as `key`, count(1) as initiate count(*) AS val
FROM disaster_info t FROM
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01') disaster_info t
union ALL LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = t.id
SELECT CONCAT(#{year}, '-02') as `key`, count(1) as initiate LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
FROM disaster_info t INNER JOIN blade_user b ON gi.email = b.email
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-02') WHERE
union ALL date_format( t.disaster_time, '%Y' ) = #{year}
SELECT CONCAT(#{year}, '-03') as `key`, count(1) as initiate
FROM disaster_info t AND b.`name` != "超级管理员"
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-03') GROUP BY
union ALL b.`name`
SELECT CONCAT(#{year}, '-04') as `key`, count(1) as initiate ORDER BY
FROM disaster_info t val DESC
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-04') LIMIT 10
union ALL
SELECT CONCAT(#{year}, '-05') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-05')
union ALL
SELECT CONCAT(#{year}, '-06') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-06')
union ALL
SELECT CONCAT(#{year}, '-07') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-07')
union ALL
SELECT CONCAT(#{year}, '-08') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-08')
union ALL
SELECT CONCAT(#{year}, '-09') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-09')
union ALL
SELECT CONCAT(#{year}, '-10') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-10')
union ALL
SELECT CONCAT(#{year}, '-11') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-11')
union ALL
SELECT CONCAT(#{year}, '-12') as `key`, count(1) as initiate
FROM disaster_info t
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-12')
) d
GROUP BY d.`key`
ORDER BY d.`key`
</select> </select>
@ -469,4 +536,285 @@
WHERE bu.id = #{chiefIdEquals} WHERE bu.id = #{chiefIdEquals}
</select> </select>
<select id="respondedUserList" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>,
bdb.dict_value AS dictValue
from disaster_info di
left JOIN blade_dict_biz bdb on bdb.dict_key = di.disaster_type and code = 'disaster'
<where>
and (di.respond_status = 2 or di.respond_status = 3)
<if test='params.idList != null and params.idList.size() > 0'>
and di.id IN
<foreach collection="params.idList" index="index" item="Id" open="(" separator="," close=")">
#{Id}
</foreach>
</if>
</where>
</select>
<select id="getDisasterInfoByUserIdNCI" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
<where>
gi.email = #{email}
and gmdr.status != 2
</where>
</select>
<select id="getDisasterInfoByUserIdNDR" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
<where>
di.chief_id = #{userId}
and di.respond_status > 1
</where>
</select>
<select id="getDisasterInfoByUserIdNR" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
left join entity_data ed on ed.disaster_id = di.id
where
ed.uploader_id = #{userId}
GROUP BY di.id
</select>
<select id="getDisasterInfoByMouthNew" resultType="java.util.Map">
SELECT
date_format(di.disaster_time,'%m') AS date,
COUNT(1) AS value
FROM
disaster_info di
left join guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
WHERE
di.disaster_time BETWEEN #{start} AND #{end}
<if test="email != null">
and gi.email = #{email}
and gmdr.status != 2
</if>
GROUP BY date
</select>
<select id="getAllUserEmail" resultType="com.kening.vordm.vo.UserVo">
SELECT *
FROM blade_user bu
WHERE bu.role_id = '1123598816738675203'
</select>
<select id="initiateAndResponseDataByUser" resultType="java.util.Map">
select d.`key`, sum(d.response) as response, SUM(d.initiate) as initiate
from (
SELECT CONCAT(#{year}, '-01') 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_info gi on gi.id = gmdr.sponsor_id
where date_format(t.disaster_time, '%Y-%m') = CONCAT(#{year}, '-01')
and gi.email = #{email}
and gmdr.status != 2
union ALL
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_info gi on gi.id = gmdr.sponsor_id
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
union ALL
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')
and gmdr.manager_id = #{userId}
) d
GROUP BY d.`key`
ORDER BY d.`key`
</select>
<select id="getUserDisasterInfoListNCI" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
<where>
gi.email = #{email}
and gmdr.status != 2
</where>
</select>
<select id="getUserDisasterInfoListNDR" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
<where>
gmdr.manager_id = #{userId}
</where>
</select>
<select id="getUserDisasterInfoListNDRNew" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>
from disaster_info di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
<where>
gmdr.manager_id = #{userId}
and di.respond_status = #{respondStatus}
and di.is_end_apply = 0
</where>
</select>
</mapper> </mapper>

View File

@ -2,10 +2,13 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.GuestInfo; import com.kening.vordm.entity.GuestInfo;
import com.kening.vordm.vo.UserVo; import com.kening.vordm.vo.UserVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author G1393 * @author G1393
* @description 针对表guest_info(游客信息表/志愿者)的数据库操作Mapper * @description 针对表guest_info(游客信息表/志愿者)的数据库操作Mapper
@ -21,11 +24,17 @@ public interface GuestInfoMapper extends BaseMapper<GuestInfo> {
int updateAccount(@Param("userVo") UserVo userVo); int updateAccount(@Param("userVo") UserVo userVo);
int getByUserStatisticsOne(@Param("userId") Long userId); int getByUserStatisticsOne(@Param("userId") Long userId,@Param("email") String email);
int getByUserStatisticsTwo(@Param("userId") Long userId); int getByUserStatisticsTwo(@Param("userId") Long userId);
int getByUserStatisticsThree(@Param("userId") Long userId); int getByUserStatisticsThree(@Param("userId") Long userId);
int getByUserStatisticsFour(@Param("userId") Long userId); int getByUserStatisticsFour(@Param("userId") Long userId);
int getByUserStatisticsOneNew(@Param("userId") Long userId,@Param("email") String email);
int getByUserStatisticsThreeNew(@Param("userId") Long userId);
} }

View File

@ -43,9 +43,11 @@
<select id="getByUserStatisticsOne" resultType="java.lang.Integer"> <select id="getByUserStatisticsOne" resultType="java.lang.Integer">
select count(di.id) select count(di.id)
FROM disaster_info di FROM disaster_info di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
<where> <where>
di.chief_id = #{userId} gi.email = #{email}
and di.respond_status = 3 and gmdr.status != 2
</where> </where>
</select> </select>
@ -54,9 +56,8 @@
FROM disaster_info di FROM disaster_info di
<where> <where>
di.chief_id = #{userId} di.chief_id = #{userId}
and di.respond_status = 2 and di.respond_status > 1
</where> </where>
</select> </select>
<select id="getByUserStatisticsThree" resultType="java.lang.Integer"> <select id="getByUserStatisticsThree" resultType="java.lang.Integer">
@ -76,4 +77,24 @@
and ed.manager_id = null and ed.manager_id = null
</where> </where>
</select> </select>
<select id="getByUserStatisticsOneNew" resultType="java.lang.Integer">
select count(di.id)
FROM guest_manage_disaster_ref di
LEFT JOIN guest_manage_disaster_ref gmdr on gmdr.disaster_id = di.id
LEFT JOIN guest_info gi on gi.id = gmdr.sponsor_id
<where>
gi.email = #{email}
and gmdr.status != 2
</where>
</select>
<select id="getByUserStatisticsThreeNew" resultType="java.lang.Integer">
select count(ed.id)
FROM entity_data ed
<where>
ed.uploader_id = #{userId}
</where>
</select>
</mapper> </mapper>

View File

@ -3,6 +3,7 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kening.vordm.entity.Tool; import com.kening.vordm.entity.Tool;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -21,4 +22,10 @@ public interface ToolMapper extends BaseMapper<Tool> {
Integer selectCountShowName(); Integer selectCountShowName();
List<Map<String, Long>> getStatisticsByUserId(Long id, String year); List<Map<String, Long>> getStatisticsByUserId(Long id, String year);
int getByUserStatistics(@Param("userId") Long userId);
List<Tool> getStatisticsByUserIdPancake(@Param("userId") Long userId);
List<Tool> getStatisticsByUserIdPancakeNew(@Param("userId") Long userId);
} }

View File

@ -21,6 +21,8 @@
<result property="showName" column="show_name" jdbcType="VARCHAR"/> <result property="showName" column="show_name" jdbcType="VARCHAR"/>
<result property="mailbox" column="mailbox" jdbcType="VARCHAR"/> <result property="mailbox" column="mailbox" jdbcType="VARCHAR"/>
<result property="paperLink" column="paper_link" jdbcType="VARCHAR"/> <result property="paperLink" column="paper_link" jdbcType="VARCHAR"/>
<result property="toolVisits" column="tool_visits" jdbcType="INTEGER"/>
<result property="paperVisits" column="paper_visits" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -28,7 +30,7 @@
Introduction,link,detail, Introduction,link,detail,
create_time,upload_id,manager_id, create_time,upload_id,manager_id,
review_time,type,voluntary_flag, review_time,type,voluntary_flag,
uploader,show_name,mailbox,paper_link uploader,show_name,mailbox,paper_link,tool_visits,paper_visits
</sql> </sql>
<select id="toolRanking" resultType="com.kening.vordm.entity.Tool"> <select id="toolRanking" resultType="com.kening.vordm.entity.Tool">
@ -111,4 +113,33 @@
GROUP BY d.`key` GROUP BY d.`key`
ORDER BY d.`key` ORDER BY d.`key`
</select> </select>
<select id="getByUserStatistics" resultType="java.lang.Integer">
select count(id)
FROM tool
<where>
uploader = #{userId}
and review_time IS NOT NULL
</where>
</select>
<select id="getStatisticsByUserIdPancake" resultType="com.kening.vordm.entity.Tool">
select
<include refid="Base_Column_List"/>
FROM tool
<where>
uploader = #{userId}
</where>
ORDER BY tool_visits DESC
</select>
<select id="getStatisticsByUserIdPancakeNew" resultType="com.kening.vordm.entity.Tool">
select
<include refid="Base_Column_List"/>
FROM tool
<where>
uploader = #{userId}
</where>
ORDER BY paper_visits DESC
</select>
</mapper> </mapper>

View File

@ -25,7 +25,7 @@
di.disaster_time as disasterTime, di.disaster_time as disasterTime,
di.disaster_country as disasterCountry di.disaster_country as disasterCountry
from disaster_info di from disaster_info di
left join blade_dict_biz bdb on di.disaster_type = dict_key left join blade_dict_biz bdb on di.disaster_type = dict_key
</select> </select>
<select id="queryPage" resultType="com.kening.vordm.entity.DataUpload"> <select id="queryPage" resultType="com.kening.vordm.entity.DataUpload">

View File

@ -1,7 +1,7 @@
package com.kening.vordm.service; package com.kening.vordm.service;
import com.kening.vordm.vo.CenterDisasterInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.vo.CenterDisasterInfo;
/** /**
* @author wangns * @author wangns

View File

@ -0,0 +1,18 @@
package com.kening.vordm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.vo.CenterDisasterInfoUser;
import java.util.Map;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Service
* @createDate 2023-04-19 11:46:32
*/
public interface CenterDisasterInfoUserService extends IService<CenterDisasterInfoUser> {
IPage<DisasterInfo> respondedUserList(IPage<DisasterInfo> page, Map<String, Object> params);
}

View File

@ -2,10 +2,7 @@ package com.kening.vordm.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.Administrator;
import com.kening.vordm.entity.DataUpload;
import com.kening.vordm.entity.EntityData; import com.kening.vordm.entity.EntityData;
import org.springblade.core.mp.base.BaseService;
import java.util.Map; import java.util.Map;

View File

@ -71,7 +71,23 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
Integer getByUserDisasterInfo(Long userId, Long disasterId); Integer getByUserDisasterInfo(Long userId, Long disasterId);
UserVo getByUserDisasterInfoStatistics(Long userId); UserVo getByUserDisasterInfoStatistics(Long userId, String email);
CallForHelpVo getByUserIdRole(Long chiefIdEquals); CallForHelpVo getByUserIdRole(Long chiefIdEquals);
UserVo getByOrdinaryUserDisasterInfoStatistics(Long userId, String email);
List<DisasterInfo> getDisasterInfoByUserId(Long userId, String email);
List<Map<String, Object>> getDisasterInfoByMouth(Integer type, Long userId, String email);
List<UserVo> getAllUserEmail();
Map<String,Object> statisticsByUser(String year, Long userId,String email);
IPage<DisasterInfo> getUserDisasterInfoListNCI(IPage<Object> page, String email);
IPage<DisasterInfo> getUserDisasterInfoListNDR(IPage<Object> page, String userId);
IPage<DisasterInfo> getUserDisasterInfoListNDRNew(IPage<Object> page, String userId, String respondStatus);
} }

View File

@ -19,4 +19,10 @@ public interface ToolService extends IService<Tool> {
Object statistics(); Object statistics();
List<Map<String, Long>> getStatisticsByUserId(Long id, String year); List<Map<String, Long>> getStatisticsByUserId(Long id, String year);
Map<String, Object> getStatisticsByUserIdPancake(Long userId);
List<Tool> getUnauditedTool();
} }

View File

@ -1,5 +1,6 @@
package com.kening.vordm.service.impl; package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.vo.CenterDisasterInfo; import com.kening.vordm.vo.CenterDisasterInfo;
import com.kening.vordm.service.CenterDisasterInfoService; import com.kening.vordm.service.CenterDisasterInfoService;

View File

@ -0,0 +1,62 @@
package com.kening.vordm.service.impl;
import com.alibaba.nacos.common.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.mapper.CenterDisasterInfoUserMapper;
import com.kening.vordm.mapper.DisasterInfoMapper;
import com.kening.vordm.mapper.EntityDataMapper;
import com.kening.vordm.mapper.GuestInfoMapper;
import com.kening.vordm.service.CenterDisasterInfoUserService;
import com.kening.vordm.vo.CenterDisasterInfoUser;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Service实现
* @createDate 2023-04-19 11:46:32
*/
@Service
@RequiredArgsConstructor
public class CenterDisasterInfoUserServiceImpl extends ServiceImpl<CenterDisasterInfoUserMapper, CenterDisasterInfoUser>
implements CenterDisasterInfoUserService {
private final EntityDataMapper entityDataMapper;
private final DisasterInfoMapper disasterInfoMapper;
@Override
public IPage<DisasterInfo> respondedUserList(IPage<DisasterInfo> page, Map<String, Object> params) {
LambdaQueryWrapper<EntityData> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(EntityData::getUploaderId,params.get("userId"));
List<EntityData> entityData = entityDataMapper.selectList(queryWrapper);
Map<Long, List<EntityData>> collect = entityData.stream().collect(Collectors.groupingBy(EntityData::getDisasterId));
List<String> isList = new ArrayList<>();
for (Map.Entry entry : collect.entrySet()) {
String key = entry.getKey().toString();
isList.add(key);
}
if (!isList.isEmpty()){
params.put("idList", isList);
return disasterInfoMapper.respondedUserList(page,params);
}else {
List<DisasterInfo> objects = new ArrayList<>();
page.setRecords(objects);
page.setTotal(0);
return page;
}
}
}

View File

@ -6,12 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.kening.vordm.entity.DisasterData; import com.kening.vordm.entity.*;
import com.kening.vordm.entity.DisasterInfo; import com.kening.vordm.mapper.*;
import com.kening.vordm.entity.GuestInfo;
import com.kening.vordm.entity.GuestManageDisasterRef;
import com.kening.vordm.mapper.DisasterInfoMapper;
import com.kening.vordm.mapper.GuestInfoMapper;
import com.kening.vordm.service.DisasterInfoService; import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.GuestManageDisasterRefService; import com.kening.vordm.service.GuestManageDisasterRefService;
import com.kening.vordm.vo.*; import com.kening.vordm.vo.*;
@ -26,10 +22,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -46,6 +39,8 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
private final GuestInfoMapper guestInfoMapper; private final GuestInfoMapper guestInfoMapper;
private final ToolMapper toolMapper;
private final GuestManageDisasterRefService guestManageDisasterRefService; private final GuestManageDisasterRefService guestManageDisasterRefService;
/** /**
@ -183,6 +178,7 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
/** /**
* 移除管理灾害权限 * 移除管理灾害权限
*
* @param disasterInfoList * @param disasterInfoList
* @return * @return
*/ */
@ -199,7 +195,7 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
@Override @Override
public GuestInfo getUserByEmail(String email) { public GuestInfo getUserByEmail(String email) {
LambdaQueryWrapper<GuestInfo> qw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GuestInfo> qw = new LambdaQueryWrapper<>();
qw.eq(GuestInfo::getEmail,email); qw.eq(GuestInfo::getEmail, email);
return guestInfoMapper.selectOne(qw); return guestInfoMapper.selectOne(qw);
} }
@ -211,27 +207,27 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
@Override @Override
public Integer getByUserDisasterInfo(Long userId, Long disasterId) { public Integer getByUserDisasterInfo(Long userId, Long disasterId) {
LambdaQueryWrapper<GuestManageDisasterRef> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<GuestManageDisasterRef> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GuestManageDisasterRef::getDisasterId,disasterId); queryWrapper.eq(GuestManageDisasterRef::getDisasterId, disasterId);
queryWrapper.eq(GuestManageDisasterRef::getStatus,1); queryWrapper.eq(GuestManageDisasterRef::getStatus, 1);
queryWrapper.eq(GuestManageDisasterRef::getManagerId,userId); queryWrapper.eq(GuestManageDisasterRef::getManagerId, userId);
return guestManageDisasterRefService.count(queryWrapper); return guestManageDisasterRefService.count(queryWrapper);
} }
@Override @Override
public UserVo getByUserDisasterInfoStatistics(Long userId) { public UserVo getByUserDisasterInfoStatistics(Long userId, String email) {
//已响应 //发起人
int byUserStatisticsOne = guestInfoMapper.getByUserStatisticsOne(userId); int byUserStatisticsOne = guestInfoMapper.getByUserStatisticsOne(userId,email);
//正在响应 //正在响应
int byUserStatisticsTwo = guestInfoMapper.getByUserStatisticsTwo(userId); int byUserStatisticsTwo = guestInfoMapper.getByUserStatisticsTwo(userId);
//已审核数据数量 //贡献灾害内容得次数
int byUserStatisticsThree = guestInfoMapper.getByUserStatisticsThree(userId); int byUserStatisticsThree = guestInfoMapper.getByUserStatisticsThreeNew(userId);
//待审核数据数量 //用户上传的工具数量
int byUserStatisticsFour = guestInfoMapper.getByUserStatisticsFour(userId); int byUserStatistics = toolMapper.getByUserStatistics(userId);
UserVo userVo = new UserVo(); UserVo userVo = new UserVo();
userVo.setByUserStatisticsOne(byUserStatisticsOne); userVo.setByUserStatisticsOne(byUserStatisticsTwo);
userVo.setByUserStatisticsTwo(byUserStatisticsTwo); userVo.setByUserStatisticsTwo(byUserStatisticsOne);
userVo.setByUserStatisticsThree(byUserStatisticsThree); userVo.setByUserStatisticsThree(byUserStatisticsThree);
userVo.setByUserStatisticsFour(byUserStatisticsFour); userVo.setByUserStatisticsFour(byUserStatistics);
return userVo; return userVo;
} }
@ -240,55 +236,133 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
return this.baseMapper.getByUserIdRole(chiefIdEquals); return this.baseMapper.getByUserIdRole(chiefIdEquals);
} }
@Override
public UserVo getByOrdinaryUserDisasterInfoStatistics(Long userId, String email) {
//正在响应
int byUserStatisticsOne = guestInfoMapper.getByUserStatisticsOneNew(userId,email);
//贡献灾害内容得次数
int byUserStatisticsThree = guestInfoMapper.getByUserStatisticsThreeNew(userId);
//用户上传的工具数量
int byUserStatistics = toolMapper.getByUserStatistics(userId);
UserVo userVo = new UserVo();
userVo.setByUserStatisticsTwo(byUserStatisticsOne);
userVo.setByUserStatisticsThree(byUserStatisticsThree);
userVo.setByUserStatisticsFour(byUserStatistics);
return userVo;
}
@Override
public List<DisasterInfo> getDisasterInfoByUserId(Long userId, String email) {
//用户发起的
List<DisasterInfo> disasterInfoByUserIdNCI = baseMapper.getDisasterInfoByUserIdNCI(userId,email);
//用户响应的
List<DisasterInfo> disasterInfoByUserIdNDR = baseMapper.getDisasterInfoByUserIdNDR(userId);
//用户有上传资源的
List<DisasterInfo> disasterInfoByUserIdNR = baseMapper.getDisasterInfoByUserIdNR(userId);
List<DisasterInfo> disasterInfoList = new ArrayList<>();
disasterInfoList.addAll(disasterInfoByUserIdNCI);
disasterInfoList.addAll(disasterInfoByUserIdNDR);
disasterInfoList.addAll(disasterInfoByUserIdNR);
ArrayList<DisasterInfo> disList = disasterInfoList.stream().collect(
Collectors.collectingAndThen(
Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(DisasterInfo::getId))
)
, ArrayList::new
)
);
List<DisasterInfo> disasterInfoList1 = new ArrayList<>();
disList.stream().forEach(disasterInfo -> {
disasterInfo.setIsNci(false);
disasterInfo.setIsNdr(false);
disasterInfo.setIsNr(false);
if (!disasterInfoByUserIdNCI.isEmpty()) {
disasterInfoByUserIdNCI.stream().forEach(disasterInfo1 -> {
if (disasterInfo1.getId().compareTo(disasterInfo.getId()) == 0) {
disasterInfo.setIsNci(true);
}
});
}
if (!disasterInfoByUserIdNDR.isEmpty()) {
disasterInfoByUserIdNDR.stream().forEach(disasterInfo2 -> {
if (disasterInfo2.getId().compareTo(disasterInfo.getId()) == 0) {
disasterInfo.setIsNdr(true);
}
});
}
if (!disasterInfoByUserIdNR.isEmpty()) {
disasterInfoByUserIdNR.stream().forEach(disasterInfo3 -> {
if (disasterInfo3.getId().compareTo(disasterInfo.getId()) == 0) {
disasterInfo.setIsNr(true);
}
});
}
disasterInfoList1.add(disasterInfo);
});
return disasterInfoList1;
}
/** /**
* 后台管理系统-控制台灾害各项统计 * 后台管理系统-控制台灾害各项统计
* @description 暂时没有条件查询 所有统计都暂时写在一个查询里面 *
* @return * @return
* @description 暂时没有条件查询 所有统计都暂时写在一个查询里面
*/ */
@Override @Override
public Map<String, Object> statistics(String year) { public Map<String, Object> statistics(String year) {
Map<String,Object> resultMap = Maps.newHashMap(); Map<String, Object> resultMap = Maps.newHashMap();
//boolean isAdmin = AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? true : false; //boolean isAdmin = AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? true : false;
//查询灾害表数据 //查询灾害表数据
List<DisasterInfo> disasterInfoList = this.baseMapper.listGetByYear(year); List<DisasterInfo> disasterInfoList = this.baseMapper.listGetByYear(year);
//统计head头部的数据 //统计head头部的数据
Map<String,Object> headMap = headData(disasterInfoList); Map<String, Object> headMap = headData(disasterInfoList);
//访问量和下载量 //访问量和下载量
List<Map<String,Long>> visitAndDownLoadData = this.baseMapper.visitAndDownLoad(year); List<Map<String, Long>> visitAndDownLoadData = this.baseMapper.visitAndDownLoad(year);
//响应量和发起量 //响应量和发起量
List<Map<String,Long>> initiateAndResponseData = this.baseMapper.initiateAndResponseData(year); List<Map<String, Long>> initiateAndResponseData = this.baseMapper.initiateAndResponseData(year);
//统计灾害发生区域占比 //统计灾害发生区域占比
Map<String,Long> countryData = disasterCountryProportion(disasterInfoList); Map<String, Long> countryData = disasterCountryProportion(disasterInfoList);
//统计当年的灾害申请次数 按月查询 //统计当年的灾害申请次数 按月查询
//List<Map<String,Object>> applyMonth = getDisasterReponseByMouth(1,isAdmin); //List<Map<String,Object>> applyMonth = getDisasterReponseByMouth(1,isAdmin);
//统计灾害数量占比 那个饼图 //统计灾害数量占比 那个饼图
List<Map<String,Long>> disasterNum = this.baseMapper.disasterNum(year); List<Map<String, Long>> disasterNum = this.baseMapper.disasterNum(year);
//统计chief //统计chief
List<Map<String,Long>> chiefMap = this.baseMapper.chiefData(year); List<Map<String, Long>> chiefMap = this.baseMapper.chiefData(year);
//统计admin //统计admin
List<Map<String,Long>> adminfMap = this.baseMapper.adminData(year); List<Map<String, Long>> adminfMap = this.baseMapper.adminData(year);
//统计当年的灾害响应次数 按月查询 //统计当年的灾害响应次数 按月查询
//List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin); //List<Map<String,Object>> responseMonth = getDisasterReponseByMouth(2,isAdmin);
resultMap.put("header",headMap); resultMap.put("header", headMap);
//响应量 //响应量
resultMap.put("line",initiateAndResponseData); resultMap.put("line", initiateAndResponseData);
//下载量 //下载量
resultMap.put("vandd",visitAndDownLoadData); resultMap.put("vandd", visitAndDownLoadData);
//admin //admin
resultMap.put("admin",adminfMap); resultMap.put("admin", adminfMap);
//chief //chief
resultMap.put("chief",chiefMap); resultMap.put("chief", chiefMap);
//国家 //国家
resultMap.put("country",countryData); resultMap.put("country", countryData);
//灾害类型分类 //灾害类型分类
resultMap.put("disasterNum",disasterNum); resultMap.put("disasterNum", disasterNum);
return resultMap; return resultMap;
} }
// @Override // @Override
// public Map<String, Object> statistics(String year) { // public Map<String, Object> statistics(String year) {
// Map<String,Object> resultMap = Maps.newHashMap(); // Map<String,Object> resultMap = Maps.newHashMap();
@ -312,12 +386,14 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
// resultMap.put("applyMonth",applyMonth); // resultMap.put("applyMonth",applyMonth);
// return resultMap; // return resultMap;
// } // }
/** /**
* 统计head头部信息 * 统计head头部信息
*
* @return * @return
*/ */
private Map<String,Object> headData(List<DisasterInfo> disasterInfoList){ private Map<String, Object> headData(List<DisasterInfo> disasterInfoList) {
Map<String,Object> headMap = Maps.newHashMap(); Map<String, Object> headMap = Maps.newHashMap();
//用户访问量 //用户访问量
Integer visitCount = disasterInfoList.stream().map(DisasterInfo::getVisitCount).reduce(Integer::sum).orElse(0); Integer visitCount = disasterInfoList.stream().map(DisasterInfo::getVisitCount).reduce(Integer::sum).orElse(0);
//数据下载量 //数据下载量
@ -325,44 +401,47 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
//灾害响应申请次数 //灾害响应申请次数
Integer size = disasterInfoList.size(); Integer size = disasterInfoList.size();
//灾害响应实际次数 //灾害响应实际次数
Long actResponseNum = disasterInfoList.stream().filter(data-> data.getRespondStatus() > 1).count(); Long actResponseNum = disasterInfoList.stream().filter(data -> data.getRespondStatus() > 1).count();
//灾害响应百分比 //灾害响应百分比
headMap.put("visitCount",visitCount); headMap.put("visitCount", visitCount);
headMap.put("downloadCount",downloadCount); headMap.put("downloadCount", downloadCount);
headMap.put("applyCount",size); headMap.put("applyCount", size);
headMap.put("actResponseNum",actResponseNum); headMap.put("actResponseNum", actResponseNum);
return headMap; return headMap;
} }
/** /**
*计算每个国家的灾害占比 * 计算每个国家的灾害占比
*
* @return * @return
*/ */
private Map<String,Long> disasterCountryProportion(List<DisasterInfo> disasterInfoList){ private Map<String, Long> disasterCountryProportion(List<DisasterInfo> disasterInfoList) {
Map<String,Long> proportionMap = new LinkedHashMap<>(); Map<String, Long> proportionMap = new LinkedHashMap<>();
//根据国家分组统计次数以及总灾害的占比 //根据国家分组统计次数以及总灾害的占比
disasterInfoList.stream().filter(data-> disasterInfoList.stream().filter(data ->
data.getDisasterCountry()!=null data.getDisasterCountry() != null
).collect(Collectors.groupingBy(DisasterInfo::getDisasterCountry,Collectors.counting())) ).collect(Collectors.groupingBy(DisasterInfo::getDisasterCountry, Collectors.counting()))
.entrySet().stream().sorted(Map.Entry.<String,Long>comparingByValue().reversed()).limit(15).forEachOrdered(e -> proportionMap.put(e.getKey(), e.getValue())); .entrySet().stream().sorted(Map.Entry.<String, Long>comparingByValue().reversed()).limit(15).forEachOrdered(e -> proportionMap.put(e.getKey(), e.getValue()));
return proportionMap; return proportionMap;
} }
/** /**
* 计算每个灾害发生的次数 * 计算每个灾害发生的次数
*
* @return * @return
*/ */
private Map<String,Long> disasterNumProportion(boolean type){ private Map<String, Long> disasterNumProportion(boolean type) {
List<DisasterInfo> disasterInfoList = baseMapper.getAllData(type ? null:AuthUtil.getUserId()); List<DisasterInfo> disasterInfoList = baseMapper.getAllData(type ? null : AuthUtil.getUserId());
Map<String,Long> proportionMap = disasterInfoList.stream().filter(data->data.getDictValue()!=null).collect(Collectors.groupingBy(DisasterInfo::getDictValue,Collectors.counting())); Map<String, Long> proportionMap = disasterInfoList.stream().filter(data -> data.getDictValue() != null).collect(Collectors.groupingBy(DisasterInfo::getDictValue, Collectors.counting()));
return proportionMap; return proportionMap;
} }
/** /**
* 按月统计当年每个月的响应或者申请量 * 按月统计当年每个月的响应或者申请量
*
* @return * @return
*/ */
private List<Map<String, Object>> getDisasterReponseByMouth(Integer type,boolean isAdmin){ private List<Map<String, Object>> getDisasterReponseByMouth(Integer type, boolean isAdmin) {
//统计每个月的个数 //统计每个月的个数
final String[] MONTH = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"}; final String[] MONTH = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
int year = LocalDate.now().getYear(); int year = LocalDate.now().getYear();
@ -371,7 +450,7 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
String start = year + "-01-01 00:00:00"; String start = year + "-01-01 00:00:00";
//查询结束时间 //查询结束时间
String end = year + 1 + "-01-01 00:00:00"; String end = year + 1 + "-01-01 00:00:00";
List<Map<String, Object>> mapList = baseMapper.getDisasterInfoByMouth(start,end,type,isAdmin ? null:AuthUtil.getUserId()); List<Map<String, Object>> mapList = baseMapper.getDisasterInfoByMouth(start, end, type, isAdmin ? null : AuthUtil.getUserId());
List<DisasterData> disasterList = mapList.stream().map((map) -> { List<DisasterData> disasterList = mapList.stream().map((map) -> {
return cn.hutool.core.bean.BeanUtil.mapToBean(map, DisasterData.class, true); return cn.hutool.core.bean.BeanUtil.mapToBean(map, DisasterData.class, true);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -381,15 +460,99 @@ public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, Dis
Map<String, Object> result = Maps.newLinkedHashMap(); Map<String, Object> result = Maps.newLinkedHashMap();
String month = MONTH[i]; String month = MONTH[i];
List<DisasterData> disasterData = collect.get(month); List<DisasterData> disasterData = collect.get(month);
if (disasterData!=null&&!disasterData.isEmpty()){ if (disasterData != null && !disasterData.isEmpty()) {
DisasterData disasterData1 = disasterData.get(0); DisasterData disasterData1 = disasterData.get(0);
result.put(year+"-"+month,disasterData1); result.put(year + "-" + month, disasterData1);
}else { } else {
result.put(year+"-"+month,null); result.put(year + "-" + month, null);
} }
resultList.add(result); resultList.add(result);
} }
return resultList; return resultList;
}
public List<Map<String, Object>> getDisasterInfoByMouth(Integer type, Long userId, String email) {
//统计每个月的个数
final String[] MONTH = new String[]{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
int year = LocalDate.now().getYear();
List<Map<String, Object>> resultList = new ArrayList<>();
//查询开始时间
String start = year + "-01-01 00:00:00";
//查询结束时间
String end = year + 1 + "-01-01 00:00:00";
int size = MONTH.length;
List<Map<String, Object>> mapList = baseMapper.getDisasterInfoByMouth(start, end, type, userId);
List<DisasterData> disasterList = mapList.stream().map((map) -> {
return cn.hutool.core.bean.BeanUtil.mapToBean(map, DisasterData.class, true);
}).collect(Collectors.toList());
Map<String, List<DisasterData>> collect = disasterList.stream().collect(Collectors.groupingBy(DisasterData::getDate));
List<Map<String, Object>> mapListNew = baseMapper.getDisasterInfoByMouthNew(start, end, userId, email);
List<DisasterData> disasterListNew = mapListNew.stream().map((map) -> {
return cn.hutool.core.bean.BeanUtil.mapToBean(map, DisasterData.class, true);
}).collect(Collectors.toList());
Map<String, List<DisasterData>> collectNew = disasterListNew.stream().collect(Collectors.groupingBy(DisasterData::getDate));
for (int i = 0; i < size; ++i) {
Map<String, Object> result = Maps.newLinkedHashMap();
String month = MONTH[i];
DisasterData disasterData3 = new DisasterData();
List<DisasterData> disasterData = collect.get(month);
List<DisasterData> disasterDataNew = collectNew.get(month);
if (disasterData != null && !disasterData.isEmpty()) {
DisasterData disasterData1 = disasterData.get(0);
disasterData3.setValue(disasterData1.getValue());
} else {
disasterData3.setValue(0);
}
if (disasterDataNew != null && !disasterDataNew.isEmpty()) {
DisasterData disasterData1 = disasterDataNew.get(0);
disasterData3.setValueNew(disasterData1.getValue());
} else {
disasterData3.setValueNew(0);
}
result.put(year + "-" + month, disasterData3);
resultList.add(result);
}
return resultList;
}
@Override
public List<UserVo> getAllUserEmail() {
return this.baseMapper.getAllUserEmail();
}
@Override
public Map<String, Object> statisticsByUser(String year, Long userId, String email) {
Map<String, Object> resultMap = Maps.newHashMap();
//响应量和发起量
List<Map<String, Long>> initiateAndResponseData = this.baseMapper.initiateAndResponseDataByUser(year,userId,email);
resultMap.put("line", initiateAndResponseData);
return resultMap;
}
@Override
public IPage<DisasterInfo> getUserDisasterInfoListNCI(IPage<Object> page, String email) {
return this.baseMapper.getUserDisasterInfoListNCI(page,email);
}
@Override
public IPage<DisasterInfo> getUserDisasterInfoListNDR(IPage<Object> page, String userId) {
return this.baseMapper.getUserDisasterInfoListNDR(page,userId);
}
@Override
public IPage<DisasterInfo> getUserDisasterInfoListNDRNew(IPage<Object> page, String userId, String respondStatus) {
return this.baseMapper.getUserDisasterInfoListNDRNew(page,userId,respondStatus);
} }
} }

View File

@ -1,16 +1,20 @@
package com.kening.vordm.service.impl; package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.entity.Tool; import com.kening.vordm.entity.Tool;
import com.kening.vordm.mapper.ToolMapper; import com.kening.vordm.mapper.ToolMapper;
import com.kening.vordm.service.ToolService; import com.kening.vordm.service.ToolService;
import org.springblade.core.tool.api.R;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author G1393 * @author G1393
@ -61,4 +65,21 @@ implements ToolService {
public List<Map<String, Long>> getStatisticsByUserId(Long id, String year) { public List<Map<String, Long>> getStatisticsByUserId(Long id, String year) {
return baseMapper.getStatisticsByUserId(id,year); return baseMapper.getStatisticsByUserId(id,year);
} }
@Override
public Map<String, Object> getStatisticsByUserIdPancake(Long userId) {
List<Tool> toolList = baseMapper.getStatisticsByUserIdPancake(userId);
List<Tool> toolList2 = baseMapper.getStatisticsByUserIdPancakeNew(userId);
Map<String, Object> map = new HashMap<>();
map.put("toolVisits",toolList);
map.put("paperVisits",toolList2);
return map;
}
@Override
public List<Tool> getUnauditedTool() {
LambdaQueryWrapper<Tool> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.isNull(Tool::getReviewTime);
return baseMapper.selectList(queryWrapper);
}
} }

View File

@ -37,7 +37,11 @@
</select>--> </select>-->
<select id="getList" resultMap="dictResultMap"> <select id="getList" resultMap="dictResultMap">
select id, parent_id, code, dict_key, dict_value, sort, remark from blade_dict_biz where code = #{param1} and parent_id > 0 and is_sealed = 0 and is_deleted = 0 select id, parent_id, code, dict_key, dict_value, sort, remark from blade_dict_biz
where
code = #{param1}
and parent_id > 0 and is_sealed = 0 and is_deleted = 0
</select> </select>
<select id="tree" resultMap="treeNodeResultMap"> <select id="tree" resultMap="treeNodeResultMap">