From bf2b77b6571c3ab55c2c0fc43ef4261e3ba18b0f Mon Sep 17 00:00:00 2001 From: qqGroup0 <253114712@qq.com> Date: Sat, 15 Apr 2023 16:32:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?zqq:=E9=81=A5=E6=84=9F=E5=BD=B1=E5=83=8F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vordm/entity/RemoteSensingSourceData.java | 35 +++++++++++++++++ .../kening/vordm/vo/productResolutionVo.java | 12 ++++++ .../RemoteSensingSourceDataController.java | 38 +++++++++--------- .../mapper/RemoteSensingSourceDataMapper.java | 1 - .../mapper/RemoteSensingSourceDataMapper.xml | 14 +++++-- .../RemoteSensingSourceDataServiceImpl.java | 39 +++++++++++++++++-- 6 files changed, 113 insertions(+), 26 deletions(-) create mode 100644 kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/productResolutionVo.java diff --git a/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/entity/RemoteSensingSourceData.java b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/entity/RemoteSensingSourceData.java index 61e3709..cc25f5f 100644 --- a/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/entity/RemoteSensingSourceData.java +++ b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/entity/RemoteSensingSourceData.java @@ -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 satelliteCodeListNew; + + + /** + * 卫星类型集合 + */ + @TableField(exist = false) + private List productResolutionVos; + + @TableField(exist = false) private static final long serialVersionUID = 1L; + } diff --git a/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/productResolutionVo.java b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/productResolutionVo.java new file mode 100644 index 0000000..893bb60 --- /dev/null +++ b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/productResolutionVo.java @@ -0,0 +1,12 @@ +package com.kening.vordm.vo; + +import lombok.Data; + +@Data +public class productResolutionVo { + + private Double productResolutionMin; + + + private Double productResolutionMax; +} diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/RemoteSensingSourceDataController.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/RemoteSensingSourceDataController.java index bd69049..e8bbf53 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/RemoteSensingSourceDataController.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/RemoteSensingSourceDataController.java @@ -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> getRemoteSensingSourceDataByCondition(RemoteSensingSourceData remoteSensingSourceData, Query query) { + public R> 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> 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> Pages(@RequestParam Map params, Query query){ + return R.data(remoteSensingSourceDataService.page(Condition.getPage(query),Condition.getQueryWrapper(params,RemoteSensingSourceData.class))); + } } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.java index a899ac1..caeae21 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.java @@ -21,5 +21,4 @@ public interface RemoteSensingSourceDataMapper extends BaseMapper getRemoteSensingSourceData(@Param("disasterType") String disasterType,@Param("disasterCountry") String disasterCountry,@Param("disasterTime") String disasterTime); IPage getRemoteSensingSourceDataByCondition(@Param("remoteSensingSourceData") RemoteSensingSourceData remoteSensingSourceData, IPage page); - } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.xml b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.xml index c09eb88..4a25900 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.xml +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/mapper/RemoteSensingSourceDataMapper.xml @@ -71,11 +71,17 @@ r.disaster_id = #{remoteSensingSourceData.disasterId} - - and r.product_resolution = #{remoteSensingSourceData.productResolution} + + and r.product_resolution >= #{remoteSensingSourceData.productResolutionMin} and r.product_resolution < #{remoteSensingSourceData.productResolutionMax} - - and r.satellite_code = #{remoteSensingSourceData.satelliteCode} + + and r.product_resolution > #{remoteSensingSourceData.productResolutionMin} + + + and r.satellite_code in + #{AList} + diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/RemoteSensingSourceDataServiceImpl.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/RemoteSensingSourceDataServiceImpl.java index 701666d..878883e 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/RemoteSensingSourceDataServiceImpl.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/RemoteSensingSourceDataServiceImpl.java @@ -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 getRemoteSensingSourceDataByCondition(IPage page, RemoteSensingSourceData remoteSensingSourceData) { - return this.baseMapper.getRemoteSensingSourceDataByCondition(remoteSensingSourceData, page); + List productResolutionVos = remoteSensingSourceData.getProductResolutionVos(); + String satelliteCodeList = remoteSensingSourceData.getSatelliteCodeList(); + List result = new ArrayList<>(); + if (satelliteCodeList!=null) { + result = Arrays.asList(satelliteCodeList.split(",")); + remoteSensingSourceData.setSatelliteCodeListNew(result); + } + IPage remoteSensingSourceDataByCondition = new Page<>(); + + if (productResolutionVos != null && !productResolutionVos.isEmpty()){ + List 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 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; } } From bbfb15fc3c891a68b04885ecee4c80e0efc966dc Mon Sep 17 00:00:00 2001 From: glj Date: Sat, 15 Apr 2023 17:33:41 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/kening/vordm/vo/UserVo.java | 41 ++++++++++ .../com/kening/vordm/VoRdmApplication.java | 2 +- .../vordm/controller/LoginController.java | 50 ++++++++++++ .../vordm/mapper/DisasterInfoMapper.java | 12 ++- .../vordm/mapper/DisasterInfoMapper.xml | 23 ++++++ .../vordm/service/DisasterInfoService.java | 8 +- .../kening/vordm/service/EmailService.java | 4 + .../service/impl/DisasterInfoServiceImpl.java | 78 +++++++++++++------ .../vordm/service/impl/EmailServiceImpl.java | 25 ++++++ 9 files changed, 211 insertions(+), 32 deletions(-) create mode 100644 kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/UserVo.java create mode 100644 kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/LoginController.java diff --git a/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/UserVo.java b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/UserVo.java new file mode 100644 index 0000000..032b5e8 --- /dev/null +++ b/kn-service-api/biz-vordm-api/src/main/java/com/kening/vordm/vo/UserVo.java @@ -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; + +} diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/VoRdmApplication.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/VoRdmApplication.java index 60d7530..8464ead 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/VoRdmApplication.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/VoRdmApplication.java @@ -11,7 +11,7 @@ import org.springframework.cloud.client.SpringCloudApplication; @SpringCloudApplication public class VoRdmApplication { public static void main(String[] args) { - BladeApplication.run("yyhouc-"+CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args); + BladeApplication.run("glj-"+CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args); // BladeApplication.run("zqq-" + CommonConstant.KN_VORDM_MODULE_NAME, VoRdmApplication.class, args); } } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/LoginController.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/LoginController.java new file mode 100644 index 0000000..f4d446b --- /dev/null +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/controller/LoginController.java @@ -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); + } +} 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 9051bd0..af4d11d 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 @@ -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; @@ -49,4 +47,10 @@ public interface DisasterInfoMapper extends BaseMapper { List getLeft2Data(); List page(IPage page,@Param("callForHelpVo" )CallForHelpVo callForHelpVo); + + Integer getUserEmail(@Param("email") String email); + + Integer saveUserData(@Param("userVo") UserVo userVo); + + UserVo getUserByEmail(String email); } 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 f253c31..6092c73 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 @@ -37,6 +37,10 @@ d.disaster_type,d.disaster_time,d.disaster_country, m.organization + + insert into blade_user (tenant_id,password,email,status,is_deleted) + values (#{userVo.tenantId},#{userVo.password},#{userVo.email},1,0); + + + + + + diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/DisasterInfoService.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/DisasterInfoService.java index d852563..49001c7 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/DisasterInfoService.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/DisasterInfoService.java @@ -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; @@ -55,4 +53,6 @@ public interface DisasterInfoService extends IService { Boolean addVisitCount(Long id); IPage page(IPage page, CallForHelpVo callForHelpVo); + + R saveUserData(UserVo userVo); } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/EmailService.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/EmailService.java index 2c8f205..2761b64 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/EmailService.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/EmailService.java @@ -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; } 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 a65ebc4..ba99c1a 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 @@ -6,11 +6,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.kening.vordm.entity.DisasterInfo; import com.kening.vordm.mapper.DisasterInfoMapper; import com.kening.vordm.service.DisasterInfoService; -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.service.EmailService; +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.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.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -18,49 +22,53 @@ import java.util.ArrayList; import java.util.List; /** -* @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 -implements DisasterInfoService { + implements DisasterInfoService { + + private final BladeRedis bladeRedis; /** * 返回指定的灾害条目 + * * @param type * @param country * @param time * @param name * @return */ - public List getConditionData(String type, String country, String time, String name){ - List disasterInfos=this.baseMapper.getSelectCondition(type,country,time,name); + public List getConditionData(String type, String country, String time, String name) { + List disasterInfos = this.baseMapper.getSelectCondition(type, country, time, name); return disasterInfos; } /** * 用于获取灾害id类型 + * * @param disasterInfo * @return */ - public List getDisasterId(DisasterInfo disasterInfo){ + public List getDisasterId(DisasterInfo disasterInfo) { QueryWrapper 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 disasterInfos = this.baseMapper.selectList(qw); List ids = new ArrayList<>(); - if (!disasterInfos.isEmpty()){ + if (!disasterInfos.isEmpty()) { disasterInfos.stream().forEach(disasterInfo1 -> { - ids .add(disasterInfo1.getId()); + ids.add(disasterInfo1.getId()); }); return ids; } @@ -69,6 +77,7 @@ implements DisasterInfoService { /** * 获取债害详情信息 + * * @param id * @return */ @@ -79,14 +88,15 @@ implements DisasterInfoService { /** * 进行灾害信息的统计,国家,类型 + * * @param name * @return */ - public List getDisasterStatistics(String name){ + public List getDisasterStatistics(String name) { return this.baseMapper.getDisasterStatistics(name); } - public IPage getHomeDisaster(IPage page, Integer respondStatus){ + public IPage getHomeDisaster(IPage page, Integer respondStatus) { List disasterMangerInfos = this.baseMapper.getHomeDisaster(page, respondStatus); return page.setRecords(disasterMangerInfos); } @@ -128,8 +138,30 @@ implements DisasterInfoService { @Override public IPage page(IPage 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); } + } diff --git a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/EmailServiceImpl.java b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/EmailServiceImpl.java index fbd7a74..7218d63 100644 --- a/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/EmailServiceImpl.java +++ b/kn-service/biz-vordm/src/main/java/com/kening/vordm/service/impl/EmailServiceImpl.java @@ -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 From b4ac00a0733ccf6175f9c0d812de46cb9fb73ec4 Mon Sep 17 00:00:00 2001 From: glj Date: Mon, 17 Apr 2023 13:50:25 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/kening/vordm/mapper/DisasterInfoMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 e3a0f0e..3a3300f 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 @@ -106,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