Commit b150b683 authored by 周昊's avatar 周昊

1、开发接口获取固有风险详情

parent edf09961
......@@ -34,6 +34,13 @@
<artifactId>lombok</artifactId>
</dependency>
<!-- hutool 常用工具类包 -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.5</version>
</dependency>
</dependencies>
</project>
package com.censoft.censoftrongtong.controller;
import com.censoft.censoftrongtong.domain.*;
import com.censoft.censoftrongtong.domain.dto.RiskInherentListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppDetailsDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppListDto;
import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.enums.RiskPlanStatusType;
import com.censoft.censoftrongtong.service.*;
import com.ruoyi.common.config.RuoYiConfig;
......@@ -250,4 +247,15 @@ public class RiskPlanAppController extends BaseController {
return R.ok(riskPlanInherentListService.saveRiskInherentListSaveDto(saveDto));
}
/**
* 获取固有风险详情
*
* @param inherentId 固有风险id
* @real_return {@link R<RiskPlanAppInherentListDetailsDto>}
*/
@GetMapping("/inherent/details/{inherentId}")
public R<RiskPlanAppInherentListDetailsDto> getRiskPlanAppInherentListDetailsDtoByInherentId(@PathVariable("inherentId") Long inherentId) {
return R.ok(riskPlanInherentListService.getRiskPlanAppInherentListDetailsDtoByInherentId(inherentId));
}
}
package com.censoft.censoftrongtong.domain.dto;
import com.ruoyi.system.domain.SysUploadFile;
import lombok.Data;
import java.util.List;
/**
* @author 周昊
* @desc ...
* @date 2023-06-27 14:45:45
*/
@Data
public class RiskPlanAppInherentListDetailsDto {
/** id */
private Long id;
/** 评估人id */
private Long userId;
/** 评估人名称 */
private String userName;
/** 项目id */
private Long projectId;
/** 项目名称 */
private String projectName;
/** 楼栋ids */
private String buildingId;
/** 楼栋名称 */
private String buildingName;
/** 楼层id */
private Long floorId;
/** 楼层名称 */
private String floorName;
/** 房间id */
private Long roomId;
/** 房间名称 */
private String roomName;
/** 风险源名称 */
private String name;
/** 风险因素 */
private String factor;
/** 事故类型 */
private String type;
/** 风险等级 */
private String level;
/** 存在部位 */
private String presenceLocation;
/** 风险源照片id */
private String pictureFileIds;
/** 风险源照片 */
private List<SysUploadFile> pictureFile;
/** 工程技术措施 */
private String measuresProject;
/** 工程技术措施附件 */
private String measuresProjectFileIds;
/** 工程技术措施附件 */
private List<SysUploadFile> measuresProjectFile;
/** 管理措施 */
private String measuresAdministration;
/** 管理措施附件 */
private String measuresAdministrationFileIds;
/** 管理措施附件 */
private List<SysUploadFile> measuresAdministrationFile;
/** 应急处置措施 */
private String measuresEmergency;
/** 应急处置措施附件 */
private String measuresEmergencyFileIds;
/** 应急处置措施附件 */
private List<SysUploadFile> measuresEmergencyFile;
/** 参考依据 */
private String referenceBasis;
}
package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto;
import org.apache.ibatis.annotations.Param;
......@@ -63,4 +64,6 @@ public interface RiskPlanInherentListMapper
public int deleteRiskPlanInherentListByIds(Long[] ids);
List<RiskPlanAppInherentListDto> getInherentListByPlanId(@Param("planId") Long planId, @Param("buildingId") Long buildingId, @Param("floorId") Long floorId, @Param("roomId") Long roomId);
RiskPlanAppInherentListDetailsDto getRiskPlanAppInherentListDetailsDtoByInherentId(@Param("inherentId") Long inherentId);
}
......@@ -2,6 +2,7 @@ package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskInherentListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto;
import java.util.List;
......@@ -65,4 +66,6 @@ public interface IRiskPlanInherentListService
List<RiskPlanAppInherentListDto> getInherentListByPlanId(Long planId, Long buildingId, Long floorId, Long roomId);
Integer saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto);
RiskPlanAppInherentListDetailsDto getRiskPlanAppInherentListDetailsDtoByInherentId(Long inherentId);
}
package com.censoft.censoftrongtong.service.impl;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskInherentListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto;
import com.censoft.censoftrongtong.mapper.RiskPlanInherentListMapper;
import com.censoft.censoftrongtong.service.IRiskPlanInherentListService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.service.ISysUploadFileService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.date.DateUnit;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
/**
* 固有风险清单库Service业务层处理
*
*
* @author ruoyi
* @date 2023-06-26
*/
@Service
public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListService
{
public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListService {
@Autowired
private RiskPlanInherentListMapper riskPlanInherentListMapper;
@Resource
private ISysUploadFileService uploadFileService;
/**
* 查询固有风险清单库
*
*
* @param id 固有风险清单库主键
* @return 固有风险清单库
*/
@Override
public RiskPlanInherentList selectRiskPlanInherentListById(Long id)
{
public RiskPlanInherentList selectRiskPlanInherentListById(Long id) {
return riskPlanInherentListMapper.selectRiskPlanInherentListById(id);
}
/**
* 查询固有风险清单库列表
*
*
* @param riskPlanInherentList 固有风险清单库
* @return 固有风险清单库
*/
@Override
public List<RiskPlanInherentList> selectRiskPlanInherentListList(RiskPlanInherentList riskPlanInherentList)
{
public List<RiskPlanInherentList> selectRiskPlanInherentListList(RiskPlanInherentList riskPlanInherentList) {
return riskPlanInherentListMapper.selectRiskPlanInherentListList(riskPlanInherentList);
}
/**
* 新增固有风险清单库
*
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
@Override
public int insertRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList)
{
public int insertRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList) {
riskPlanInherentList.setCreateTime(DateUtils.getNowDate());
return riskPlanInherentListMapper.insertRiskPlanInherentList(riskPlanInherentList);
}
/**
* 修改固有风险清单库
*
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
@Override
public int updateRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList)
{
public int updateRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList) {
riskPlanInherentList.setUpdateTime(DateUtils.getNowDate());
return riskPlanInherentListMapper.updateRiskPlanInherentList(riskPlanInherentList);
}
/**
* 批量删除固有风险清单库
*
*
* @param ids 需要删除的固有风险清单库主键
* @return 结果
*/
@Override
public int deleteRiskPlanInherentListByIds(Long[] ids)
{
public int deleteRiskPlanInherentListByIds(Long[] ids) {
return riskPlanInherentListMapper.deleteRiskPlanInherentListByIds(ids);
}
/**
* 删除固有风险清单库信息
*
*
* @param id 固有风险清单库主键
* @return 结果
*/
@Override
public int deleteRiskPlanInherentListById(Long id)
{
public int deleteRiskPlanInherentListById(Long id) {
return riskPlanInherentListMapper.deleteRiskPlanInherentListById(id);
}
......@@ -106,7 +111,42 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
@Override
public Integer saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto) {
RiskPlanInherentList inherentList = new RiskPlanInherentList();
BeanUtils.copyProperties(saveDto,inherentList);
BeanUtils.copyProperties(saveDto, inherentList);
return insertRiskPlanInherentList(inherentList);
}
@Override
public RiskPlanAppInherentListDetailsDto getRiskPlanAppInherentListDetailsDtoByInherentId(Long inherentId) {
RiskPlanAppInherentListDetailsDto dto = riskPlanInherentListMapper.getRiskPlanAppInherentListDetailsDtoByInherentId(inherentId);
//风险源照片
if (!StrUtil.hasEmpty(dto.getPictureFileIds())) {
List<Long> fileIds = Arrays.stream(dto.getPictureFileIds().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
dto.setPictureFile(uploadFileService.selectSysFileByFileIds(fileIds));
}
//工程技术措施附件
if (!StrUtil.hasEmpty(dto.getMeasuresProjectFileIds())) {
List<Long> fileIds = Arrays.stream(dto.getMeasuresProjectFileIds().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
dto.setMeasuresProjectFile(uploadFileService.selectSysFileByFileIds(fileIds));
}
//管理措施附件
if (!StrUtil.hasEmpty(dto.getMeasuresAdministrationFileIds())) {
List<Long> fileIds = Arrays.stream(dto.getMeasuresAdministrationFileIds().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
dto.setMeasuresAdministrationFile(uploadFileService.selectSysFileByFileIds(fileIds));
}
//应急处置措施附件
if (!StrUtil.hasEmpty(dto.getMeasuresEmergencyFileIds())) {
List<Long> fileIds = Arrays.stream(dto.getMeasuresEmergencyFileIds().split(","))
.map(Long::parseLong)
.collect(Collectors.toList());
dto.setMeasuresEmergencyFile(uploadFileService.selectSysFileByFileIds(fileIds));
}
return dto;
}
}
......@@ -91,6 +91,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="roomId != null"> AND lr.id = #{roomId}</if>
</where>
</select>
<select id="getRiskPlanAppInherentListDetailsDtoByInherentId"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto">
SELECT
rpil.id,
su.user_id AS userId,
su.nick_name AS userName,
lp.id AS projectId,
lp.`name` AS projectName,
lb.id AS buildingId,
lb.`name` AS buildingName,
lf.id AS floorId,
lf.`name` AS floorName,
lr.id AS roomId,
lr.`name` AS roomName,
rpil.`name`,
rpil.factor,
rpil.type,
rpil.`level`,
rpil.presence_location AS presenceLocation,
rpil.picture_file_ids AS pictureFileIds,
rpil.measures_project AS measuresProject,
rpil.measures_project_file_ids AS measuresProjectFileIds,
rpil.measures_administration AS measuresAdministration,
rpil.measures_administration_file_ids AS measuresAdministrationFileIds,
rpil.measures_emergency AS measuresEmergency,
rpil.measures_emergency_file_ids AS measuresEmergencyFileIds,
rpil.reference_basis AS referenceBasis
FROM
risk_plan_inherent_list rpil
LEFT JOIN sys_user su ON su.user_id = rpil.user_id
LEFT JOIN risk_plan rp ON rp.id = rpil.plan_id
LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id
LEFT JOIN ledger_building lb ON lb.id = lf.building_id
WHERE
rpil.id = #{inherentId}
</select>
<insert id="insertRiskPlanInherentList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanInherentList" useGeneratedKeys="true" keyProperty="id">
insert into risk_plan_inherent_list
......
......@@ -41,8 +41,24 @@ public class SysLoginController
* @return 结果
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody)
public AjaxResult pcLogin(@RequestBody LoginBody loginBody)
{
return login(loginBody);
}
/**
* app登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/app-api/login")
public AjaxResult appLogin(@RequestBody LoginBody loginBody)
{
return login(loginBody);
}
private AjaxResult login(LoginBody loginBody){
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
......@@ -57,8 +73,23 @@ public class SysLoginController
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo()
public AjaxResult getPcInfo()
{
return getInfo();
}
/**
* 获取app用户信息
*
* @return 用户信息
*/
@GetMapping("/app-api/getInfo")
public AjaxResult getAppInfo()
{
return getInfo();
}
private AjaxResult getInfo(){
SysUser user = SecurityUtils.getLoginUser().getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
......
......@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
// 过滤请求
.authorizeRequests()
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
.antMatchers("/login", "/register", "/captchaImage").permitAll()
.antMatchers("/login","/app-api/login", "/register", "/captchaImage").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment