@@ -2,6 +2,11 @@ package com.tuoheng.admin.config; | |||
public interface SystemConstant { | |||
/** | |||
* 平台code | |||
*/ | |||
String PLATFORM_CODE = "treefarm"; | |||
/** | |||
* 机场平台:获取机场列表接口 | |||
*/ |
@@ -1,69 +1,69 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 摄像头对象 th_camera | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_camera") | |||
public class Camera extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 摄像头名称 | |||
*/ | |||
private String cameraName; | |||
/** | |||
* 设备类型 1枪机 2球机 | |||
*/ | |||
private Integer cameraType; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* flv地址 | |||
*/ | |||
private String flvUrl; | |||
/** | |||
* 备注 | |||
*/ | |||
private String remark; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 摄像头对象 th_camera | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_camera") | |||
public class Camera extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 摄像头名称 | |||
*/ | |||
private String cameraName; | |||
/** | |||
* 设备类型 1枪机 2球机 | |||
*/ | |||
private Integer cameraType; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* flv地址 | |||
*/ | |||
private String flvUrl; | |||
/** | |||
* 备注 | |||
*/ | |||
private String remark; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -1,60 +1,60 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 物资对象 th_goods | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_goods") | |||
public class Goods extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库ID | |||
*/ | |||
private Integer warehouseId; | |||
/** | |||
* 物资名称 | |||
*/ | |||
private String goodsName; | |||
/** | |||
* 物资类型 1个人防护装备 2搜救装备 3医疗及防疫设备及常用应急药品 4应急照明设备 5灭火处置设备 | |||
*/ | |||
private Integer goodsType; | |||
/** | |||
* 物资库存 | |||
*/ | |||
private String goodsStock; | |||
/** | |||
* 物资作用 | |||
*/ | |||
private String goodsAction; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 物资对象 th_goods | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_goods") | |||
public class Goods extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库ID | |||
*/ | |||
private Integer warehouseId; | |||
/** | |||
* 物资名称 | |||
*/ | |||
private String goodsName; | |||
/** | |||
* 物资类型 1个人防护装备 2搜救装备 3医疗及防疫设备及常用应急药品 4应急照明设备 5灭火处置设备 | |||
*/ | |||
private Integer goodsType; | |||
/** | |||
* 物资库存 | |||
*/ | |||
private String goodsStock; | |||
/** | |||
* 物资作用 | |||
*/ | |||
private String goodsAction; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -1,55 +1,55 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 仓库对象 th_warehouse | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warehouse") | |||
public class Warehouse extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库名称 | |||
*/ | |||
private String warehouseName; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 仓库对象 th_warehouse | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warehouse") | |||
public class Warehouse extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 仓库名称 | |||
*/ | |||
private String warehouseName; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 位置名称 | |||
*/ | |||
private String location; | |||
@TableField(exist = false) | |||
private String updateUserName; | |||
} |
@@ -1,70 +1,75 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 预警对象 th_warning | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning") | |||
public class Warning extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 火灾位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
} | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 预警对象 th_warning | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning") | |||
public class Warning extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 发现方式 1监控摄像 2无人机巡检 3人工巡检 | |||
*/ | |||
private Integer discoveryWay; | |||
/** | |||
* 火灾位置名称 | |||
*/ | |||
private String location; | |||
/** | |||
* 预警状态 1待确认 2确认 3忽略 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer checkUser; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date checkTime; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String checkResult; | |||
} |
@@ -1,47 +1,52 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import io.swagger.models.auth.In; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 预警记录对象 th_warning_record | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning_record") | |||
public class WarningRecord extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 预警ID | |||
*/ | |||
private Integer warningId; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
} | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import io.swagger.models.auth.In; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 预警记录对象 th_warning_record | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_warning_record") | |||
public class WarningRecord extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 预警ID | |||
*/ | |||
private Integer warningId; | |||
/** | |||
* 记录名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 应急任务ID | |||
*/ | |||
private Integer emergencyMissionId; | |||
} |
@@ -17,30 +17,18 @@ public class PointFlightRequest implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(value = "预警id") | |||
private Integer warningId; | |||
@ApiModelProperty(value = "巡检任务id") | |||
private Integer missionId; | |||
@ApiModelProperty(value = "机场id") | |||
private Integer airportId; | |||
@ApiModelProperty(value = "机场名称") | |||
private String airportName; | |||
@ApiModelProperty(value = "路线id") | |||
private Integer inspectionLine; | |||
@ApiModelProperty(value = "路线名称") | |||
private String inspectionLineName; | |||
@ApiModelProperty(value = "无人机ID") | |||
private Integer droneId; | |||
@ApiModelProperty(value = "无人机名称") | |||
private String droneName; | |||
@ApiModelProperty(value = "业务系统标识") | |||
private String code; | |||
@ApiModelProperty(value = "租户代码") | |||
private String tenantCode; | |||
@ApiModelProperty(value = "指点高度") | |||
private String alt; | |||
@@ -11,9 +11,9 @@ public enum QuestionTypeEnum { | |||
Q2("002001","病死树"), | |||
Q3("002003","人员活动"), | |||
Q3("002003","火焰"), | |||
Q4("002004","火灾隐患"); | |||
Q4("002004","烟雾"); | |||
QuestionTypeEnum(String code, String description){ | |||
this.code = code; |
@@ -1,121 +1,121 @@ | |||
package com.tuoheng.admin.service.camera; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
import com.tuoheng.admin.service.camera.query.QueryCameraListService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 摄像头Service业务层处理 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> implements ICameraService { | |||
@Autowired | |||
private QueryCameraListService queryCameraListService; | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @param request 摄像头 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryCameraListRequest request) { | |||
return queryCameraListService.getList(request); | |||
} | |||
/** | |||
* 查询摄像头 | |||
* | |||
* @param id 摄像头主键 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Camera entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getCameraName())) { | |||
throw new ServiceException("摄像头名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getCameraType())) { | |||
throw new ServiceException("设备类型不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLongitude())) { | |||
throw new ServiceException("经度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLatitude())) { | |||
throw new ServiceException("纬度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getFlvUrl())) { | |||
throw new ServiceException("摄像头地址不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){ | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getPage(QueryCameraListRequest request) { | |||
if (null == request.getPage() || null == request.getLimit()) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
// 获取分页数据 | |||
IPage<Camera> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<Camera> pageData = cameraMapper.selectPage(page, new LambdaQueryWrapper<Camera>() | |||
.eq(Camera::getMark, MarkTypeEnum.VALID.getCode()) | |||
.eq(Camera::getTenantId, ShiroUtils.getTenantId()) | |||
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName()) | |||
.orderByDesc(Camera::getCreateTime)); | |||
for (Camera record : pageData.getRecords()) { | |||
User user = userMapper.selectById(record.getUpdateUser()); | |||
if(ObjectUtil.isNotNull(user)){ | |||
record.setUpdateUserName(user.getRealname()); | |||
} | |||
} | |||
return JsonResult.success(pageData); | |||
} | |||
} | |||
package com.tuoheng.admin.service.camera; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Camera; | |||
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.CameraMapper; | |||
import com.tuoheng.admin.service.camera.query.QueryCameraListService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 摄像头Service业务层处理 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> implements ICameraService { | |||
@Autowired | |||
private QueryCameraListService queryCameraListService; | |||
@Autowired | |||
private CameraMapper cameraMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
/** | |||
* 查询摄像头列表 | |||
* | |||
* @param request 摄像头 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryCameraListRequest request) { | |||
return queryCameraListService.getList(request); | |||
} | |||
/** | |||
* 查询摄像头 | |||
* | |||
* @param id 摄像头主键 | |||
* @return 摄像头 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Camera entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getCameraName())) { | |||
throw new ServiceException("摄像头名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getCameraType())) { | |||
throw new ServiceException("设备类型不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLongitude())) { | |||
throw new ServiceException("经度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getLatitude())) { | |||
throw new ServiceException("纬度不能为空"); | |||
} | |||
if (StringUtils.isEmpty(entity.getFlvUrl())) { | |||
throw new ServiceException("摄像头地址不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){ | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult getPage(QueryCameraListRequest request) { | |||
if (null == request.getPage() || null == request.getLimit()) { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
// 获取分页数据 | |||
IPage<Camera> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<Camera> pageData = cameraMapper.selectPage(page, new LambdaQueryWrapper<Camera>() | |||
.eq(Camera::getMark, MarkTypeEnum.VALID.getCode()) | |||
.eq(Camera::getTenantId, ShiroUtils.getTenantId()) | |||
.like(StringUtils.isNotEmpty(request.getCameraName()), Camera::getCameraName, request.getCameraName()) | |||
.orderByDesc(Camera::getCreateTime)); | |||
for (Camera record : pageData.getRecords()) { | |||
User user = userMapper.selectById(record.getUpdateUser()); | |||
if(ObjectUtil.isNotNull(user)){ | |||
record.setUpdateUserName(user.getRealname()); | |||
} | |||
} | |||
return JsonResult.success(pageData); | |||
} | |||
} |
@@ -1,71 +1,71 @@ | |||
package com.tuoheng.admin.service.goods; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.admin.mapper.GoodsMapper; | |||
import com.tuoheng.admin.service.goods.query.QueryGoodsListByWarehouseIdService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 物资Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class GoodsServiceImpl extends BaseServiceImpl<GoodsMapper, Goods> implements IGoodsService { | |||
@Autowired | |||
private QueryGoodsListByWarehouseIdService queryGoodsListService; | |||
/** | |||
* 根据仓库Id查询物资列表 | |||
* | |||
* @param request 查询物资列表实体 | |||
* @return 摄像头集合 | |||
*/ | |||
@Override | |||
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) { | |||
return queryGoodsListService.getListByWarehouseId(request); | |||
} | |||
/** | |||
* 查询物资 | |||
* | |||
* @param id 物资主键 | |||
* @return 物资 | |||
*/ | |||
@Override | |||
public JsonResult getOnesById(String id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Goods entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getGoodsName())) { | |||
throw new ServiceException("物资名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getGoodsType())) { | |||
throw new ServiceException("物资类型不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} | |||
package com.tuoheng.admin.service.goods; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.tuoheng.admin.entity.domain.Goods; | |||
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest; | |||
import com.tuoheng.admin.mapper.GoodsMapper; | |||
import com.tuoheng.admin.service.goods.query.QueryGoodsListByWarehouseIdService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 物资Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class GoodsServiceImpl extends BaseServiceImpl<GoodsMapper, Goods> implements IGoodsService { | |||
@Autowired | |||
private QueryGoodsListByWarehouseIdService queryGoodsListService; | |||
/** | |||
* 根据仓库Id查询物资列表 | |||
* | |||
* @param request 查询物资列表实体 | |||
* @return 摄像头集合 | |||
*/ | |||
@Override | |||
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) { | |||
return queryGoodsListService.getListByWarehouseId(request); | |||
} | |||
/** | |||
* 查询物资 | |||
* | |||
* @param id 物资主键 | |||
* @return 物资 | |||
*/ | |||
@Override | |||
public JsonResult getOnesById(String id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Goods entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getGoodsName())) { | |||
throw new ServiceException("物资名称不能为空"); | |||
} | |||
if (ObjectUtil.isEmpty(entity.getGoodsType())) { | |||
throw new ServiceException("物资类型不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -402,7 +402,7 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
for (Question question : questionList) { | |||
Warning warning = new Warning(); | |||
//问题类型为火灾隐患时添加数据 | |||
if (question.getType().equals(QuestionTypeEnum.Q4.getCode())) { | |||
if (question.getType().equals(QuestionTypeEnum.Q4.getCode()) || question.getType().equals(QuestionTypeEnum.Q3.getCode())) { | |||
warning.setTenantId(question.getTenantId()); | |||
warning.setDiscoveryWay(DiscoveryWayEnum.UAV_PATROL.getCode()); | |||
warning.setLocation(""); |
@@ -2,15 +2,21 @@ package com.tuoheng.admin.service.third.airport; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.config.SystemConstant; | |||
import com.tuoheng.admin.entity.domain.Tenant; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.Warning; | |||
import com.tuoheng.admin.entity.domain.WarningRecord; | |||
import com.tuoheng.admin.entity.request.airport.PointFlightRequest; | |||
import com.tuoheng.admin.enums.AirportFlyTypeEnum; | |||
import com.tuoheng.admin.enums.InspectionTypeEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.enums.UpdateOrCreateEnum; | |||
import com.tuoheng.admin.mapper.TenantMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.WarningMapper; | |||
import com.tuoheng.admin.mapper.WarningRecordMapper; | |||
import com.tuoheng.admin.utils.CodeUtil; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
@@ -22,6 +28,7 @@ import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
@Slf4j | |||
@Service | |||
@@ -30,53 +37,167 @@ public class PointFlightService { | |||
@Autowired | |||
private TenantMapper tenantMapper; | |||
@Autowired | |||
private WarningMapper warningMapper; | |||
@Autowired | |||
private ThMissionMapper missionMapper; | |||
@Autowired | |||
private WarningRecordMapper warningRecordMapper; | |||
@Transactional | |||
public JsonResult executePointFligh(PointFlightRequest request) { | |||
log.info("进入调用机场平台,执行定点飞行"); | |||
// 读取不同租户的机场平台url | |||
JsonResult result = this.check(request); | |||
User user = ShiroUtils.getUserInfo(); | |||
Integer tenantId = user.getTenantId(); | |||
// 获取租户信息 | |||
Tenant tenant = this.getTenant(tenantId); | |||
// 创建应急任务 | |||
ThMission mission = this.createMission(user, request); | |||
// 调用机场平台 | |||
ThMission oldMission = (ThMission) result.getData(); | |||
if (oldMission.getAirportId().equals(request.getAirportId())) { | |||
log.info("原机场执行定点飞行"); | |||
// this.callOldAirpor(tenant, request); | |||
} else { | |||
log.info("新机场执行定点飞行"); | |||
// this.callNewAirpor(tenant, request, mission.getId()); | |||
} | |||
// 创建预警记录 | |||
this.createWarningRecord(user.getId(), tenantId, request, mission.getId()); | |||
log.info("调用机场平台方法: 执行定点飞行结束"); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
*/ | |||
private JsonResult check(PointFlightRequest request) { | |||
if (ObjectUtil.isNull(request.getWarningId())) { | |||
throw new ServiceException("预警ID为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getMissionId())) { | |||
throw new ServiceException("原巡检任务ID为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getAirportId())) { | |||
throw new ServiceException("机场ID为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getAirportName())) { | |||
throw new ServiceException("机场名称为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getAlt())) { | |||
throw new ServiceException("指点高度为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getLon())) { | |||
throw new ServiceException("经度为空"); | |||
} | |||
if (ObjectUtil.isNull(request.getLat())) { | |||
throw new ServiceException("纬度为空"); | |||
} | |||
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>() | |||
.eq(Warning::getId, request.getWarningId()) | |||
.eq(Warning::getMark, 1)); | |||
if (ObjectUtil.isNull(warning)) { | |||
throw new ServiceException("该预警信息不存在"); | |||
} | |||
ThMission mission = missionMapper.selectOne(new LambdaQueryWrapper<ThMission>() | |||
.eq(ThMission::getId, request.getMissionId()) | |||
.eq(ThMission::getMark, 1)); | |||
if (ObjectUtil.isNull(mission)) { | |||
throw new ServiceException("原巡检任务不存在"); | |||
} | |||
return JsonResult.success(mission); | |||
} | |||
/** | |||
* 获取租户信息 | |||
* | |||
* @param tenantId | |||
* @return | |||
*/ | |||
private Tenant getTenant(Integer tenantId) { | |||
Tenant tenant = tenantMapper.selectById(tenantId); | |||
if (ObjectUtil.isEmpty(tenant)) { | |||
log.info("调用机场平台,执行定点飞行: 租户不存在"); | |||
throw new ServiceException("租户不存在"); | |||
} | |||
// 读取不同租户的机场平台url | |||
if (StringUtils.isEmpty(tenant.getAirportUrl())) { | |||
log.info("调用机场平台,执行定点飞行: 机场平台URL为空"); | |||
throw new ServiceException("机场平台URL为空"); | |||
} | |||
return tenant; | |||
} | |||
// 创建应急任务 | |||
this.createMission(user, request); | |||
/** | |||
* 调用老机场平台 | |||
* | |||
* @param tenant | |||
* @param request | |||
*/ | |||
private void callOldAirpor(Tenant tenant, PointFlightRequest request) { | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_DRONE_CONTROL; | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("taskId", request.getMissionId()); | |||
jsonObject.put("airportId", request.getAirportId()); | |||
jsonObject.put("zalt", request.getAlt()); | |||
jsonObject.put("zlon", request.getLon()); | |||
jsonObject.put("zlat", request.getLat()); | |||
log.info("调用机场平台,原无人机执行定点飞行: url:{}", url); | |||
log.info("调用机场平台,原无人机执行定点飞行: jsonObject:{}", jsonObject); | |||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
log.info("原无人机执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject); | |||
throw new ServiceException("机场接口返回数据为空,飞行失败"); | |||
} | |||
} | |||
/** | |||
* 调用新机场平台 | |||
* | |||
* @param tenant | |||
* @param request | |||
*/ | |||
private void callNewAirpor(Tenant tenant, PointFlightRequest request, Integer emergencyMissionId) { | |||
String url = tenant.getAirportUrl() + SystemConstant.API_AIRPORT_POINT_FLIGH; | |||
JSONObject jsonObject = new JSONObject(); | |||
jsonObject.put("airportId", request.getAirportId()); | |||
jsonObject.put("requestId", request.getInspectionLine()); | |||
jsonObject.put("code", "gs"); // 与机场平台约定好的 | |||
jsonObject.put("requestId", emergencyMissionId); | |||
jsonObject.put("code", SystemConstant.PLATFORM_CODE); // 与机场平台约定好的 | |||
jsonObject.put("tenantCode", tenant.getCode()); | |||
jsonObject.put("alt", request.getAlt()); | |||
jsonObject.put("lon", request.getLon()); | |||
jsonObject.put("lat", request.getLat()); | |||
log.info("调用机场平台,执行定点飞行: url:{}", url); | |||
log.info("调用机场平台,执行定点飞行: jsonObject:{}", jsonObject); | |||
log.info("调用机场平台,新无人机执行定点飞行: url:{}", url); | |||
log.info("调用机场平台,新无人机执行定点飞行: jsonObject:{}", jsonObject); | |||
String airPortStr = HttpUtils.doSend(url, jsonObject, null, "POST"); | |||
if (StringUtils.isEmpty(airPortStr)) { | |||
log.info("执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject); | |||
return JsonResult.error(-1, "机场接口返回数据为空"); | |||
log.info("新无人机执行定点飞行:机场接口返回数据为空,飞行失败,jsonObject:{}", jsonObject); | |||
throw new ServiceException("机场接口返回数据为空,飞行失败"); | |||
} | |||
log.info("调用机场平台方法: 执行定点飞行结束"); | |||
return JsonResult.success(); | |||
} | |||
private void createMission(User user, PointFlightRequest request) { | |||
/** | |||
* 创建应急任务 | |||
* | |||
* @param user | |||
* @param request | |||
* @return | |||
*/ | |||
private ThMission createMission(User user, PointFlightRequest request) { | |||
ThMission mission = new ThMission(UpdateOrCreateEnum.CREATE.getCode()); | |||
String code = "XJRW" + CodeUtil.createCodeNo(); | |||
mission.setCode(code); | |||
@@ -85,10 +206,8 @@ public class PointFlightService { | |||
mission.setInspectionType(InspectionTypeEnum.AIRPORT.getCode()); | |||
mission.setAirportId(request.getAirportId()); | |||
mission.setAirportName(request.getAirportName()); | |||
mission.setInspectionLine(request.getInspectionLine()); | |||
mission.setInspectionLineName(request.getInspectionLineName()); | |||
mission.setDroneId(request.getDroneId()); | |||
mission.setDroneName(request.getDroneName()); | |||
mission.setInspectionLine(0); | |||
mission.setInspectionLineName(""); | |||
mission.setExecutionStartTime(DateUtils.now()); | |||
mission.setAirportFlyType(AirportFlyTypeEnum.POINTING_FLIGHT.getCode()); | |||
mission.setCreateUser(user.getId()); | |||
@@ -98,6 +217,31 @@ public class PointFlightService { | |||
log.info("创建应急任务失败"); | |||
throw new ServiceException("创建应急任务失败"); | |||
} | |||
return mission; | |||
} | |||
/** | |||
* 创建预警记录 | |||
* | |||
* @param userId | |||
* @param tenantId | |||
* @param request | |||
* @param emergencyMissionId | |||
*/ | |||
private void createWarningRecord(Integer userId, Integer tenantId, PointFlightRequest request, Integer emergencyMissionId) { | |||
WarningRecord warningRecord = new WarningRecord(); | |||
warningRecord.setTenantId(tenantId); | |||
warningRecord.setWarningId(request.getWarningId()); | |||
warningRecord.setMissionId(request.getMissionId()); | |||
warningRecord.setEmergencyMissionId(emergencyMissionId); | |||
warningRecord.setName(request.getAirportName() + "执行任务"); | |||
warningRecord.setCreateUser(userId); | |||
warningRecord.setCreateTime(DateUtils.now()); | |||
Integer count = warningRecordMapper.insert(warningRecord); | |||
if (count <= 0) { | |||
log.info("创建预计记录失败"); | |||
throw new ServiceException("创建预计记录失败"); | |||
} | |||
} | |||
} |
@@ -1,87 +1,87 @@ | |||
package com.tuoheng.admin.service.warehouse; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest; | |||
import com.tuoheng.admin.mapper.WarehouseMapper; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehouseListService; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehousePageListService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 仓库Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Warehouse> implements IWarehouseService { | |||
@Autowired | |||
private QueryWarehouseListService queryWarehouseListService; | |||
@Autowired | |||
private QueryWarehousePageListService queryWarehousePageListService; | |||
/** | |||
* 查询仓库列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryWarehouseListRequest request) { | |||
return queryWarehouseListService.getList(request); | |||
} | |||
/** | |||
* 查询仓库分页列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryWarehousePageListRequest request) { | |||
return queryWarehousePageListService.getPageList(request); | |||
} | |||
/** | |||
* 查询仓库 | |||
* | |||
* @param id 仓库主键 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Warehouse entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getWarehouseName())) { | |||
throw new ServiceException("仓库名称不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if (StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())) { | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} | |||
package com.tuoheng.admin.service.warehouse; | |||
import com.tuoheng.admin.entity.domain.Warehouse; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest; | |||
import com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest; | |||
import com.tuoheng.admin.mapper.WarehouseMapper; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehouseListService; | |||
import com.tuoheng.admin.service.warehouse.query.QueryWarehousePageListService; | |||
import com.tuoheng.admin.utils.GaodeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 仓库Service业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2023-02-06 | |||
*/ | |||
@Service | |||
public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Warehouse> implements IWarehouseService { | |||
@Autowired | |||
private QueryWarehouseListService queryWarehouseListService; | |||
@Autowired | |||
private QueryWarehousePageListService queryWarehousePageListService; | |||
/** | |||
* 查询仓库列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getList(QueryWarehouseListRequest request) { | |||
return queryWarehouseListService.getList(request); | |||
} | |||
/** | |||
* 查询仓库分页列表 | |||
* | |||
* @param request 仓库 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryWarehousePageListRequest request) { | |||
return queryWarehousePageListService.getPageList(request); | |||
} | |||
/** | |||
* 查询仓库 | |||
* | |||
* @param id 仓库主键 | |||
* @return 仓库 | |||
*/ | |||
@Override | |||
public JsonResult getOneById(Integer id) { | |||
return null; | |||
} | |||
@Override | |||
public JsonResult editInfo(Warehouse entity) { | |||
//新增 | |||
if (StringUtils.isNull(entity.getId())) { | |||
if (StringUtils.isEmpty(entity.getWarehouseName())) { | |||
throw new ServiceException("仓库名称不能为空"); | |||
} | |||
Integer tenantId = ShiroUtils.getTenantId(); | |||
entity.setTenantId(tenantId); | |||
entity.setCreateUser(ShiroUtils.getUserId()); | |||
} | |||
if (StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())) { | |||
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude()); | |||
entity.setLocation(gaodeAddress); | |||
} | |||
entity.setUpdateUser(ShiroUtils.getUserId()); | |||
super.edit(entity); | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -1,60 +1,60 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.GoodsMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Goods" id="GoodsResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseId" column="warehouse_id" /> | |||
<result property="goodsName" column="goods_name" /> | |||
<result property="goodsType" column="goods_type" /> | |||
<result property="goodsStock" column="goods_stock" /> | |||
<result property="goodsAction" column="goods_action" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectGoodsVo"> | |||
select id, tenant_id, warehouse_id, goods_name, goods_type, goods_stock, goods_action, create_user, create_time, update_user, update_time, mark from th_goods | |||
</sql> | |||
<select id="getListByWarehouseId" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest" resultMap="GoodsResult"> | |||
select | |||
g.id, | |||
g.tenant_id, | |||
g.warehouse_id, | |||
g.goods_name, | |||
g.goods_type, | |||
g.goods_stock, | |||
g.goods_action, | |||
g.create_user, | |||
g.create_time, | |||
g.update_user, | |||
g.update_time, | |||
g.mark, | |||
u.realname AS updateUserName | |||
from th_goods g | |||
LEFT JOIN sys_user u ON g.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and g.mark = 1 </if> | |||
<if test="tenantId != null "> and g.tenant_id = #{tenantId}</if> | |||
<if test="warehouseId != null "> and g.warehouse_id = #{warehouseId}</if> | |||
<if test="goodsType != null "> and g.goods_type = #{goodsType}</if> | |||
<if test="goodsName != null and goodsName != ''"> | |||
and g.goods_name like concat('%',#{goodsName},'%') | |||
</if> | |||
</where> | |||
order by g.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="GoodsResult"> | |||
<include refid="selectGoodsVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.GoodsMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Goods" id="GoodsResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseId" column="warehouse_id" /> | |||
<result property="goodsName" column="goods_name" /> | |||
<result property="goodsType" column="goods_type" /> | |||
<result property="goodsStock" column="goods_stock" /> | |||
<result property="goodsAction" column="goods_action" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectGoodsVo"> | |||
select id, tenant_id, warehouse_id, goods_name, goods_type, goods_stock, goods_action, create_user, create_time, update_user, update_time, mark from th_goods | |||
</sql> | |||
<select id="getListByWarehouseId" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest" resultMap="GoodsResult"> | |||
select | |||
g.id, | |||
g.tenant_id, | |||
g.warehouse_id, | |||
g.goods_name, | |||
g.goods_type, | |||
g.goods_stock, | |||
g.goods_action, | |||
g.create_user, | |||
g.create_time, | |||
g.update_user, | |||
g.update_time, | |||
g.mark, | |||
u.realname AS updateUserName | |||
from th_goods g | |||
LEFT JOIN sys_user u ON g.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and g.mark = 1 </if> | |||
<if test="tenantId != null "> and g.tenant_id = #{tenantId}</if> | |||
<if test="warehouseId != null "> and g.warehouse_id = #{warehouseId}</if> | |||
<if test="goodsType != null "> and g.goods_type = #{goodsType}</if> | |||
<if test="goodsName != null and goodsName != ''"> | |||
and g.goods_name like concat('%',#{goodsName},'%') | |||
</if> | |||
</where> | |||
order by g.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="GoodsResult"> | |||
<include refid="selectGoodsVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |
@@ -1,57 +1,57 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarehouseMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warehouse" id="WarehouseResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseName" column="warehouse_name" /> | |||
<result property="longitude" column="longitude" /> | |||
<result property="latitude" column="latitude" /> | |||
<result property="location" column="location" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarehouseVo"> | |||
select id, tenant_id, warehouse_name, longitude, latitude, location, create_user, create_time, update_user, update_time, mark from th_warehouse | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest" resultMap="WarehouseResult"> | |||
SELECT | |||
w.id, | |||
w.tenant_id, | |||
w.warehouse_name, | |||
w.longitude, | |||
w.latitude, | |||
w.location, | |||
w.create_user, | |||
w.create_time, | |||
w.update_user, | |||
w.update_time, | |||
w.mark, | |||
u.realname AS updateUserName | |||
FROM | |||
th_warehouse w | |||
LEFT JOIN sys_user u ON w.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and w.mark = 1 </if> | |||
<if test="request.tenantId != null and request.tenantId != 0"> and w.tenant_id = #{request.tenantId}</if> | |||
<if test="request.warehouseName != null and request.warehouseName != ''"> | |||
and w.warehouse_name like concat('%',#{request.warehouseName},'%') | |||
</if> | |||
</where> | |||
order by w.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarehouseResult"> | |||
<include refid="selectWarehouseVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarehouseMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warehouse" id="WarehouseResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warehouseName" column="warehouse_name" /> | |||
<result property="longitude" column="longitude" /> | |||
<result property="latitude" column="latitude" /> | |||
<result property="location" column="location" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarehouseVo"> | |||
select id, tenant_id, warehouse_name, longitude, latitude, location, create_user, create_time, update_user, update_time, mark from th_warehouse | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.entity.request.warehouse.QueryWarehousePageListRequest" resultMap="WarehouseResult"> | |||
SELECT | |||
w.id, | |||
w.tenant_id, | |||
w.warehouse_name, | |||
w.longitude, | |||
w.latitude, | |||
w.location, | |||
w.create_user, | |||
w.create_time, | |||
w.update_user, | |||
w.update_time, | |||
w.mark, | |||
u.realname AS updateUserName | |||
FROM | |||
th_warehouse w | |||
LEFT JOIN sys_user u ON w.update_user = u.id | |||
<where> | |||
<if test="1 == 1"> and w.mark = 1 </if> | |||
<if test="request.tenantId != null and request.tenantId != 0"> and w.tenant_id = #{request.tenantId}</if> | |||
<if test="request.warehouseName != null and request.warehouseName != ''"> | |||
and w.warehouse_name like concat('%',#{request.warehouseName},'%') | |||
</if> | |||
</where> | |||
order by w.create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarehouseResult"> | |||
<include refid="selectWarehouseVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |
@@ -1,67 +1,68 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarningMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warning" id="WarningResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="discoveryWay" column="discovery_way" /> | |||
<result property="location" column="location" /> | |||
<result property="status" column="status" /> | |||
<result property="questionId" column="question_id" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="checkUser" column="check_user" /> | |||
<result property="checkTime" column="check_time" /> | |||
<result property="checkResult" column="check_result" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarningVo"> | |||
select id, tenant_id, discovery_way, location, status, question_id, create_user, create_time, update_user, update_time, check_user, check_time, check_result, mark from th_warning | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warning.QueryWarningListRequest" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId} </if> | |||
<if test="status != null and status != 0 "> and status = #{status}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<update id="confirm" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
<if test="checkResult != null and checkResult != ''"> check_result = #{checkResult}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<update id="ignore" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarningMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.Warning" id="WarningResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="missionId" column="mission_id" /> | |||
<result property="discoveryWay" column="discovery_way" /> | |||
<result property="location" column="location" /> | |||
<result property="status" column="status" /> | |||
<result property="questionId" column="question_id" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="checkUser" column="check_user" /> | |||
<result property="checkTime" column="check_time" /> | |||
<result property="checkResult" column="check_result" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarningVo"> | |||
select id, tenant_id, mission_id, discovery_way, location, status, question_id, create_user, create_time, update_user, update_time, check_user, check_time, check_result, mark from th_warning | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warning.QueryWarningListRequest" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId} </if> | |||
<if test="status != null and status != 0 "> and status = #{status}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarningResult"> | |||
<include refid="selectWarningVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<update id="confirm" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
<if test="checkResult != null and checkResult != ''"> check_result = #{checkResult}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<update id="ignore" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if> | |||
<if test="checkTime != null"> check_time = #{checkTime}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
</mapper> |
@@ -1,39 +1,40 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarningRecordMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.WarningRecord" id="WarningRecordResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warningId" column="warning_id" /> | |||
<result property="name" column="name" /> | |||
<result property="missionId" column="mission_id" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarningRecordVo"> | |||
select id, tenant_id, warning_id, name, mission_id, create_user, create_time, update_user, update_time, mark from th_warning_record | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest" resultMap="WarningRecordResult"> | |||
<include refid="selectWarningRecordVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> | |||
<if test="warningId != null "> and warning_id = #{warningId}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarningRecordResult"> | |||
<include refid="selectWarningRecordVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.admin.mapper.WarningRecordMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.domain.WarningRecord" id="WarningRecordResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="warningId" column="warning_id" /> | |||
<result property="missionId" column="mission_id" /> | |||
<result property="emergencyMissionId" column="emergency_mission_id" /> | |||
<result property="name" column="name" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="mark" column="mark" /> | |||
</resultMap> | |||
<sql id="selectWarningRecordVo"> | |||
select id, tenant_id, warning_id, name, mission_id, create_user, create_time, update_user, update_time, mark from th_warning_record | |||
</sql> | |||
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListByWarningIdRequest" resultMap="WarningRecordResult"> | |||
<include refid="selectWarningRecordVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if> | |||
<if test="warningId != null "> and warning_id = #{warningId}</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="getOneById" parameterType="Integer" resultMap="WarningRecordResult"> | |||
<include refid="selectWarningRecordVo"/> | |||
where mark = 1 and id = #{id} | |||
</select> | |||
</mapper> |