个人中心

This commit is contained in:
why 2023-04-19 18:36:38 +08:00
parent c342307ac1
commit 260eb3acd9
11 changed files with 398 additions and 0 deletions

View File

@ -0,0 +1,156 @@
package com.kening.vordm.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import lombok.Data;
/**
*
* @TableName center_disaster_info
*/
@TableName(value ="center_disaster_info")
@Data
public class CenterDisasterInfo 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

@ -0,0 +1,72 @@
package com.kening.vordm.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.kening.vordm.entity.Tool;
import com.kening.vordm.service.CenterDisasterInfoService;
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.DisasterInfoVo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/ui/center")
public class CenterController {
private final CenterDisasterInfoService centerDisasterInfoService;
private final GuestInfoService guestInfoService;
/**
* 个人中心 Responding列表
* 必传email
* @param query
* @return
*/
@GetMapping("/respondingList")
public R<IPage<CenterDisasterInfo>> disasterInfoList(Query query, @RequestParam Map<String, String> params) {
return R.data(centerDisasterInfoService.page(Condition.getPage(query), Wrappers.<CenterDisasterInfo>lambdaQuery()
.eq(CenterDisasterInfo::getRespondStatus,2)
.eq(CenterDisasterInfo::getEmail,String.valueOf(params.get("email")))
.orderByDesc(CenterDisasterInfo::getApplyTime)
));
}
/**
* 个人中心 Responded列表
* 必传email
* @param query
* @return
*/
@GetMapping("/respondedList")
public R<IPage<CenterDisasterInfo>> respondedList(Query query, @RequestParam Map<String, String> params) {
return R.data(centerDisasterInfoService.page(Condition.getPage(query), Wrappers.<CenterDisasterInfo>lambdaQuery()
.eq(CenterDisasterInfo::getRespondStatus,3)
.eq(CenterDisasterInfo::getEmail,String.valueOf(params.get("email")))
.eq(CenterDisasterInfo::getStatus, 1)
.orderByDesc(CenterDisasterInfo::getVordmId)
));
}
@PostMapping("/updatePassword")
public R<Boolean> updatePassword(String oldPassword, String password, String email) {
return R.data(guestInfoService.updatePassword(oldPassword, password, email));
}
}

View File

@ -0,0 +1,18 @@
package com.kening.vordm.mapper;
import com.kening.vordm.vo.CenterDisasterInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Mapper
* @createDate 2023-04-19 11:46:32
* @Entity com.kening.vordm.vo.CenterDisasterInfo
*/
public interface CenterDisasterInfoMapper extends BaseMapper<CenterDisasterInfo> {
}

View File

@ -0,0 +1,47 @@
<?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.CenterDisasterInfoMapper">
<resultMap id="BaseResultMap" type="com.kening.vordm.vo.CenterDisasterInfo">
<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">
id,disaster_type,disaster_keyword,
disaster_time,upload_time,geometry,
disaster_level,disaster_country,respond_status,
visit_count,download_count,spider_type,
tempend_time,temp_start_time,create_time,
vordm_id,respond_time,sponsor_organization,
dict_value,disaster_img,size,
news,user_name,status,
apply_time,review_time
</sql>
</mapper>

View File

@ -16,4 +16,6 @@ public interface GuestInfoMapper extends BaseMapper<GuestInfo> {
UserVo getBladeUserByEmail(@Param("email") String email); UserVo getBladeUserByEmail(@Param("email") String email);
int updatePassword(String email, String password);
} }

View File

@ -23,6 +23,9 @@
organization,research_field,create_time, organization,research_field,create_time,
is_manage,occupation,professional_title,last_name,first_name is_manage,occupation,professional_title,last_name,first_name
</sql> </sql>
<update id="updatePassword">
update blade_user t set t.password = #{password} where t.email = #{email}
</update>
<select id="getBladeUserByEmail" resultType="com.kening.vordm.vo.UserVo"> <select id="getBladeUserByEmail" resultType="com.kening.vordm.vo.UserVo">
select * FROM blade_user select * FROM blade_user

View File

@ -0,0 +1,13 @@
package com.kening.vordm.service;
import com.kening.vordm.vo.CenterDisasterInfo;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Service
* @createDate 2023-04-19 11:46:32
*/
public interface CenterDisasterInfoService extends IService<CenterDisasterInfo> {
}

View File

@ -11,4 +11,5 @@ import com.kening.vordm.entity.GuestInfo;
*/ */
public interface GuestInfoService extends IService<GuestInfo> { public interface GuestInfoService extends IService<GuestInfo> {
Boolean updatePassword(String oldPassword, String password, String email);
} }

View File

@ -0,0 +1,22 @@
package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kening.vordm.vo.CenterDisasterInfo;
import com.kening.vordm.service.CenterDisasterInfoService;
import com.kening.vordm.mapper.CenterDisasterInfoMapper;
import org.springframework.stereotype.Service;
/**
* @author wangns
* @description 针对表center_disaster_info的数据库操作Service实现
* @createDate 2023-04-19 11:46:32
*/
@Service
public class CenterDisasterInfoServiceImpl extends ServiceImpl<CenterDisasterInfoMapper, CenterDisasterInfo>
implements CenterDisasterInfoService{
}

View File

@ -1,9 +1,12 @@
package com.kening.vordm.service.impl; package com.kening.vordm.service.impl;
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.GuestInfo; import com.kening.vordm.entity.GuestInfo;
import com.kening.vordm.mapper.GuestInfoMapper; import com.kening.vordm.mapper.GuestInfoMapper;
import com.kening.vordm.service.GuestInfoService; import com.kening.vordm.service.GuestInfoService;
import com.kening.vordm.vo.UserVo;
import org.springblade.core.tool.utils.DigestUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -15,4 +18,17 @@ import org.springframework.stereotype.Service;
public class GuestInfoServiceImpl extends ServiceImpl<GuestInfoMapper, GuestInfo> public class GuestInfoServiceImpl extends ServiceImpl<GuestInfoMapper, GuestInfo>
implements GuestInfoService { implements GuestInfoService {
@Override
public Boolean updatePassword(String oldPassword, String password, String email) {
String op = DigestUtil.encrypt(oldPassword);
UserVo user = this.baseMapper.getBladeUserByEmail(email);
int i = 0;
if(op.equals(user.getPassword())){
i = this.baseMapper.updatePassword(email, password);
return true;
}else{
return false;
}
}
} }

View File

@ -0,0 +1,48 @@
<?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.CenterDisasterInfoMapper">
<resultMap id="BaseResultMap" type="com.kening.vordm.vo.CenterDisasterInfo">
<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"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,disaster_type,disaster_keyword,
disaster_time,upload_time,geometry,
disaster_level,disaster_country,respond_status,
visit_count,download_count,spider_type,
tempend_time,temp_start_time,create_time,
vordm_id,respond_time,sponsor_organization,
dict_value,disaster_img,size,
news,user_name,status,
apply_time,review_time,email
</sql>
</mapper>