巡检点bug修复

This commit is contained in:
guo 2023-08-17 18:10:07 +08:00
parent b166849d3f
commit 59fbf776cd
27 changed files with 365 additions and 166 deletions

View File

@ -45,6 +45,11 @@ public class ExceptionHandlerAdvice {
result.setCode(403);
result.setMessage(appException.getMessage());
result.setSuccess(false);
} else if (ex instanceof PromptException) {
PromptException appException = (PromptException) ex;
result.setCode(200);
result.setMessage(appException.getMessage());
result.setResult(appException.getResult());
} else {
result.error500(ex.getMessage() == null ? "操作中出现空指针!" : ex.getMessage());
ex.printStackTrace();

View File

@ -0,0 +1,38 @@
package com.zhgd.exception;
import lombok.Data;
import org.springframework.http.HttpStatus;
/**
* 提示异常
*/
public class PromptException extends RuntimeException {
private static final long serialVersionUID = 1L;
private final String message;
private Object result;
public PromptException(String message) {
this.message = message;
}
public PromptException(String message, Object result) {
this.message = message;
this.result = result;
}
@Override
public String getMessage() {
return message;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
}

View File

@ -520,7 +520,7 @@ public class RedisRepository {
* @return 需要的对象
*/
public <Y> Y getOrSet(String key, Supplier<Y> supplier) {
return getOrSet(key, supplier, null);
return getOrSet(key, supplier, 12 * 60 * 60L);
}
/**

View File

@ -0,0 +1,31 @@
package com.zhgd.xmgl.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 请求对象
*/
@Data
public class BaseRequest extends PageQO {
/*
<if test="dto.queryStartTime != null">
and cpi.update_date >= #{dto.queryStartTime}
</if>
<if test="dto.queryEndTime != null">
and cpi.update_date <![CDATA[<=]]> concat(#{dto.queryEndTime},' 23:59:59')
</if>
*/
@ApiModelProperty(value = "查询开始时间格式2023-05-22")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date queryStartTime;
@ApiModelProperty(value = "查询结束时间格式2023-05-22")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date queryEndTime;
}

View File

@ -1,4 +1,4 @@
package com.zhgd.xmgl.modules.foundation.entity.qo;
package com.zhgd.xmgl.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

View File

@ -1,25 +1,15 @@
package com.zhgd.xmgl.modules.basicdata.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.basicdata.entity.SystemLogoConfig;
import com.zhgd.xmgl.modules.basicdata.service.ISystemLogoConfigService;
import com.zhgd.xmgl.util.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Title: Controller
@ -35,8 +25,6 @@ import java.util.List;
public class SystemLogoConfigController {
@Autowired
private ISystemLogoConfigService systemLogoConfigService;
@Value("${spring.file-storage.default-platform}")
private String fileStorageType;
/**
@ -45,47 +33,22 @@ public class SystemLogoConfigController {
* @param systemLogoConfig
* @return
*/
@CacheEvict(value = "logoConfigCache", allEntries = true)
@ApiOperation(value = " 编辑系统logo配置信息", notes = "编辑系统logo配置信息", httpMethod = "POST")
@PostMapping(value = "/editSystemLogoConfig")
public Result<SystemLogoConfig> editSystemLogoConfig(@RequestBody SystemLogoConfig systemLogoConfig) {
Result<SystemLogoConfig> result = new Result<SystemLogoConfig>();
try {
systemLogoConfigService.editSystemLogoConfig(systemLogoConfig);
result.successMsg(MessageUtil.get("optSucess"));
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
result.error500(MessageUtil.get("failErr"));
}
systemLogoConfigService.editSystemLogoConfig(systemLogoConfig);
return result;
}
/**
* 通过id查询
*
* @param
* @return
*/
@Cacheable(value = "logoConfigCache")
@ApiOperation(value = "查询系统logo配置信息", notes = "查询系统logo配置信息", httpMethod = "GET")
@GetMapping(value = "/selectSystemLogoConfig")
public Result<JSONObject> selectSystemLogoConfig() {
Result<JSONObject> result = new Result<JSONObject>();
List<SystemLogoConfig> list = systemLogoConfigService.list(Wrappers.<SystemLogoConfig>query().last("limit 1"));
if (CollUtil.isNotEmpty(list)) {
JSONObject object = JSONUtil.parseObj(list.get(0));
if ("local".equals(fileStorageType)) {
object.put("fileStorageType", "0");
} else {
object.put("fileStorageType", "1");
}
result.setResult(object);
}
public Result<SystemLogoConfig> selectSystemLogoConfig(SystemLogoConfig systemLogoConfig) {
Result<SystemLogoConfig> result = new Result<>();
result.setResult(systemLogoConfigService.selectSystemLogoConfig(systemLogoConfig));
result.setSuccess(true);
return result;
}
}

View File

@ -1,77 +1,93 @@
package com.zhgd.xmgl.modules.basicdata.entity;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description: 系统logo配置
* @author pds
* @date 2021-03-10
* @date 2021-03-10
* @version V1.0
*/
@Data
@TableName("system_logo_config")
@ApiModel(value="SystemLogoConfig实体类",description="SystemLogoConfig")
@ApiModel(value = "SystemLogoConfig实体类", description = "SystemLogoConfig")
public class SystemLogoConfig implements Serializable {
private static final long serialVersionUID = 1L;
/**id*/
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="id")
private java.lang.Long id ;
/**登录logo*/
@Excel(name = "登录logo", width = 15)
@ApiModelProperty(value="登录logo")
private java.lang.String loginLogo ;
/**登录背景图*/
@Excel(name = "登录背景图", width = 15)
@ApiModelProperty(value="登录背景图")
private java.lang.String loginBackgroundImage ;
/**平台名称*/
@Excel(name = "平台名称", width = 15)
@ApiModelProperty(value="平台名称")
private java.lang.String platformName ;
/**平台logo*/
@Excel(name = "平台logo", width = 15)
@ApiModelProperty(value="平台logo")
private java.lang.String platformLogo ;
@ApiModelProperty(value = "id")
private java.lang.Long id;
/**
* 登录logo
*/
@Excel(name = "登录logo", width = 15)
@ApiModelProperty(value = "登录logo")
private java.lang.String loginLogo;
/**
* 登录背景图
*/
@Excel(name = "登录背景图", width = 15)
@ApiModelProperty(value = "登录背景图")
private java.lang.String loginBackgroundImage;
/**
* 平台名称
*/
@Excel(name = "平台名称", width = 15)
@ApiModelProperty(value = "平台名称")
private java.lang.String platformName;
/**
* 平台logo
*/
@Excel(name = "平台logo", width = 15)
@ApiModelProperty(value = "平台logo")
private java.lang.String platformLogo;
@Excel(name = "是否开启缩放0缩放1不缩放", width = 15)
@ApiModelProperty(value="是否开启缩放0缩放1不缩放")
private java.lang.String zoomType ;
@ApiModelProperty(value = "是否开启缩放0缩放1不缩放")
private java.lang.String zoomType;
@ApiModelProperty(value="模块图标类型1原图片2图片2")
private java.lang.String iconType ;
@ApiModelProperty(value = "模块图标类型1原图片2图片2")
private java.lang.String iconType;
@ApiModelProperty(value="区域类型1省份2城市")
private java.lang.String areaType ;
@ApiModelProperty(value = "区域类型1省份2城市")
private java.lang.String areaType;
@ApiModelProperty(value="数据看板logo")
private java.lang.String bigScreenLogo ;
@ApiModelProperty(value = "数据看板logo")
private java.lang.String bigScreenLogo;
@ApiModelProperty(value="标头配置")
private java.lang.String headerConfiguration ;
@ApiModelProperty(value = "标头配置")
private java.lang.String headerConfiguration;
@ApiModelProperty(value="项目后台")
@ApiModelProperty(value = "项目后台")
private java.lang.String projectBackground;
@ApiModelProperty(value="企业前台")
@ApiModelProperty(value = "企业前台")
private java.lang.String enterpriseFront;
@ApiModelProperty(value="企业后台")
@ApiModelProperty(value = "企业后台")
private java.lang.String enterpriseBackground;
@ApiModelProperty(value="设备中心")
@ApiModelProperty(value = "设备中心")
private java.lang.String equipmentChina;
@ApiModelProperty(value="资料中心")
@ApiModelProperty(value = "资料中心")
private java.lang.String dataCenter;
@ApiModelProperty(value = "总公司sn")
private java.lang.String headquartersSn;
@TableField(exist = false)
private java.lang.String fileStorageType;
}

View File

@ -6,10 +6,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 系统logo配置
* @author pds
* @date 2021-03-10
* @date 2021-03-10
* @version V1.0
*/
public interface ISystemLogoConfigService extends IService<SystemLogoConfig> {
void editSystemLogoConfig(SystemLogoConfig systemLogoConfig);
SystemLogoConfig selectSystemLogoConfig(SystemLogoConfig systemLogoConfig);
}

View File

@ -1,21 +1,25 @@
package com.zhgd.xmgl.modules.basicdata.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.redis.lock.RedisRepository;
import com.zhgd.xmgl.modules.basicdata.entity.SystemLogoConfig;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
import com.zhgd.xmgl.modules.basicdata.service.ISystemLogoConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @Description: 系统logo配置
* @author pds
* @date 2021-03-10
* @date 2021-03-10
* @version V1.0
*/
@Service
@ -23,16 +27,47 @@ import java.util.List;
public class SystemLogoConfigServiceImpl extends ServiceImpl<SystemLogoConfigMapper, SystemLogoConfig> implements ISystemLogoConfigService {
@Autowired
private SystemLogoConfigMapper systemLogoConfigMapper;
@Value("${spring.file-storage.default-platform}")
private String fileStorageType;
@Resource
RedisRepository redisRepository;
private static final String SYSTEM_LOGO_CONFIG_KEY_PREFIX = "systemLogoConfig:";
@Override
public void editSystemLogoConfig(SystemLogoConfig systemLogoConfig) {
QueryWrapper<SystemLogoConfig> queryWrapper=new QueryWrapper<>();
List<SystemLogoConfig> list=systemLogoConfigMapper.selectList(queryWrapper);
if(list!=null&&list.size()>0){
systemLogoConfig.setId(list.get(0).getId());
QueryWrapper<SystemLogoConfig> queryWrapper = new QueryWrapper<>();
String headquartersSn = systemLogoConfig.getHeadquartersSn();
String val = StrUtil.isNotBlank(headquartersSn) ? headquartersSn : "-1";
queryWrapper.lambda().eq(SystemLogoConfig::getHeadquartersSn, val);
SystemLogoConfig logoConfig = systemLogoConfigMapper.selectOne(queryWrapper);
if (logoConfig != null) {
systemLogoConfigMapper.updateById(systemLogoConfig);
}else{
} else {
systemLogoConfigMapper.insert(systemLogoConfig);
}
redisRepository.del(SYSTEM_LOGO_CONFIG_KEY_PREFIX + val);
}
@Override
public SystemLogoConfig selectSystemLogoConfig(SystemLogoConfig systemLogoConfig) {
if (StrUtil.isBlank(systemLogoConfig.getHeadquartersSn())) {
systemLogoConfig.setHeadquartersSn("-1");
}
return redisRepository.getOrSet(SYSTEM_LOGO_CONFIG_KEY_PREFIX + systemLogoConfig.getHeadquartersSn(), () -> {
String headquartersSn = systemLogoConfig.getHeadquartersSn();
SystemLogoConfig slc;
//查询该企业的
slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, headquartersSn));
if (slc == null) {
//查询默认
slc = systemLogoConfigMapper.selectOne(new LambdaQueryWrapper<SystemLogoConfig>().eq(SystemLogoConfig::getHeadquartersSn, "-1"));
}
if ("local".equals(fileStorageType)) {
slc.setFileStorageType("0");
} else {
slc.setFileStorageType("1");
}
return slc;
});
}
}

View File

@ -9,11 +9,10 @@
WHERE t3.type=1 AND t2.is_enable=1 AND t3.dev_sn=#{devSn}
</select>
<select id="selectLifterVideoList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT t1.*,t2.*,t3.id big_device_video_id,t3.dev_sn
SELECT t1.item_id as id,t1.*,t2.*,t3.id big_device_video_id,t3.dev_sn
FROM video_item t1 INNER JOIN project_video_config t2 ON t2.id=t1.video_id
INNER JOIN big_device_video t3 ON t1.item_id=t3.video_item_id
INNER JOIN big_device_video t3 ON t1.item_id=t3.video_item_id
WHERE t2.is_enable=1 AND t3.dev_sn=#{devSn} and t3.type=2
</select>
<select id="selectStandardDevVideoList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT t1.*,t2.*,t3.id big_device_video_id,t3.dev_sn

View File

@ -75,11 +75,29 @@ public class CheckingPointController {
return result;
}
@ApiOperation(value = "更新巡检点", notes = "更新巡检点")
@PostMapping(value = "/edit")
public Result<CheckingPoint> edit(@RequestBody CheckingPoint checkingPoint) {
// 生成指定url对应的二维码到文件宽和高都是300像素
String url = UUID.randomUUID() + ".jpg";
String path = basePath + url;
log.info(path);
checkingPoint.setQrCode(url);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(checkingPoint));
jsonObject.put("checkingPointId", checkingPoint.getId());
jsonObject.remove("id");
QrCodeUtil.generate(JSON.toJSONString(jsonObject), 300, 300, FileUtil.file(path));
checkingPointService.updateById(checkingPoint);
return Result.ok();
}
@ApiOperation(value = "分页查询巡检点列表", notes = "分页查询巡检点列表")
@PostMapping(value = "/selectPage")
public Result<IPage<CheckingPoint>> selectCheckingPointPage(@RequestBody ProjectSnQO projectSnQO) {
Result<IPage<CheckingPoint>> result = new Result<>();
result.setResult(checkingPointService.selectCheckingPointPage(projectSnQO.getProjectSn(), projectSnQO.getPageNo(), projectSnQO.getPageSize()));
result.setResult(checkingPointService.selectCheckingPointPage(projectSnQO));
result.setSuccess(true);
return result;
}
@ -114,4 +132,4 @@ public class CheckingPointController {
public Result<Boolean> checkLocation(Long id, Long userId, Double longitude, Double latitude) {
return Result.success(checkingPointService.checkLocation(id,userId, longitude, latitude));
}
}
}

