驾驶舱功能调整
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.njcn.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -11,12 +12,13 @@ import com.njcn.system.pojo.vo.PqDashboardPageVO;
|
||||
import com.njcn.system.service.PqDashboardPageService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -59,7 +61,7 @@ public class PqDashboardPageController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("删除驾驶舱页面")
|
||||
public HttpResult<Boolean> deleteDashboard(@RequestParam("id") String id){
|
||||
log.info("修改驾驶舱页面");
|
||||
log.info("删除驾驶舱页面");
|
||||
String methodDescribe = getMethodDescribe("deleteDashboard");
|
||||
Boolean result = pqDashboardPageService.removeById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -69,7 +71,7 @@ public class PqDashboardPageController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询驾驶舱页面")
|
||||
public HttpResult<PqDashboardPageVO> queryById(@RequestParam("id") String id){
|
||||
log.info("新增驾驶舱页面");
|
||||
log.info("查询驾驶舱页面");
|
||||
String methodDescribe = getMethodDescribe("queryById");
|
||||
PqDashboardPageVO result = pqDashboardPageService.queryById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
@@ -77,10 +79,10 @@ public class PqDashboardPageController extends BaseController {
|
||||
@PostMapping("/activatePage")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("激活的驾驶舱页面")
|
||||
public HttpResult<Boolean> activatePage(@RequestParam("id") String id){
|
||||
public HttpResult<Boolean> activatePage(@RequestParam("id") String id,@RequestParam("state") Integer state){
|
||||
log.info("激活的驾驶舱页面");
|
||||
String methodDescribe = getMethodDescribe("activatePage");
|
||||
Boolean result = pqDashboardPageService.activatePage(id);
|
||||
Boolean result = pqDashboardPageService.activatePage(id,state);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ public class PqDashboardPageController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询激活的驾驶舱页面")
|
||||
public HttpResult<PqDashboardPageVO> queryActivatePage(){
|
||||
log.info("新增驾驶舱页面");
|
||||
log.info("查询激活的驾驶舱页面");
|
||||
String methodDescribe = getMethodDescribe("queryActivatePage");
|
||||
PqDashboardPageVO vo = new PqDashboardPageVO();
|
||||
PqDashboardPage result = pqDashboardPageService.lambdaQuery().eq(PqDashboardPage::getState,1).one();
|
||||
@@ -100,9 +102,32 @@ public class PqDashboardPageController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("分页查询")
|
||||
public HttpResult<Page<PqDashboardPageVO>> queryPage(@RequestBody PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam){
|
||||
log.info("新增驾驶舱页面");
|
||||
log.info("分页查询");
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
Page<PqDashboardPageVO> result = pqDashboardPageService.queryPage(pqDashboardPageQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/queryByPagePath")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据页面路由查询数据")
|
||||
public HttpResult<PqDashboardPageVO> queryByPagePath(@RequestParam("pagePath") String pagePath){
|
||||
String methodDescribe = getMethodDescribe("queryByPagePath");
|
||||
PqDashboardPageVO result = pqDashboardPageService.queryByPagePath(pagePath);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/getDashboardPageByUserId")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("根据用户id查询用户驾驶舱")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true),
|
||||
@ApiImplicitParam(name = "state", value = "状态", required = true)
|
||||
})
|
||||
public HttpResult<List<PqDashboardPage>> getDashboardPageByUserId(@RequestParam("id") String id,@RequestParam("state") boolean state){
|
||||
String methodDescribe = getMethodDescribe("getDashboardPageByUserId");
|
||||
List<PqDashboardPage> result = pqDashboardPageService.getDashboardPageByUserId(id,state);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.system.pojo.param.PqDashboardPageParam;
|
||||
import com.njcn.system.pojo.po.PqDashboardPage;
|
||||
import com.njcn.system.pojo.vo.PqDashboardPageVO;
|
||||
import com.njcn.user.pojo.po.HomePage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,5 +28,9 @@ public interface PqDashboardPageService extends IService<PqDashboardPage> {
|
||||
|
||||
Page<PqDashboardPageVO> queryPage(PqDashboardPageParam.PqDashboardPageQueryParam pqDashboardPageQueryParam);
|
||||
|
||||
Boolean activatePage(String id);
|
||||
Boolean activatePage(String id,Integer state);
|
||||
|
||||
PqDashboardPageVO queryByPagePath(String pagePath);
|
||||
|
||||
List<PqDashboardPage> getDashboardPageByUserId(String id,boolean state);
|
||||
}
|
||||
|
||||
@@ -4,28 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||
import com.njcn.device.pq.pojo.param.NodeParam;
|
||||
import com.njcn.device.pq.pojo.po.Node;
|
||||
import com.njcn.supervision.pojo.po.device.LineWarning;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.mapper.TemplateRelMapper;
|
||||
import com.njcn.system.mapper.PqDashboardPageMapper;
|
||||
import com.njcn.system.pojo.param.PqDashboardPageParam;
|
||||
import com.njcn.system.pojo.po.TemplateRel;
|
||||
import com.njcn.system.pojo.po.PqDashboardPage;
|
||||
import com.njcn.system.pojo.vo.PqDashboardPageVO;
|
||||
import com.njcn.system.service.PqDashboardPageService;
|
||||
import com.njcn.user.pojo.constant.HomePageState;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.njcn.system.mapper.PqDashboardPageMapper;
|
||||
import com.njcn.system.pojo.po.PqDashboardPage;
|
||||
import com.njcn.system.service.PqDashboardPageService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -43,19 +36,19 @@ public class PqDashboardPageServiceImpl extends ServiceImpl<PqDashboardPageMappe
|
||||
@Override
|
||||
public Boolean addDashboard(PqDashboardPageParam pqDashboardPageParam) {
|
||||
PqDashboardPage pqDashboardPage = new PqDashboardPage();
|
||||
checkName(pqDashboardPageParam,false);
|
||||
// checkName(pqDashboardPageParam,false);
|
||||
|
||||
BeanUtils.copyProperties(pqDashboardPageParam,pqDashboardPage);
|
||||
pqDashboardPage.setState(0);
|
||||
pqDashboardPage.setUserId(RequestUtil.getUserIndex());
|
||||
this.save(pqDashboardPage);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateDashboard(PqDashboardPageParam.UpdatePqDashboardPageParam updatePqDashboardPageParam) {
|
||||
PqDashboardPage pqDashboardPage = new PqDashboardPage();
|
||||
checkName(updatePqDashboardPageParam,true);
|
||||
// checkName(updatePqDashboardPageParam,true);
|
||||
BeanUtils.copyProperties(updatePqDashboardPageParam,pqDashboardPage);
|
||||
this.updateById(pqDashboardPage);
|
||||
|
||||
@@ -83,12 +76,33 @@ public class PqDashboardPageServiceImpl extends ServiceImpl<PqDashboardPageMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean activatePage(String id) {
|
||||
this.lambdaUpdate().set(PqDashboardPage::getState,1).eq(PqDashboardPage::getId,id).update();
|
||||
this.lambdaUpdate().set(PqDashboardPage::getState,0).ne(PqDashboardPage::getId,id).update();
|
||||
public Boolean activatePage(String id,Integer state) {
|
||||
return this.lambdaUpdate().set(PqDashboardPage::getState,state).eq(PqDashboardPage::getId,id).update();
|
||||
}
|
||||
|
||||
return true;
|
||||
@Override
|
||||
public PqDashboardPageVO queryByPagePath(String pagePath) {
|
||||
LambdaQueryWrapper<PqDashboardPage> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(PqDashboardPage::getPagePath,pagePath);
|
||||
PqDashboardPage result = this.getOne(queryWrapper);
|
||||
if (Objects.isNull(result)) {
|
||||
return null;
|
||||
}
|
||||
PqDashboardPageVO vo = new PqDashboardPageVO();
|
||||
BeanUtils.copyProperties(result,vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PqDashboardPage> getDashboardPageByUserId(String id,boolean state) {
|
||||
List<String> userList = new ArrayList<>();
|
||||
userList.add(id);
|
||||
userList.add(HomePageState.DEFAULT_USER_ID);
|
||||
if (state) {
|
||||
return this.lambdaQuery().in(PqDashboardPage::getUserId,userList).eq(PqDashboardPage::getState,1).orderByAsc(PqDashboardPage::getSort).list();
|
||||
} else {
|
||||
return this.lambdaQuery().in(PqDashboardPage::getUserId,userList).orderByAsc(PqDashboardPage::getSort).list();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.system.timer.tasks.cld;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.csdevice.api.IcdFeignClient;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.system.timer.TimerTaskRunner;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class BzEventFileTaskRunner implements TimerTaskRunner {
|
||||
|
||||
private final IcdFeignClient icdFeignClient;
|
||||
|
||||
@Override
|
||||
public void action(String date) {
|
||||
if(StrUtil.isBlank(date)){
|
||||
date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
|
||||
}
|
||||
IcdBzParam param = new IcdBzParam();
|
||||
param.setStartTime(date);
|
||||
param.setEndTime(date);
|
||||
icdFeignClient.bzFile(param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.system.timer.tasks.cld;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.csdevice.api.IcdFeignClient;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.system.timer.TimerTaskRunner;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class BzEventTaskRunner implements TimerTaskRunner {
|
||||
|
||||
private final IcdFeignClient icdFeignClient;
|
||||
|
||||
@Override
|
||||
public void action(String date) {
|
||||
if(StrUtil.isBlank(date)){
|
||||
date = DateUtil.yesterday().toString(DatePattern.NORM_DATE_PATTERN);
|
||||
}
|
||||
IcdBzParam param = new IcdBzParam();
|
||||
param.setStartTime(date);
|
||||
param.setEndTime(date);
|
||||
icdFeignClient.bzEvent(param);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user