Commit 05d22ac6 authored by 周昊's avatar 周昊

1、APP端固有风险模版列表

2、复制房间接口
parent 3d6e5caa
......@@ -20,6 +20,7 @@ import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.system.service.ISysUploadFileService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -90,6 +91,9 @@ public class RiskPlanAppController extends BaseController {
@Resource
private IEvaluationFactorItemsService evaluationFactorItemsService;
@Resource
private IRiskInherentListService riskInherentListService;
/**
* 服务器地址
......@@ -874,4 +878,25 @@ public class RiskPlanAppController extends BaseController {
return R.ok(riskAssessmentMatrixLevelService.getRiskAssessmentExistingMatrixLevelByScore(score));
}
/**
* 获取固有风险模版列表
*/
@GetMapping("/inherent/template/list")
public TableDataInfo list(RiskInherentList riskInherentList)
{
startPage();
return getDataTable(riskInherentListService.selectRiskInherentListList(riskInherentList));
}
/**
* app端复制房间
*/
@Log(title = "app端复制房间", businessType = BusinessType.INSERT)
@PostMapping("/copy/room/{planId}")
public AjaxResult copyRoom(@RequestBody LedgerRoom ledgerRoom,@PathVariable Long planId)
{
return AjaxResult.success(ledgerRoomService.copyRoom(ledgerRoom,getLoginUser(),planId));
}
}
......@@ -2,6 +2,7 @@ package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.LedgerRoom;
import com.github.yulichang.base.MPJBaseService;
import com.ruoyi.common.core.domain.model.LoginUser;
import java.util.List;
......@@ -30,4 +31,6 @@ public interface ILedgerRoomService extends MPJBaseService<LedgerRoom>
List<LedgerRoom> selectLedgerRoomList(LedgerRoom ledgerRoom);
void deleteRoomByRoomIds(List<Long> targetRoomIds);
Integer copyRoom(LedgerRoom ledgerRoom, LoginUser loginUser,Long planId);
}
......@@ -3,9 +3,14 @@ package com.censoft.censoftrongtong.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.censoft.censoftrongtong.domain.LedgerRoom;
import com.censoft.censoftrongtong.domain.RiskPlanExistingList;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.mapper.LedgerRoomMapper;
import com.censoft.censoftrongtong.service.ILedgerRoomService;
import com.censoft.censoftrongtong.service.IRiskPlanExistingListService;
import com.censoft.censoftrongtong.service.IRiskPlanInherentListService;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.common.core.domain.model.LoginUser;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -23,6 +28,12 @@ public class LedgerRoomServiceImpl extends MPJBaseServiceImpl<LedgerRoomMapper,
@Resource
private LedgerRoomMapper ledgerRoomMapper;
@Resource
private IRiskPlanInherentListService riskPlanInherentListService;
@Resource
private IRiskPlanExistingListService riskPlanExistingListService;
@Override
public List<LedgerRoom> getRoomListByFloorId(Long floorId) {
LambdaQueryWrapper<LedgerRoom> wrapper = new LambdaQueryWrapper<LedgerRoom>()
......@@ -47,6 +58,43 @@ public class LedgerRoomServiceImpl extends MPJBaseServiceImpl<LedgerRoomMapper,
}
}
@Override
public Integer copyRoom(LedgerRoom ledgerRoom, LoginUser loginUser, Long planId) {
//复制房间
Long roomId = ledgerRoom.getId();
ledgerRoom.setId(null);
ledgerRoom.setCreateBy(loginUser.getUsername());
save(ledgerRoom);
LambdaQueryWrapper<RiskPlanInherentList> wrapper = new LambdaQueryWrapper<>();
wrapper = wrapper.eq(RiskPlanInherentList::getRoomId,roomId);
List<RiskPlanInherentList> riskPlanInherentLists = riskPlanInherentListService.list(wrapper);
for (RiskPlanInherentList riskPlanInherentList : riskPlanInherentLists) {
//复制固有
Long inherentListId = riskPlanInherentList.getId();
riskPlanInherentList.setId(null);
riskPlanInherentList.setRoomId(ledgerRoom.getId());
riskPlanInherentList.setUserId(loginUser.getUserId());
riskPlanInherentList.setPlanId(planId);
riskPlanInherentList.setCreateBy(loginUser.getUsername());
riskPlanInherentListService.save(riskPlanInherentList);
LambdaQueryWrapper<RiskPlanExistingList> wrapper2 = new LambdaQueryWrapper<>();
wrapper2 = wrapper2.eq(RiskPlanExistingList::getInherentId,inherentListId);
List<RiskPlanExistingList> riskPlanExistingLists = riskPlanExistingListService.list(wrapper2);
for (RiskPlanExistingList riskPlanExistingList : riskPlanExistingLists) {
//复制现有
riskPlanExistingList.setId(null);
riskPlanExistingList.setInherentId(riskPlanInherentList.getId());
riskPlanExistingList.setUserId(loginUser.getUserId());
riskPlanExistingList.setPlanId(planId);
riskPlanExistingList.setCreateBy(loginUser.getUsername());
riskPlanExistingListService.save(riskPlanExistingList);
}
}
return null;
}
private String getLevelColorByRoomId(Long roomId) {
String level = ledgerRoomMapper.getLevelColorByRoomId(roomId);
if (StrUtil.isBlank(level)) {return "#F0F1F5";}
......
......@@ -35,6 +35,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectRiskInherentListVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="pointType != null and pointType != ''"> and point_type = #{pointType}</if>
<if test="safetyWarningSigns != null and safetyWarningSigns != ''"> and safety_warning_signs like concat('%', #{safetyWarningSigns}, '%')</if>
<if test="factor != null and factor != ''"> and factor like concat('%', #{factor}, '%')</if>
<if test="type != null and type != ''"> and type like concat('%', #{type}, '%')</if>
</where>
</select>
......
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