Merge remote-tracking branch 'origin/master'

This commit is contained in:
李宇辰 2023-04-17 13:56:52 +08:00
commit 78a8d14a18
15 changed files with 324 additions and 63 deletions

View File

@ -3,10 +3,12 @@ package com.kening.vordm.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.kening.vordm.vo.productResolutionVo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 遥感影像源数据
@ -154,7 +156,40 @@ public class RemoteSensingSourceData implements Serializable {
*/
private String sourceOrganization;
/**
* 分辨率集合最大值
*/
@TableField(exist = false)
private Double productResolutionMax;
/**
* 分辨率集合最小值
*/
@TableField(exist = false)
private Double productResolutionMin;
/**
* 卫星类型集合
*/
@TableField(exist = false)
private String satelliteCodeList;
/**
* 卫星类型集合
*/
@TableField(exist = false)
private List<String> satelliteCodeListNew;
/**
* 卫星类型集合
*/
@TableField(exist = false)
private List<productResolutionVo> productResolutionVos;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,41 @@
package com.kening.vordm.vo;
import lombok.Data;
@Data
public class UserVo {
private Long id;
/**
* 验证码
*/
private String code;
/**
* 邮箱
*/
private String email;
/**
* 密码1
*/
private String password;
/**
* 密码2
*/
private String password2;
/**
* 验证码key
*/
private String key;
/**
* 机构Id
*/
private String tenantId;
}

View File

@ -0,0 +1,12 @@
package com.kening.vordm.vo;
import lombok.Data;
@Data
public class productResolutionVo {
private Double productResolutionMin;
private Double productResolutionMax;
}

View File

@ -11,7 +11,6 @@ import org.springframework.cloud.client.SpringCloudApplication;
@SpringCloudApplication
public class VoRdmApplication {
public static void main(String[] args) {
BladeApplication.run(CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args);
// BladeApplication.run("zqq-" + CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args);
BladeApplication.run("glj-"+CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args);
}
}

View File

@ -0,0 +1,50 @@
package com.kening.vordm.controller;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.EmailService;
import com.kening.vordm.vo.UserVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.mail.MessagingException;
@RestController
@RequiredArgsConstructor
@RequestMapping("/ui/login")
public class LoginController {
//实体数据服务层
private final DisasterInfoService disasterInfoService;
//邮箱发送服务
private final EmailService emailService;
/**
* 新增用户信息
*
* @param userVo
* @return
*/
@PostMapping("/saveUserData")
public R saveUserData(@RequestBody UserVo userVo) {
return disasterInfoService.saveUserData(userVo);
}
/**
* 邮箱发送
* @param userVo
* @return
* @throws MessagingException
*/
@PostMapping("/sendUserPasswordEmail")
public R sendUserPasswordEmail(@RequestBody UserVo userVo) throws MessagingException {
return emailService.sendUserPasswordEmail(userVo);
}
}

View File

@ -1,10 +1,9 @@
package com.kening.vordm.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.entity.*;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import com.kening.vordm.vo.GroupByUse;
@ -13,11 +12,10 @@ import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@AllArgsConstructor
@ -45,23 +43,27 @@ public class RemoteSensingSourceDataController {
/**
* 实体数据列表信息
* @param remoteSensingSourceData 实体数据条件信息
* @param optionsJson 实体数据条件信息
* @param query current当前页 size 每页数据量
* @return
*/
@GetMapping("/Condition")
public R<IPage<RemoteSensingSourceData>> getRemoteSensingSourceDataByCondition(RemoteSensingSourceData remoteSensingSourceData, Query query) {
public R<IPage<RemoteSensingSourceData>> getRemoteSensingSourceDataByCondition( String optionsJson, Query query) {
RemoteSensingSourceData remoteSensingSourceData = new RemoteSensingSourceData();
if (optionsJson!=null){
remoteSensingSourceData = (RemoteSensingSourceData)JSON.parseObject(optionsJson, RemoteSensingSourceData.class);
}
return R.data(remoteSensingSourceDataService.getRemoteSensingSourceDataByCondition(Condition.getPage(query), remoteSensingSourceData));
}
// /**
// * 根据页码和灾害信息查出遥感影像源数据可多个灾害
// * @param remoteSensingSourceData
// * @param query
// * @return
// */
// @GetMapping("/Condition1")
// public R<IPage<RemoteSensingSourceData>> getRemoteSensingSourceDataByCondition(RemoteSensingSourceData remoteSensingSourceData, Query query){
// return R.data(remoteSensingSourceDataService.page(Condition.getPage(query),Condition.getQueryWrapper(remoteSensingSourceData)));
// }
/**
* 实体数据列表信息
* @param params
* @param query
* @return
*/
@GetMapping("/PagesData")
public R<IPage<RemoteSensingSourceData>> Pages(@RequestParam Map<String,Object> params, Query query){
return R.data(remoteSensingSourceDataService.page(Condition.getPage(query),Condition.getQueryWrapper(params,RemoteSensingSourceData.class)));
}
}

View File

@ -4,12 +4,10 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.vo.CallForHelpVo;
import com.kening.vordm.vo.DisasterMangerInfo;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.UserTenantVo;
import com.kening.vordm.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.formula.functions.T;
import org.springblade.core.secure.BladeUser;
import java.util.List;
import java.util.Map;
@ -51,6 +49,12 @@ public interface DisasterInfoMapper extends BaseMapper<DisasterInfo> {
List<CallForHelpVo> page(IPage page,@Param("callForHelpVo" )CallForHelpVo callForHelpVo);
Integer getUserEmail(@Param("email") String email);
Integer saveUserData(@Param("userVo") UserVo userVo);
UserVo getUserByEmail(String email);
/**
* 获取灾害数据 关联字典项
* @return

View File

@ -37,6 +37,10 @@
d.disaster_type,d.disaster_time,d.disaster_country,
m.organization
</sql>
<insert id="saveUserData">
insert into blade_user (tenant_id,password,email,status,is_deleted)
values (#{userVo.tenantId},#{userVo.password},#{userVo.email},1,0);
</insert>
<select id="getDisasterInfoDetail" resultType="com.kening.vordm.entity.DisasterInfo">
select
@ -102,12 +106,12 @@
select t.sponsor_organization as `name`, count(*) as cnt, 'sponsorOrganization' as `type`
from disaster_info t where t.sponsor_organization != ''
GROUP BY t.sponsor_organization
ORDER BY cnt desc LIMIT 3
ORDER BY cnt desc LIMIT 5
</select>
<select id="getLeft4Data" resultType="com.kening.vordm.vo.GroupByUse">
select t.response_organization as `name`, count(*) as cnt, 'responseOrganization' as `type`
from guest_manage_disaster_ref t where t.response_organization != '' GROUP BY t.response_organization ORDER BY cnt desc LIMIT 3
from guest_manage_disaster_ref t where t.response_organization != '' GROUP BY t.response_organization ORDER BY cnt desc LIMIT 5
</select>
<select id="getLeft1Data" resultType="com.kening.vordm.vo.GroupByUse">
@ -127,7 +131,7 @@
(select t.disaster_country as name, count(*) as cnt, 'country' as `type`
from disaster_info t
group by t.disaster_country
order by cnt desc limit 7) b on c.flagname = b.`name`
order by cnt desc limit 5) b on c.flagname = b.`name`
</select>
<select id="page" parameterType="com.kening.vordm.vo.CallForHelpVo" resultType="com.kening.vordm.vo.CallForHelpVo">
@ -162,6 +166,24 @@
order by d.upload_time desc
</select>
<select id="getUserEmail" resultType="java.lang.Integer">
select count(id) from blade_user
<where>
<if test="email != null and email != ''" >
email = #{email}
</if>
</where>
</select>
<select id="getUserByEmail" resultType="com.kening.vordm.vo.UserVo">
select password from blade_user
<where>
<if test="email != null and email != ''" >
email = #{email}
</if>
</where>
</select>
<select id="getAllData" resultType="com.kening.vordm.entity.DisasterInfo">
select
<include refid="Base_Column_List"/>,
@ -188,4 +210,5 @@
</if>
GROUP BY date
</select>
</mapper>

View File

@ -21,5 +21,4 @@ public interface RemoteSensingSourceDataMapper extends BaseMapper<RemoteSensingS
List<RemoteSensingSourceData> getRemoteSensingSourceData(@Param("disasterType") String disasterType,@Param("disasterCountry") String disasterCountry,@Param("disasterTime") String disasterTime);
IPage<RemoteSensingSourceData> getRemoteSensingSourceDataByCondition(@Param("remoteSensingSourceData") RemoteSensingSourceData remoteSensingSourceData, IPage<Object> page);
}

View File

@ -71,11 +71,17 @@
<if test="remoteSensingSourceData.disasterId != null and remoteSensingSourceData.disasterId != ''">
r.disaster_id = #{remoteSensingSourceData.disasterId}
</if>
<if test="remoteSensingSourceData.productResolution != null and remoteSensingSourceData.productResolution != ''">
and r.product_resolution = #{remoteSensingSourceData.productResolution}
<if test="remoteSensingSourceData.productResolutionMax != null and remoteSensingSourceData.productResolutionMin != null">
and r.product_resolution &gt;= #{remoteSensingSourceData.productResolutionMin} and r.product_resolution &lt; #{remoteSensingSourceData.productResolutionMax}
</if>
<if test="remoteSensingSourceData.satelliteCode != null and remoteSensingSourceData.satelliteCode != ''">
and r.satellite_code = #{remoteSensingSourceData.satelliteCode}
<if test="remoteSensingSourceData.productResolutionMax == null and remoteSensingSourceData.productResolutionMin != null">
and r.product_resolution &gt; #{remoteSensingSourceData.productResolutionMin}
</if>
<if test="remoteSensingSourceData.satelliteCodeListNew != null and remoteSensingSourceData.satelliteCodeListNew != '' and remoteSensingSourceData.satelliteCodeListNew.size() != 0">
and r.satellite_code in
<foreach item="AList" index="index" collection="remoteSensingSourceData.satelliteCodeListNew"
open="(" separator="," close=")">#{AList}
</foreach>
</if>
</where>
</select>

View File

@ -4,10 +4,8 @@ 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.CallForHelpVo;
import com.kening.vordm.vo.DisasterMangerInfo;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.UserTenantVo;
import com.kening.vordm.vo.*;
import org.springblade.core.tool.api.R;
import java.util.List;
import java.util.Map;
@ -57,6 +55,7 @@ public interface DisasterInfoService extends IService<DisasterInfo> {
IPage<CallForHelpVo> page(IPage<CallForHelpVo> page, CallForHelpVo callForHelpVo);
R saveUserData(UserVo userVo);
/**
* 后台管理系统-控制台灾害各项统计
* @return

View File

@ -2,6 +2,8 @@ package com.kening.vordm.service;
import com.kening.vordm.entity.Email;
import com.kening.vordm.vo.UserVo;
import org.springblade.core.tool.api.R;
import javax.mail.MessagingException;
@ -14,4 +16,6 @@ public interface EmailService {
void sendMimeMessage(Email email) throws MessagingException;
void sendTemplate(Email email) throws MessagingException;
R sendUserPasswordEmail(UserVo userVo) throws MessagingException;
}

View File

@ -9,67 +9,72 @@ import com.kening.vordm.entity.DisasterInfo;
import com.kening.vordm.mapper.DisasterInfoMapper;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.GuestManageDisasterRefService;
import com.kening.vordm.vo.CallForHelpVo;
import com.kening.vordm.vo.DisasterMangerInfo;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.UserTenantVo;
import com.kening.vordm.vo.*;
import lombok.RequiredArgsConstructor;
import org.springblade.common.cache.CacheNames;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author G1393
* @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service实现
* @createDate 2023-04-04 15:54:30
*/
* @author G1393
* @description 针对表disaster_info(灾害信息表存储灾害信息)的数据库操作Service实现
* @createDate 2023-04-04 15:54:30
*/
@Service
@RequiredArgsConstructor
public class DisasterInfoServiceImpl extends ServiceImpl<DisasterInfoMapper, DisasterInfo>
implements DisasterInfoService {
implements DisasterInfoService {
private final BladeRedis bladeRedis;
private final GuestManageDisasterRefService guestManageDisasterRefService;
/**
* 返回指定的灾害条目
*
* @param type
* @param country
* @param time
* @param name
* @return
*/
public List<GroupByUse> getConditionData(String type, String country, String time, String name){
List<GroupByUse> disasterInfos=this.baseMapper.getSelectCondition(type,country,time,name);
public List<GroupByUse> getConditionData(String type, String country, String time, String name) {
List<GroupByUse> disasterInfos = this.baseMapper.getSelectCondition(type, country, time, name);
return disasterInfos;
}
/**
* 用于获取灾害id类型
*
* @param disasterInfo
* @return
*/
public List<Long> getDisasterId(DisasterInfo disasterInfo){
public List<Long> getDisasterId(DisasterInfo disasterInfo) {
QueryWrapper<DisasterInfo> qw = new QueryWrapper<>();
if (disasterInfo.getDisasterType()!=null){
qw.eq("disaster_type",disasterInfo.getDisasterType());
if (disasterInfo.getDisasterType() != null) {
qw.eq("disaster_type", disasterInfo.getDisasterType());
}
if (disasterInfo.getDisasterCountry()!=null){
qw.eq("disaster_country",disasterInfo.getDisasterCountry());
if (disasterInfo.getDisasterCountry() != null) {
qw.eq("disaster_country", disasterInfo.getDisasterCountry());
}
if (disasterInfo.getDisasterTime()!=null){
qw.eq("disaster_time",disasterInfo.getDisasterTime());
if (disasterInfo.getDisasterTime() != null) {
qw.eq("disaster_time", disasterInfo.getDisasterTime());
}
List<DisasterInfo> disasterInfos = this.baseMapper.selectList(qw);
List<Long> ids = new ArrayList<>();
if (!disasterInfos.isEmpty()){
if (!disasterInfos.isEmpty()) {
disasterInfos.stream().forEach(disasterInfo1 -> {
ids .add(disasterInfo1.getId());
ids.add(disasterInfo1.getId());
});
return ids;
}
@ -78,6 +83,7 @@ implements DisasterInfoService {
/**
* 获取债害详情信息
*
* @param id
* @return
*/
@ -88,14 +94,15 @@ implements DisasterInfoService {
/**
* 进行灾害信息的统计国家类型
*
* @param name
* @return
*/
public List<GroupByUse> getDisasterStatistics(String name){
public List<GroupByUse> getDisasterStatistics(String name) {
return this.baseMapper.getDisasterStatistics(name);
}
public IPage<DisasterMangerInfo> getHomeDisaster(IPage<DisasterMangerInfo> page, Integer respondStatus){
public IPage<DisasterMangerInfo> getHomeDisaster(IPage<DisasterMangerInfo> page, Integer respondStatus) {
List<DisasterMangerInfo> disasterMangerInfos = this.baseMapper.getHomeDisaster(page, respondStatus);
return page.setRecords(disasterMangerInfos);
}
@ -137,9 +144,31 @@ implements DisasterInfoService {
@Override
public IPage<CallForHelpVo> page(IPage<CallForHelpVo> page, CallForHelpVo callForHelpVo) {
return page.setRecords(this.baseMapper.page(page,callForHelpVo));
return page.setRecords(this.baseMapper.page(page, callForHelpVo));
}
@Override
public R saveUserData(UserVo userVo) {
//通过邮箱判断当前用户是否存在
Integer userEmail = this.baseMapper.getUserEmail(userVo.getEmail());
if (userEmail > 0) {
return R.data(1405, "The current email is already bound to a user");
}
// 获取验证码
String redisCode = bladeRedis.get(CacheNames.CAPTCHA_KEY + userVo.getKey());
// 判断验证码
if (userVo.getCode() == null || !StringUtil.equalsIgnoreCase(redisCode, userVo.getCode())) {
return R.data(1404, "Verification code error");
}
//密码
userVo.setPassword(DigestUtil.encrypt(userVo.getPassword()));
Integer integer = this.baseMapper.saveUserData(userVo);
return R.status(integer > 0);
}
/**
* 后台管理系统-控制台灾害各项统计
* @description 暂时没有条件查询 所有统计都暂时写在一个查询里面

View File

@ -1,8 +1,14 @@
package com.kening.vordm.service.impl;
import com.kening.vordm.entity.Email;
import com.kening.vordm.mapper.DisasterInfoMapper;
import com.kening.vordm.service.DisasterInfoService;
import com.kening.vordm.service.EmailService;
import com.kening.vordm.vo.UserVo;
import lombok.RequiredArgsConstructor;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DigestUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.javamail.JavaMailSender;
@ -30,6 +36,8 @@ public class EmailServiceImpl implements EmailService {
private final TemplateEngine templateEngine;
private final DisasterInfoMapper disasterInfoMapper;
@Value("${spring.mail.username}")
private String from;
@ -44,6 +52,23 @@ public class EmailServiceImpl implements EmailService {
javaMailSender.send(buildTemplateMail(email));
}
@Override
public R sendUserPasswordEmail(UserVo userVo) throws MessagingException {
//通过邮箱判断当前用户是否存在
UserVo bladeUser = disasterInfoMapper.getUserByEmail(userVo.getEmail());
if (bladeUser == null || bladeUser.getPassword()==null){
return R.data(1405, "There are currently no bound users for this email");
}
Email email = new Email();
email.setSubject("您的登录密码");
String encrypt = DigestUtil.encrypt(bladeUser.getPassword());
email.setText("邮箱为"+ userVo.getEmail()+ "的用户登录密码为:"+encrypt);
email.setHtmlText(false);
email.setTos(userVo.getEmail().split(","));
javaMailSender.send(buildMimeMessage(email));
return R.status(true);
}
/**
* 构建模板邮件
* @param email

View File

@ -1,15 +1,19 @@
package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.entity.RemoteSensingSourceData;
import com.kening.vordm.mapper.RemoteSensingSourceDataMapper;
import com.kening.vordm.service.RemoteSensingSourceDataService;
import com.kening.vordm.vo.GroupByUse;
import com.kening.vordm.vo.productResolutionVo;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
/**
* @author G1393
@ -27,6 +31,35 @@ implements RemoteSensingSourceDataService {
@Override
public IPage<RemoteSensingSourceData> getRemoteSensingSourceDataByCondition(IPage<Object> page, RemoteSensingSourceData remoteSensingSourceData) {
return this.baseMapper.getRemoteSensingSourceDataByCondition(remoteSensingSourceData, page);
List<productResolutionVo> productResolutionVos = remoteSensingSourceData.getProductResolutionVos();
String satelliteCodeList = remoteSensingSourceData.getSatelliteCodeList();
List<String> result = new ArrayList<>();
if (satelliteCodeList!=null) {
result = Arrays.asList(satelliteCodeList.split(","));
remoteSensingSourceData.setSatelliteCodeListNew(result);
}
IPage<RemoteSensingSourceData> remoteSensingSourceDataByCondition = new Page<>();
if (productResolutionVos != null && !productResolutionVos.isEmpty()){
List<RemoteSensingSourceData> remoteSensingSourceData1 = new ArrayList<>();
productResolutionVos.stream().forEach(productResolutionVo -> {
if (Objects.equals(productResolutionVo.getProductResolutionMax(), new Double("1000"))){
remoteSensingSourceData.setProductResolutionMax(null);
remoteSensingSourceData.setProductResolutionMin(productResolutionVo.getProductResolutionMin());
}else {
remoteSensingSourceData.setProductResolutionMin(productResolutionVo.getProductResolutionMin());
remoteSensingSourceData.setProductResolutionMax(productResolutionVo.getProductResolutionMax());
}
IPage<RemoteSensingSourceData> remoteSensingSourceDataByConditionNew = this.baseMapper.getRemoteSensingSourceDataByCondition(remoteSensingSourceData, page);
remoteSensingSourceData1.addAll(remoteSensingSourceDataByConditionNew.getRecords());
});
remoteSensingSourceDataByCondition.setRecords(remoteSensingSourceData1);
remoteSensingSourceDataByCondition.setTotal(remoteSensingSourceData1.size());
}else {
remoteSensingSourceDataByCondition = this.baseMapper.getRemoteSensingSourceDataByCondition(remoteSensingSourceData, page);
}
return remoteSensingSourceDataByCondition;
}
}