diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/DisasterInfoController.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/DisasterInfoController.java index 9d76757..175b8c5 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/DisasterInfoController.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/DisasterInfoController.java @@ -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 qw = new LambdaQueryWrapper<>(); + qw.eq(GuestManageDisasterRef::getDisasterId, id); + GuestManageDisasterRef one = guestManageDisasterRefService.getOne(qw); + one.setStatus(3); + one.setManagerId(null); + + LambdaUpdateWrapper lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); + lambdaUpdateWrapper.eq(GuestManageDisasterRef::getId,one.getId()); + lambdaUpdateWrapper.set(GuestManageDisasterRef::getStatus,3); + lambdaUpdateWrapper.set(GuestManageDisasterRef::getManagerId,null); + guestManageDisasterRefService.update(lambdaUpdateWrapper); + + LambdaUpdateWrapper 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 { diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/FileController.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/FileController.java index f91b254..fe0e27d 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/FileController.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/FileController.java @@ -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; + } } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.java index ed5cd55..d54ced4 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.java @@ -103,4 +103,6 @@ public interface DisasterInfoMapper extends BaseMapper { IPage getUserDisasterInfoListNDR(IPage page,@Param("userId") String userId); IPage getUserDisasterInfoListNDRNew(IPage page,@Param("userId") String userId,@Param("respondStatus") String respondStatus); + + List> disasterInfoType(@Param("year") String year); } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.xml b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.xml index 2cd5de0..a1aae37 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.xml +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/DisasterInfoMapper.xml @@ -208,6 +208,9 @@ d.respond_status = #{callForHelpVo.respondStatus} + + and d.vordm_id like concat('%', #{callForHelpVo.vordmId},'%') + and d.is_end_apply = #{callForHelpVo.isEndApply} @@ -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 @@ -490,7 +505,7 @@ + diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/DisasterInfoServiceImpl.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/DisasterInfoServiceImpl.java index ec18b9d..d75c288 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/DisasterInfoServiceImpl.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/DisasterInfoServiceImpl.java @@ -344,6 +344,9 @@ public class DisasterInfoServiceImpl extends ServiceImpl> adminfMap = this.baseMapper.adminData(year); + List> typeMap = this.baseMapper.disasterInfoType(year); + + //统计当年的灾害响应次数 按月查询 //List> responseMonth = getDisasterReponseByMouth(2,isAdmin); resultMap.put("header", headMap); @@ -359,6 +362,7 @@ public class DisasterInfoServiceImpl extends ServiceImpl 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 getEntityDataList(IPage page, EntityData entityData) { @@ -125,6 +130,7 @@ public class EntityDataServiceImpl extends ServiceImpl 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> getStatisticsByUserId(Long id, String year) { return baseMapper.getStatisticsByUserId(id, year); diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/OtherDataServiceImpl.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/OtherDataServiceImpl.java index bde7efa..73059ac 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/OtherDataServiceImpl.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/OtherDataServiceImpl.java @@ -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 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 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 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 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 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 getRemoteSensingSourceData(String disasterType, String disasterCountry, String disasterTime) { @@ -275,6 +284,9 @@ public class RemoteSensingSourceDataServiceImpl extends ServiceImpl