View File

@ -1,5 +1,7 @@
package com.zhgd.xmgl.modules.checking.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.checking.controller.dto.CheckingPointInfoPageDto;
@ -14,7 +16,10 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
@ -86,4 +91,15 @@ public class CheckingPointInfoController {
result.setSuccess(true);
return result;
}
@ApiOperation(value = "删除巡检点记录", notes = "删除巡检点记录", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "巡检点记录ID", paramType = "query", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<CheckingPointInfo> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
checkingPointInfoService.removeById(id);
return Result.ok();
}
}

View File

@ -1,7 +1,12 @@
package com.zhgd.xmgl.modules.checking.controller.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
public class CheckingPointInfoPageDto {
@ -10,4 +15,14 @@ public class CheckingPointInfoPageDto {
String queryStr;
Integer pageNo = 1;
Integer pageSize = 10;
@ApiModelProperty(value = "查询开始时间格式2023-05-22")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date queryStartTime;
@ApiModelProperty(value = "查询结束时间格式2023-05-22")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date queryEndTime;
@ApiModelProperty("巡检点状态 1正常 2异常 需要默认选择正常")
private Integer status;
}

View File

@ -145,6 +145,8 @@ public class CheckingPoint implements Serializable {
@ApiModelProperty("模板")
@TableField(value = "template")
private String template;
@ApiModelProperty("区域")
private String addr;
/**
* 创建时间

View File

@ -127,6 +127,18 @@ public class CheckingPointInfo implements Serializable {
@ApiModelProperty(value = "操作时间")
private java.util.Date operateTime;
/**
* 异常图片URL
*/
@ApiModelProperty(value = "异常图片URL")
private String alarmImage;
/**
* 报警详情
*/
@ApiModelProperty(value = "报警详情")
private String alarmDetails;
/**
* 巡检点名称
*/
@ -148,19 +160,6 @@ public class CheckingPointInfo implements Serializable {
@TableField(exist = false)
private String checkingPointUserName;
/**
* 报警详情
*/
@TableField(exist = false)
@ApiModelProperty(value = "报警详情")
private String alarmDetails;
/**
* 异常图片URL
*/
@TableField(exist = false)
@ApiModelProperty(value = "异常图片URL")
private String alarmImage;
@ApiModelProperty("通知人名称")
@TableField(exist = false)

View File

@ -1,6 +1,6 @@
package com.zhgd.xmgl.modules.checking.entity.qo;
import com.zhgd.xmgl.modules.foundation.entity.qo.PageQO;
import com.zhgd.xmgl.entity.PageQO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -18,4 +18,6 @@ import lombok.EqualsAndHashCode;
public class ProjectSnQO extends PageQO {
@ApiModelProperty("项目sn")
private String projectSn;
@ApiModelProperty("巡检点名称")
private String checkingPointName;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.qo.ProjectSnQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -17,7 +18,7 @@ import java.util.List;
*/
@Mapper
public interface CheckingPointMapper extends BaseMapper<CheckingPoint> {
IPage<CheckingPoint> selectCheckingPointPage(@Param("projectSn") String projectSn, Page<?> objectPage);
IPage<CheckingPoint> selectCheckingPointPage(@Param("qo") ProjectSnQO projectSnQO, Page<?> objectPage);
List<CheckingPoint> getStartingListByFrequencyType(int type);
@ -27,4 +28,4 @@ public interface CheckingPointMapper extends BaseMapper<CheckingPoint> {
* @return
*/
List<CheckingPoint> getFinishList();
}
}

View File

@ -6,11 +6,12 @@
cp.checking_point_name checkingPointName,
cp.position,
su.real_name checkingPointUserName,
group_concat(nu.real_name) noticeUserNames
(SELECT group_concat(nu.real_name)
FROM system_user nu
WHERE find_in_set(nu.user_id, cp.notice_user_ids)) noticeUserNames
from checking_point_info cpi
inner join checking_point cp on cpi.checking_point_id = cp.id
inner join system_user su on cpi.checking_point_user_id = su.user_id
left join system_user nu on find_in_set(nu.user_id, cp.notice_user_ids)
where cp.project_sn = #{dto.projectSn}
<if test="dto.queryStr != null and dto.queryStr != ''">
and (cp.checking_point_name like concat('%', #{dto.queryStr}, '%')
@ -18,6 +19,15 @@
or su.real_name like concat('%', #{dto.queryStr}, '%')
or cpi.create_date like concat('%', #{dto.queryStr}, '%'))
</if>
<if test="dto.status != null">
and cpi.status = #{dto.status}
</if>
<if test="dto.queryStartTime != null">
and cpi.update_date >= #{dto.queryStartTime}
</if>
<if test="dto.queryEndTime != null">
and cpi.update_date <![CDATA[<=]]> concat(#{dto.queryEndTime},' 23:59:59')
</if>
group by cpi.id
order by cpi.create_date desc
</select>

View File

@ -4,15 +4,18 @@
<select id="selectCheckingPointPage" resultType="com.zhgd.xmgl.modules.checking.entity.CheckingPoint">
select cp.*,
su.real_name createUserName,
group_concat(iu.real_name) inspectUserNames,
group_concat(nu.real_name) noticeUserNames
(SELECT group_concat( iu.real_name ) FROM system_user iu WHERE find_in_set( iu.user_id, cp.inspect_user_ids ))
inspectUserNames,
(SELECT group_concat( nu.real_name ) FROM system_user nu WHERE find_in_set( nu.user_id, cp.notice_user_ids ) )
noticeUserNames
from checking_point cp
inner join system_user su on cp.create_user_id = su.user_id
left join system_user iu on find_in_set(iu.user_id, cp.inspect_user_ids)
left join system_user nu on find_in_set(nu.user_id, cp.notice_user_ids)
<where>
<if test="projectSn != null and projectSn != ''">
and cp.project_sn = #{projectSn}
<if test="qo.projectSn != null and qo.projectSn != ''">
and cp.project_sn = #{qo.projectSn}
</if>
<if test="qo.checkingPointName != null and qo.checkingPointName != ''">
and cp.checking_point_name like CONCAT(CONCAT('%', #{qo.checkingPointName}), '%')
</if>
</where>
group by cp.id

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.checking.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.qo.ProjectSnQO;
/**
* @author 邱平毅
@ -11,7 +12,7 @@ import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
* @Version 1.0
*/
public interface CheckingPointService extends IService<CheckingPoint> {
IPage<CheckingPoint> selectCheckingPointPage(String projectSn, Integer pageNo, Integer pageSize);
IPage<CheckingPoint> selectCheckingPointPage(ProjectSnQO projectSnQO);
/**
* @param id 巡检点id

View File

@ -4,7 +4,9 @@ import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.exception.PromptException;
import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.qo.ProjectSnQO;
import com.zhgd.xmgl.modules.checking.mapper.CheckingPointMapper;
import com.zhgd.xmgl.modules.checking.service.CheckingPointService;
import com.zhgd.xmgl.util.RegionUtil;
@ -23,8 +25,8 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
CheckingPointMapper checkingPointMapper;
@Override
public IPage<CheckingPoint> selectCheckingPointPage(String projectSn, Integer pageNo, Integer pageSize) {
return checkingPointMapper.selectCheckingPointPage(projectSn, new Page<>(pageNo, pageSize));
public IPage<CheckingPoint> selectCheckingPointPage(ProjectSnQO projectSnQO) {
return checkingPointMapper.selectCheckingPointPage(projectSnQO, new Page<>(projectSnQO.getPageNo(), projectSnQO.getPageSize()));
}
@Override
@ -33,9 +35,13 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
// 判断用户是否存在于检查人员id列表
boolean userFlag = CharSequenceUtil.split(checkingPoint.getInspectUserIds(), ",").contains(String.valueOf(userId));
if (!userFlag) {
throw new IllegalArgumentException("当前用户不具备巡检权限!");
throw new PromptException("当前用户不具备巡检权限!", false);
}
// 范围判定
return RegionUtil.isInCircle(checkingPoint.getLongitude(), checkingPoint.getLatitude(), longitude, latitude, checkingPoint.getStandArea());
boolean inCircle = RegionUtil.isInCircle(checkingPoint.getLongitude(), checkingPoint.getLatitude(), longitude, latitude, checkingPoint.getStandArea());
if (!inCircle) {
throw new PromptException("当前用户不在自定义范围区域内!", false);
}
return true;
}
}

View File

@ -83,10 +83,6 @@ public class ElectricalDev implements Serializable {
@ApiModelProperty(value = "地图Y坐标")
private java.lang.String mapY;
@TableField(exist = false)
@ApiModelProperty(value = "是否在线 1为离线 2为在线 ")
private java.lang.Integer isClosed;
/**
* 锁编号
*/
@ -134,4 +130,9 @@ public class ElectricalDev implements Serializable {
@Excel(name = "设备密钥", width = 15)
@ApiModelProperty(value = "设备密钥")
private java.lang.String devScret;
@TableField(exist = false)
@ApiModelProperty(value = "是否在线 1为离线 2为在线 ")
private java.lang.Integer isClosed;
}

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.foundation.entity.qo;
import com.zhgd.xmgl.entity.PageQO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.foundation.entity.qo;
import com.zhgd.xmgl.entity.PageQO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.worker.controller;
import cn.xuyanwu.spring.file.storage.FileInfo;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.zhgd.xmgl.base.CompanyVo;
import com.zhgd.xmgl.base.UfaceDevVo;
import com.zhgd.xmgl.base.UploadImageVo;
@ -92,39 +93,66 @@ public class ProjectWorkerApiController {
@ApiOperation(value = "保存人脸设备", notes = "保存人脸设备")
@PostMapping(value = "/uploadPassDev")
public Map<String, Object> uploadPassDev(@RequestBody UfaceDevVo ufaceDevVo) {
log.info("uploadPassDev{}",JSON.toJSONString(ufaceDevVo));
log.info("uploadPassDev{}", JSON.toJSONString(ufaceDevVo));
Map<String, Object> resultMap = new HashMap<>();
if (StringUtils.isEmpty(ufaceDevVo.getDevName()) || StringUtils.isEmpty(ufaceDevVo.getDevCode()) ||
StringUtils.isEmpty(ufaceDevVo.getProjectCode()) || ufaceDevVo.getDirection() == null) {
String devCode = ufaceDevVo.getDevCode();
String projectCode = ufaceDevVo.getProjectCode();
if (StringUtils.isEmpty(ufaceDevVo.getDevName()) || StringUtils.isEmpty(devCode) ||
StringUtils.isEmpty(projectCode) || ufaceDevVo.getDirection() == null) {
resultMap.put("msg", "缺少必填字段");
resultMap.put("status", "0");
return resultMap;
}
QueryWrapper<UfaceDev> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(UfaceDev::getDevSn, ufaceDevVo.getDevCode())
.eq(UfaceDev::getProjectSn, ufaceDevVo.getProjectCode());
queryWrapper.lambda().eq(UfaceDev::getDevSn, devCode)
.eq(UfaceDev::getProjectSn, projectCode);
int count = ufaceDevService.count(queryWrapper);
if (count == 0) {
UfaceDev ufaceDev = new UfaceDev();
ufaceDev.setDevSn(ufaceDevVo.getDevCode());
ufaceDev.setProjectSn(ufaceDevVo.getProjectCode());
ufaceDev.setDevName(ufaceDevVo.getDevName());
ufaceDev.setDevIp(ufaceDevVo.getDevIp());
ufaceDev.setDevPort(ufaceDevVo.getDevPort());
if (ufaceDevVo.getDirection() == 1) {
ufaceDev.setIsEnter(1);
ufaceDev.setEnterTime("");
ufaceDev.setIsOut(0);
ufaceDev.setOutTime("");
} else {
ufaceDev.setIsEnter(0);
ufaceDev.setEnterTime("");
ufaceDev.setIsOut(1);
ufaceDev.setOutTime("");
}
ufaceDevService.save(ufaceDev);
UfaceDev ufaceDev = new UfaceDev();
ufaceDev.setDevSn(devCode);
ufaceDev.setProjectSn(projectCode);
ufaceDev.setDevName(ufaceDevVo.getDevName());
ufaceDev.setDevIp(ufaceDevVo.getDevIp());
ufaceDev.setDevPort(ufaceDevVo.getDevPort());
if (ufaceDevVo.getDirection() == 1) {
ufaceDev.setIsEnter(1);
ufaceDev.setEnterTime("");
ufaceDev.setIsOut(0);
ufaceDev.setOutTime("");
} else {
ufaceDev.setIsEnter(0);
ufaceDev.setEnterTime("");
ufaceDev.setIsOut(1);
ufaceDev.setOutTime("");
}
if (count == 0) {
ufaceDevService.save(ufaceDev);
} else {
ufaceDevService.update(ufaceDev, new LambdaUpdateWrapper<UfaceDev>().eq(UfaceDev::getDevSn, devCode).eq(UfaceDev::getProjectSn, projectCode));
}
resultMap.put("msg", "操作成功");
resultMap.put("status", "1");
return resultMap;
}
@ApiOperation(value = "发送人脸设备心跳超过30分钟设备离线", notes = "发送人脸设备心跳超过30分钟设备离线")
@PostMapping(value = "/sendHeartbeat")
public Map<String, Object> sendHeartbeat(@RequestBody UfaceDevVo ufaceDevVo) {
log.info("sendHeartbeat{}", JSON.toJSONString(ufaceDevVo));
Map<String, Object> resultMap = new HashMap<>();
String devCode = ufaceDevVo.getDevCode();
String projectCode = ufaceDevVo.getProjectCode();
if (StringUtils.isEmpty(devCode) || StringUtils.isEmpty(projectCode)) {
resultMap.put("msg", "缺少必填字段");
resultMap.put("status", "0");
return resultMap;
}
UfaceDev ufaceDev = new UfaceDev();
ufaceDev.setDevSn(devCode);
ufaceDev.setProjectSn(projectCode);
ufaceDev.setHeartBeatTime(new Date());
ufaceDevService.update(new LambdaUpdateWrapper<UfaceDev>().eq(UfaceDev::getDevSn, devCode).eq(UfaceDev::getProjectSn, projectCode)
.set(UfaceDev::getHeartBeatTime, new Date()));
resultMap.put("msg", "操作成功");
resultMap.put("status", "1");
return resultMap;
@ -272,7 +300,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/delWorker")
public Map<String, Object> delWorker(@RequestBody Map<String, Object> map) {
log.info("delWorker{}",JSON.toJSONString(map));
log.info("delWorker{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {
@ -333,7 +361,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/passRecord")
public Map<String, Object> passRecord(@RequestBody Map<String, Object> map) {
log.info("passRecord{}",JSON.toJSONString(map));
log.info("passRecord{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {
@ -411,7 +439,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/addRealName")
public Map<String, Object> addRealName(@RequestBody Map<String, Object> map) {
log.info("addRealName{}",JSON.toJSONString(map));
log.info("addRealName{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {
@ -498,7 +526,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/modGroup")
public Map<String, Object> modGroup(@RequestBody @Validated ModGroupDto dto) {
log.info("modGroup{}",JSON.toJSONString(dto));
log.info("modGroup{}", JSON.toJSONString(dto));
return teamInfoService.modGroup(dto);
}
@ -510,7 +538,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/delGroup")
public Map<String, Object> delGroup(@RequestBody Map<String, Object> map) {
log.info("delGroup{}",JSON.toJSONString(map));
log.info("delGroup{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {
teamInfoService.delGroup(map);
@ -555,7 +583,7 @@ public class ProjectWorkerApiController {
@ApiOperation(value = "变更劳务公司", notes = "变更劳务公司", httpMethod = "POST")
@PostMapping(value = "/modCompany")
public Map<String, Object> modCompany(@RequestBody CompanyVo companyVo) {
log.info("modCompany{}",JSON.toJSONString(companyVo));
log.info("modCompany{}", JSON.toJSONString(companyVo));
Map<String, Object> resultMap = new HashMap<>();
try {
resultMap = enterpriseInfoService.modCompany(companyVo);
@ -573,7 +601,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/delCompany")
public Map<String, Object> delCompany(@RequestBody Map<String, Object> map) {
log.info("delCompany{}",JSON.toJSONString(map));
log.info("delCompany{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {
enterpriseInfoService.delCompany(map);
@ -596,7 +624,7 @@ public class ProjectWorkerApiController {
})
@PostMapping(value = "/bindCompany")
public Map<String, Object> bindCompany(@RequestBody Map<String, Object> map) {
log.info("bindCompany{}",JSON.toJSONString(map));
log.info("bindCompany{}", JSON.toJSONString(map));
Map<String, Object> resultMap = new HashMap<>();
try {

View File

@ -237,6 +237,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/xmgl/electricalData/add").permitAll()
.antMatchers("/xmgl/upload/getRenameFile").permitAll()
.antMatchers("/xmgl/poisonousGasDevCurrentData/add").permitAll()
.antMatchers("/xmgl/concreteMonitorAlarm/add").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.anyRequest().authenticated() // 剩下所有的验证都需要验证
.and()

View File

@ -107,4 +107,9 @@ public class RegionUtil {
return true;
}
}
public static void main(String[] args) {
//22.673095871193226, 113.81110145767245
System.out.println(isInCircle(113.80851580839209, 22.67406603863524, 113.81110145767245, 22.673095871193226, 300));
}
}