代码提交

This commit is contained in:
glj 2023-04-07 18:13:22 +08:00
parent 2c4fae332e
commit 2bb3d1eed9
9 changed files with 247 additions and 23 deletions

View File

@ -67,6 +67,11 @@ public class DisasterInfo implements Serializable {
*/
private Integer visitCount;
/**
* 本灾害的数据下载次数
*/
private Integer downloadCount;
/**
* 爬虫类型
*/

View File

@ -0,0 +1,124 @@
package com.kening.vordm.vo;
import lombok.Data;
import java.util.Date;
@Data
public class EntityDataUserVo {
/**
* 数据名称
*/
private String title;
/**
* 数据产品的大小byte
*/
private Long size;
/**
* 数据类型0-基础数据1-减灾产品2-制图产品
*/
private String type;
/**
* 数据下载链接网站上对象存储路径
*/
private String link;
/**
* 数据备注
*/
private String remark;
/**
* 上传时间
*/
private Date uploadTime;
/**
* 灾害id
*/
private Long disasterId;
/**
* 可视化可视化标志0-不可可视化1-表示可以可视化
*/
private Integer visualFlag;
/**
* 可视化跳转中心经度
*/
private Double visualLon;
/**
* 可视化跳转中心纬度
*/
private Double visualLat;
/**
* 审核时间
*/
private Date examTime;
/**
* 0 未审核1-审核已通过2-审核未通过
*/
private Integer status;
/**
* 上传人
*/
private Long uploaderId;
/**
* 管理人/审核人
*/
private Long managerId;
/**
* 审核时间
*/
private Date reviewTime;
/**
* 来源机构
*/
private String sourceOrganization;
/**
* 用户名称
*/
private String username;
/**
* 用户邮件
*/
private String email;
/**
* 用户组织机构
*/
private String organization;
/**
* 研究范围
*/
private String researchField;
/**
* 创建时间
*/
private Date createTime;
/**
* 是否是管理员
*/
private Integer isManage;
/**
* 验证码
*/
private Integer Verification;
}

View File

@ -117,16 +117,10 @@ public class DisasterInfoController {
*/
@PostMapping("/saveDownloadRecord")
public R saveDownloadRecord(@RequestBody DownloadRecord downloadRecord) {
LambdaQueryWrapper<DownloadRecord> qw = new LambdaQueryWrapper<>();
qw.eq(DownloadRecord::getBigType, downloadRecord.getBigType());
qw.eq(DownloadRecord::getSmallType, downloadRecord.getSmallType());
qw.eq(DownloadRecord::getDiasterId, downloadRecord.getDiasterId());
DownloadRecord one = downloadRecordService.getOne(qw);
if (one != null) {
one.setCount(one.getCount() + 1);
downloadRecordService.updateById(one);
} else {
downloadRecordService.save(downloadRecord);
DisasterInfo byId = disasterInfoService.getById(downloadRecord.getDiasterId());
if (byId != null) {
byId.setDownloadCount(byId.getDownloadCount() +1);
disasterInfoService.updateById(byId);
}
return R.status(true);
}

View File

@ -3,13 +3,15 @@ package com.kening.vordm.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.service.EntityDataService;
import com.kening.vordm.vo.EntityDataUserVo;
import com.kening.vordm.vo.UserTenantVo;
import lombok.RequiredArgsConstructor;
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.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;
@RestController
@RequiredArgsConstructor
@ -17,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
public class EntityDataController {
//实体数据服务层
private final EntityDataService respondInfoService;
private final EntityDataService entityDataService;
/**
* 实体数据列表信息
@ -27,9 +29,26 @@ public class EntityDataController {
*/
@GetMapping("/getList")
public R<IPage<EntityData>> getEntityDataList(EntityData entityData, Query query) {
return R.data(respondInfoService.getEntityDataList(Condition.getPage(query), entityData));
return R.data(entityDataService.getEntityDataList(Condition.getPage(query), entityData));
}
/**
* 获取所以不可可视化下机构信息
* @return
*/
@GetMapping("/getEntityDataSourceOrganization")
public R<List<UserTenantVo>> getEntityDataSourceOrganization() {
return R.data(entityDataService.getEntityDataSourceOrganization());
}
/**
* Resource upload 上传实体信息
* @return
*/
@PostMapping("/saveEntityData")
public R saveEntityData(@RequestBody EntityDataUserVo entityDataUserVo) {
return R.data(entityDataService.saveEntityData(entityDataUserVo));
}
}

View File

@ -15,6 +15,7 @@
<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"/>
@ -29,7 +30,7 @@
di.disaster_level,di.disaster_country,di.respond_status,
di.visit_count,di.spider_type,di.tempend_time,
di.temp_start_time,di.create_time,di.vordm_id,
di.respond_time
di.respond_time,di.download_count
</sql>
<sql id="Home_Disaster_Info">
d.disaster_type,d.disaster_time,d.disaster_country,

View File

@ -4,8 +4,11 @@ package com.kening.vordm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.vo.UserTenantVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author G1393
* @description 针对表entity_data(其他上传的实体数据)的数据库操作Mapper
@ -18,4 +21,6 @@ public interface EntityDataMapper extends BaseMapper<EntityData> {
IPage<EntityData> getEntityDataList(@Param("entityData") EntityData entityData, IPage<Object> page);
List<UserTenantVo> getEntityDataSourceOrganization();
}

View File

@ -44,7 +44,7 @@
<if test="entityData.status != null and entityData.status != ''">
and ed.status = #{entityData.status}
</if>
<if test="entityData.visualFlag != null and entityData.visualFlag != ''">
<if test="entityData.visualFlag != null">
and ed.visual_flag = #{entityData.visualFlag}
</if>
<if test="entityData.type != null and entityData.type != ''">
@ -56,4 +56,10 @@
</where>
ORDER BY ed.upload_time DESC
</select>
<select id="getEntityDataSourceOrganization" resultType="com.kening.vordm.vo.UserTenantVo">
select ed.source_organization AS organizationName
from entity_data ed
GROUP BY ed.source_organization
</select>
</mapper>

View File

@ -4,6 +4,10 @@ package com.kening.vordm.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kening.vordm.entity.EntityData;
import com.kening.vordm.vo.EntityDataUserVo;
import com.kening.vordm.vo.UserTenantVo;
import java.util.List;
/**
* @author G1393
@ -14,4 +18,15 @@ public interface EntityDataService extends IService<EntityData> {
IPage<EntityData> getEntityDataList(IPage<Object> page, EntityData entityData);
/**
* 获取所以不可可视化下机构信息
* @return
*/
List<UserTenantVo> getEntityDataSourceOrganization();
/**
* Resource upload 上传实体信息
* @return
*/
Boolean saveEntityData(EntityDataUserVo entityDataUserVo);
}

View File

@ -1,16 +1,20 @@
package com.kening.vordm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.EntityData;
import com.kening.vordm.entity.GuestInfo;
import com.kening.vordm.mapper.EntityDataMapper;
import com.kening.vordm.mapper.GuestInfoMapper;
import com.kening.vordm.service.EntityDataService;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import com.kening.vordm.vo.EntityDataUserVo;
import com.kening.vordm.vo.UserTenantVo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
import java.util.List;
/**
@ -18,14 +22,65 @@ import java.util.List;
* @description 针对表entity_data(其他上传的实体数据)的数据库操作Service实现
* @createDate 2023-04-04 15:54:30
*/
@Slf4j
@Service
@AllArgsConstructor
public class EntityDataServiceImpl extends ServiceImpl<EntityDataMapper, EntityData>
implements EntityDataService {
private GuestInfoMapper guestInfoMapper;
@Override
public IPage<EntityData> getEntityDataList(IPage<Object> page, EntityData entityData) {
return this.baseMapper.getEntityDataList(entityData, page);
}
/**
* 获取所以不可可视化下机构信息
* @return
*/
@Override
public List<UserTenantVo> getEntityDataSourceOrganization() {
return this.baseMapper.getEntityDataSourceOrganization();
}
@Override
public Boolean saveEntityData(EntityDataUserVo entityDataUserVo) {
//创建实体数据
EntityData entityData = new EntityData();
//判断上传用户是否存在
LambdaQueryWrapper<GuestInfo> qw = new LambdaQueryWrapper<>();
qw.eq(GuestInfo::getEmail,entityDataUserVo.getEmail());
GuestInfo guestInfo1 = guestInfoMapper.selectOne(qw);
if (guestInfo1==null){
GuestInfo guestInfo = new GuestInfo();
guestInfo.setEmail(entityDataUserVo.getEmail());
guestInfo.setOrganization(entityDataUserVo.getOrganization());
guestInfo.setIsManage(entityDataUserVo.getIsManage());
guestInfo.setResearchField(entityDataUserVo.getResearchField());
guestInfo.setUsername(entityDataUserVo.getUsername());
guestInfo.setCreateTime(new Date());
guestInfoMapper.insert(guestInfo);
entityData.setUploaderId(guestInfo.getId());
}else {
entityData.setUploaderId(guestInfo1.getId());
}
//实体数据
entityData.setTitle(entityDataUserVo.getTitle());
entityData.setSize(entityDataUserVo.getSize());
entityData.setLink(entityDataUserVo.getLink());
entityData.setDisasterId(entityDataUserVo.getDisasterId());
entityData.setUploaderId(entityDataUserVo.getUploaderId());
entityData.setUploadTime(new Date());
entityData.setSourceOrganization(entityDataUserVo.getOrganization());
this.baseMapper.insert(entityData);
return null;
}
}