|
|
|
@ -5,7 +5,9 @@ import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
|
|
import com.ruoyi.system.domain.BaseMonitorunitInfo;
|
|
|
|
|
import com.ruoyi.system.domain.dto.BaseAlarmModuleDto;
|
|
|
|
|
import com.ruoyi.system.service.IBaseMonitorunitInfoService;
|
|
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
@ -39,6 +41,9 @@ public class BaseAlarmModuleController extends BaseController
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseAlarmModuleService baseAlarmModuleService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IBaseMonitorunitInfoService baseMonitorunitInfoService;
|
|
|
|
|
|
|
|
|
|
@RequiresPermissions("base:alarmModule:view")
|
|
|
|
|
@GetMapping()
|
|
|
|
|
public String alarmModule()
|
|
|
|
@ -91,6 +96,16 @@ public class BaseAlarmModuleController extends BaseController
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult addSave(BaseAlarmModule baseAlarmModule)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(!baseAlarmModule.getMonitorunitId().isEmpty()){
|
|
|
|
|
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
baseMonitorunitInfo.setMonitorunitType(baseAlarmModule.getMonitorunitId());
|
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
|
|
|
|
|
if(baseMonitorunitInfos.size() > 0){
|
|
|
|
|
baseAlarmModule.setMonitorunitId(baseMonitorunitInfos.get(0).getMonitorunitType());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
baseAlarmModule.setAlarmmoduleId(UUID.randomUUID().toString());
|
|
|
|
|
baseAlarmModule.setCreatedBy(ShiroUtils.getLoginName());
|
|
|
|
|
baseAlarmModule.setCreatedTime(new Date());
|
|
|
|
@ -117,6 +132,14 @@ public class BaseAlarmModuleController extends BaseController
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public AjaxResult editSave(BaseAlarmModule baseAlarmModule)
|
|
|
|
|
{
|
|
|
|
|
if(!baseAlarmModule.getMonitorunitId().isEmpty()){
|
|
|
|
|
BaseMonitorunitInfo baseMonitorunitInfo = new BaseMonitorunitInfo();
|
|
|
|
|
baseMonitorunitInfo.setMonitorunitId(baseAlarmModule.getMonitorunitId());
|
|
|
|
|
List<BaseMonitorunitInfo> baseMonitorunitInfos = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
|
|
|
|
|
if(baseMonitorunitInfos.size() > 0){
|
|
|
|
|
baseAlarmModule.setMonitorunitId(baseMonitorunitInfos.get(0).getMonitorunitType());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
baseAlarmModule.setUpdatedBy(ShiroUtils.getLoginName());
|
|
|
|
|
baseAlarmModule.setUpdatedTime(new Date());
|
|
|
|
|
return toAjax(baseAlarmModuleService.updateBaseAlarmModule(baseAlarmModule));
|
|
|
|
|