Преглед изворни кода

1、重构项目中原异常码返回code,原来是0,改为-1;2、新增机场接口;3、新增根据仓库ID获取物质接口;4、重构预警代码;5、重构监控代码;

tags/v1.2.0^2
wanjing пре 1 година
родитељ
комит
42c3af56e5
26 измењених фајлова са 333 додато и 122 уклоњено
  1. +35
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java
  2. +5
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/GoodsController.java
  3. +10
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarehouseController.java
  4. +26
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/goods/QueryGoodsListByWarehouseIdRequest.java
  5. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/goods/QueryGoodsPageListRequest.java
  6. +21
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warehouse/QueryWarehouseListRequest.java
  7. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warehouse/QueryWarehousePageListRequest.java
  8. +2
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/GoodsMapper.java
  9. +9
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportService.java
  10. +14
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java
  11. +5
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java
  12. +4
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/query/QueryCameraListService.java
  13. +6
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/GoodsServiceImpl.java
  14. +3
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/IGoodsService.java
  15. +77
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/query/QueryGoodsListByWarehouseIdService.java
  16. +0
    -64
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/query/QueryGoodsListService.java
  17. +8
    -8
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/TenantServiceImpl.java
  18. +10
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/IWarehouseService.java
  19. +19
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/WarehouseServiceImpl.java
  20. +63
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/query/QueryWarehouseListService.java
  21. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/query/QueryWarehousePageListService.java
  22. +4
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/confirm/WarningConfirmService.java
  23. +4
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/ignore/WarningIgnoreService.java
  24. +3
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningByIdService.java
  25. +0
    -5
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java
  26. +2
    -1
      tuoheng-admin/src/main/resources/mapper/GoodsMapper.xml

+ 35
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/AirPortController.java Прегледај датотеку

@@ -0,0 +1,35 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.service.airport.AirportService;
import com.tuoheng.common.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* 机场前端控制器
*
* @author wanjing
* @team tuoheng
* @date 2023-02-10
*/
@Slf4j
@RestController
@RequestMapping("/airport")
public class AirPortController {

@Autowired
private AirportService airportService;

/**
* 获取巡检机场列表
*/
@GetMapping("/list")
public JsonResult getList() {
return airportService.getList();
}


}

+ 5
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/GoodsController.java Прегледај датотеку

@@ -1,6 +1,6 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest;
import com.tuoheng.admin.service.goods.IGoodsService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
@@ -22,11 +22,11 @@ public class GoodsController {
private IGoodsService goodsService;

/**
* 查询物资列表
* 根据仓库ID查询物资列表
*/
@GetMapping("/list")
public JsonResult getList(QueryGoodsListRequest request) {
return goodsService.getList(request);
@GetMapping("/list/by/warehouseid")
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) {
return goodsService.getListByWarehouseId(request);
}

}

+ 10
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarehouseController.java Прегледај датотеку

@@ -1,6 +1,7 @@
package com.tuoheng.admin.controller;

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.service.warehouse.IWarehouseService;
import com.tuoheng.common.utils.JsonResult;
@@ -23,9 +24,17 @@ public class WarehouseController {
/**
* 查询仓库列表
*/
@GetMapping("/list")
public JsonResult getlist(QueryWarehouseListRequest request) {
return warehouseService.getList(request);
}

/**
* 查询仓库分页列表
*/
@GetMapping("/page/list")
public JsonResult getPagelist(QueryWarehousePageListRequest request) {
return warehouseService.getPagelist(request);
return warehouseService.getPageList(request);
}

/**

+ 26
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/goods/QueryGoodsListByWarehouseIdRequest.java Прегледај датотеку

@@ -0,0 +1,26 @@
package com.tuoheng.admin.entity.request.goods;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* 查询摄像头列表请求实体
*
* @author: qiujinyang
*/
@Data
public class QueryGoodsListByWarehouseIdRequest implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "租户Id", hidden = true)
private Integer tenantId;

/**
* 仓库ID
*/
private Integer warehouseId;

}

tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/goods/QueryGoodsListRequest.java → tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/goods/QueryGoodsPageListRequest.java Прегледај датотеку

@@ -11,7 +11,7 @@ import java.io.Serializable;
* @author: qiujinyang
*/
@Data
public class QueryGoodsListRequest implements Serializable {
public class QueryGoodsPageListRequest implements Serializable {

private static final long serialVersionUID = 1L;


+ 21
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warehouse/QueryWarehouseListRequest.java Прегледај датотеку

@@ -0,0 +1,21 @@
package com.tuoheng.admin.entity.request.warehouse;

import com.tuoheng.common.common.BaseQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* 查询仓库列表请求实体
* @author: qiujinyang
*/
@Data
public class QueryWarehouseListRequest extends BaseQuery implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "租户Id",hidden = true)
private Integer tenantId;

}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warehouse/QueryWarehousePageListRequest.java Прегледај датотеку

@@ -7,7 +7,7 @@ import lombok.Data;
import java.io.Serializable;

/**
* 查询仓库列表请求实体
* 查询仓库分页列表请求实体
* @author: qiujinyang
*/
@Data

+ 2
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/GoodsMapper.java Прегледај датотеку

@@ -4,7 +4,7 @@ import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest;

/**
* 物资Mapper接口
@@ -21,7 +21,7 @@ public interface GoodsMapper extends BaseMapper<Goods> {
* @param request 物资
* @return 物资集合
*/
List<Goods> getList(QueryGoodsListRequest request);
List<Goods> getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request);

/**
* 查询物资

+ 9
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportService.java Прегледај датотеку

@@ -0,0 +1,9 @@
package com.tuoheng.admin.service.airport;

import com.tuoheng.common.utils.JsonResult;

public interface AirportService {

JsonResult getList();

}

+ 14
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/airport/AirportServiceImpl.java Прегледај датотеку

@@ -0,0 +1,14 @@
package com.tuoheng.admin.service.airport;

import com.tuoheng.common.utils.JsonResult;
import org.springframework.stereotype.Service;

@Service
public class AirportServiceImpl implements AirportService {

@Override
public JsonResult getList() {
return JsonResult.success();
}

}

+ 5
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/CameraServiceImpl.java Прегледај датотеку

@@ -55,19 +55,19 @@ public class CameraServiceImpl extends BaseServiceImpl<CameraMapper, Camera> imp
//新增
if (StringUtils.isNull(entity.getId())) {
if (StringUtils.isEmpty(entity.getCameraName())) {
throw new ServiceException(0, "摄像头名称不能为空");
throw new ServiceException(-1, "摄像头名称不能为空");
}
if (ObjectUtil.isEmpty(entity.getCameraType())) {
throw new ServiceException(0, "设备类型不能为空");
throw new ServiceException(-1, "设备类型不能为空");
}
if (StringUtils.isEmpty(entity.getLongitude())) {
throw new ServiceException(0, "经度不能为空");
throw new ServiceException(-1, "经度不能为空");
}
if (StringUtils.isEmpty(entity.getLatitude())) {
throw new ServiceException(0, "纬度不能为空");
throw new ServiceException(-1, "纬度不能为空");
}
if (StringUtils.isEmpty(entity.getFlvUrl())) {
throw new ServiceException(0, "摄像头地址不能为空");
throw new ServiceException(-1, "摄像头地址不能为空");
}
}
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){

+ 4
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/service/camera/query/QueryCameraListService.java Прегледај датотеку

@@ -29,8 +29,10 @@ public class QueryCameraListService {

public JsonResult getList(QueryCameraListRequest request) {
// log.info("进入查询监控列表业务");
User user = ShiroUtils.getUserInfo();
Integer tenantId = user.getTenantId();
// User user = ShiroUtils.getUserInfo();
// Integer tenantId = user.getTenantId();

Integer tenantId = 1;
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);

+ 6
- 6
tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/GoodsServiceImpl.java Прегледај датотеку

@@ -1,7 +1,7 @@
package com.tuoheng.admin.service.goods;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.service.goods.query.QueryGoodsListService;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest;
import com.tuoheng.admin.service.goods.query.QueryGoodsListByWarehouseIdService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -17,17 +17,17 @@ import org.springframework.stereotype.Service;
public class GoodsServiceImpl implements IGoodsService {
@Autowired
private QueryGoodsListService queryGoodsListService;
private QueryGoodsListByWarehouseIdService queryGoodsListService;
/**
* 查询物资列表
* 根据仓库Id查询物资列表
*
* @param request 查询物资列表实体
* @return 摄像头集合
*/
@Override
public JsonResult getList(QueryGoodsListRequest request) {
return queryGoodsListService.getList(request);
public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) {
return queryGoodsListService.getListByWarehouseId(request);
}
/**

+ 3
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/IGoodsService.java Прегледај датотеку

@@ -1,7 +1,6 @@
package com.tuoheng.admin.service.goods;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest;
import com.tuoheng.common.utils.JsonResult;
/**
@@ -15,12 +14,12 @@ public interface IGoodsService {
/**
* 查询物资列表
* 根据仓库Id查询物资列表
*
* @param request 查询物资列表实体
* @return 摄像头集合
*/
JsonResult getList(QueryGoodsListRequest request);
JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request);
/**
* 查询物资

+ 77
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/query/QueryGoodsListByWarehouseIdService.java Прегледај датотеку

@@ -0,0 +1,77 @@
package com.tuoheng.admin.service.goods.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.domain.Warehouse;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest;
import com.tuoheng.admin.mapper.GoodsMapper;
import com.tuoheng.admin.mapper.WarehouseMapper;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 根据仓库ID查询物质表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-22
*/
@Slf4j
@Service
public class QueryGoodsListByWarehouseIdService {

@Autowired
private GoodsMapper goodsMapper;

@Autowired
private WarehouseMapper warehouseMapper;

public JsonResult getListByWarehouseId(QueryGoodsListByWarehouseIdRequest request) {
// log.info("进入查询物质列表业务");
User user = ShiroUtils.getUserInfo();
Integer tenantId = user.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("进入查询物质列表业务:校验失败:{}", result.getMsg());
return result;
}
List<Goods> cameraList = goodsMapper.getListByWarehouseId(request);
if (CollectionUtil.isEmpty(cameraList)) {
log.info("物质列表数据为空");
}
return JsonResult.success(cameraList);
}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(QueryGoodsListByWarehouseIdRequest request) {
if (ObjectUtil.isNull(request.getWarehouseId())) {
log.info("仓库ID为空, warehouseId:{}", request.getWarehouseId());
throw new ServiceException(-1, "仓库ID为空");
}
Warehouse warehouse = warehouseMapper.selectOne(new LambdaQueryWrapper<Warehouse>()
.eq(Warehouse::getTenantId, request.getTenantId())
.eq(Warehouse::getId, request.getWarehouseId()));
if (ObjectUtil.isNull(warehouse)) {
log.info("仓库不存在, warehouseId:{}", request.getWarehouseId());
throw new ServiceException(-1, "仓库不存在");
}
return JsonResult.success();
}

}

+ 0
- 64
tuoheng-admin/src/main/java/com/tuoheng/admin/service/goods/query/QueryGoodsListService.java Прегледај датотеку

@@ -1,64 +0,0 @@
package com.tuoheng.admin.service.goods.query;

import cn.hutool.core.collection.CollectionUtil;
import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.mapper.CameraMapper;
import com.tuoheng.admin.mapper.GoodsMapper;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 查询物质表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-22
*/
@Slf4j
@Service
public class QueryGoodsListService {

@Autowired
private GoodsMapper goodsMapper;

public JsonResult getList(QueryGoodsListRequest request) {
// log.info("进入查询物质列表业务");

User user = ShiroUtils.getUserInfo();
Integer tenantId = user.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询物质列表业务:校验失败:{}", result.getMsg());
return result;
}
List<Goods> cameraList = goodsMapper.getList(request);
if (CollectionUtil.isEmpty(cameraList)) {
log.info("物质列表数据为空");
}
return JsonResult.success(cameraList);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(Integer tenantId, QueryGoodsListRequest request) {

return JsonResult.success();
}

}

+ 8
- 8
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/TenantServiceImpl.java Прегледај датотеку

@@ -84,7 +84,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
.eq(User::getUsername, tenantDto.getUsername())
.eq(User::getMark, 1));
if (count2 > 0) {
throw new ServiceException(0, "系统中已经存在相同的账号信息");
throw new ServiceException(-1, "系统中已经存在相同的账号信息");
}
// 参数转换
Tenant tenant = new Tenant();
@@ -96,7 +96,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 新建租户数据
int count = tenantMapper.insert(tenant);
if (count == 0) {
throw new ServiceException(0, "租户创建失败");
throw new ServiceException(-1, "租户创建失败");
}
// 创建租户账号
User user = new User();
@@ -110,7 +110,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
user.setCreateTime(DateUtils.now());
int count3 = userMapper.insert(user);
if (count3 == 0) {
throw new ServiceException(0, "租户登录账号创建失败");
throw new ServiceException(-1, "租户登录账号创建失败");
}

return true;
@@ -127,7 +127,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 查询租户信息
Tenant tenant = tenantMapper.selectById(tenantDto.getId());
if (StringUtils.isNull(tenant)) {
throw new ServiceException(0, "租户信息不存在");
throw new ServiceException(-1, "租户信息不存在");
}
BeanUtils.copyProperties(tenantDto, tenant);
// 租户头像
@@ -137,7 +137,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
// 更新租户信息
int count = tenantMapper.updateById(tenant);
if (count == 0) {
throw new ServiceException(0, "更新租户信息失败");
throw new ServiceException(-1, "更新租户信息失败");
}

// 验证账号
@@ -146,13 +146,13 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
.eq(User::getUsername, tenantDto.getUsername())
.eq(User::getMark, 1));
if (count2 > 0) {
throw new ServiceException(0, "系统中已经存在相同的账号信息");
throw new ServiceException(-1, "系统中已经存在相同的账号信息");
}

// 查询租户账号信息
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getTenantId, tenant.getId()).eq(User::getMark, 1));
if (StringUtils.isNull(user)) {
throw new ServiceException(0, "租户账号信息不存在");
throw new ServiceException(-1, "租户账号信息不存在");
}
user.setRealname(tenantDto.getName());
user.setNickname(tenantDto.getName());
@@ -161,7 +161,7 @@ public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> imp
user.setUpdateTime(DateUtils.now());
int count3 = userMapper.updateById(user);
if (count3 == 0) {
throw new ServiceException(0, "租户账号信息更新失败");
throw new ServiceException(-1, "租户账号信息更新失败");
}
return true;
}

+ 10
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/IWarehouseService.java Прегледај датотеку

@@ -1,6 +1,7 @@
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.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;
@@ -20,7 +21,15 @@ public interface IWarehouseService extends IBaseService<Warehouse> {
* @param request 仓库
* @return 仓库集合
*/
JsonResult getPagelist(QueryWarehousePageListRequest request);
JsonResult getList(QueryWarehouseListRequest request);
/**
* 查询仓库分页列表
*
* @param request 仓库
* @return 仓库集合
*/
JsonResult getPageList(QueryWarehousePageListRequest request);
/**
* 查询仓库

+ 19
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/WarehouseServiceImpl.java Прегледај датотеку

@@ -1,9 +1,10 @@
package com.tuoheng.admin.service.warehouse;
import cn.hutool.core.util.ObjectUtil;
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;
@@ -23,6 +24,9 @@ import org.springframework.stereotype.Service;
@Service
public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Warehouse> implements IWarehouseService {
@Autowired
private QueryWarehouseListService queryWarehouseListService;
@Autowired
private QueryWarehousePageListService queryWarehousePageListService;
@@ -33,7 +37,18 @@ public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Wareh
* @return 仓库
*/
@Override
public JsonResult getPagelist(QueryWarehousePageListRequest request) {
public JsonResult getList(QueryWarehouseListRequest request) {
return queryWarehouseListService.getList(request);
}
/**
* 查询仓库分页列表
*
* @param request 仓库
* @return 仓库
*/
@Override
public JsonResult getPageList(QueryWarehousePageListRequest request) {
return queryWarehousePageListService.getPageList(request);
}
@@ -53,10 +68,10 @@ public class WarehouseServiceImpl extends BaseServiceImpl<WarehouseMapper, Wareh
//新增
if (StringUtils.isNull(entity.getId())) {
if (StringUtils.isEmpty(entity.getWarehouseName())) {
throw new ServiceException(0, "仓库名称不能为空");
throw new ServiceException(-1, "仓库名称不能为空");
}
}
if(StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())){
if (StringUtils.isNotEmpty(entity.getLongitude()) && StringUtils.isNotEmpty(entity.getLatitude())) {
String gaodeAddress = GaodeUtil.getGaodeAddress(entity.getLongitude(), entity.getLatitude());
entity.setLocation(gaodeAddress);
}

+ 63
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/query/QueryWarehouseListService.java Прегледај датотеку

@@ -0,0 +1,63 @@
package com.tuoheng.admin.service.warehouse.query;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.Warehouse;
import com.tuoheng.admin.entity.request.warehouse.QueryWarehouseListRequest;
import com.tuoheng.admin.mapper.WarehouseMapper;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* 查询仓库列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-11-22
*/
@Slf4j
@Service
public class QueryWarehouseListService {

@Autowired
private WarehouseMapper warehouseMapper;

public JsonResult getList(QueryWarehouseListRequest request) {
// log.info("进入查询仓库列表业务");
User user = ShiroUtils.getUserInfo();
Integer tenantId = user.getTenantId();
request.setTenantId(tenantId);

JsonResult result = this.check(tenantId, request);
if (0 != result.getCode()) {
log.info("进入查询仓库列表业务:校验失败:{}", result.getMsg());
return result;
}

List<Warehouse> warehouseList = warehouseMapper.selectList(new LambdaQueryWrapper<Warehouse>()
.eq(Warehouse::getTenantId, request.getTenantId()));
if (CollectionUtil.isEmpty(warehouseList)) {
log.info("仓库列表数据为空");
}
return JsonResult.success(warehouseList);
}

/**
* 检查参数
*
* @param tenantId
* @param request
* @return
*/
private JsonResult check(Integer tenantId, QueryWarehouseListRequest request) {

return JsonResult.success();
}

}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warehouse/query/QueryWarehousePageListService.java Прегледај датотеку

@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
import java.util.List;

/**
* 查询仓库分页业务层处理
* 查询仓库分页列表业务层处理
*
* @author wanjing
* @team tuoheng

+ 4
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/confirm/WarningConfirmService.java Прегледај датотеку

@@ -58,17 +58,17 @@ public class WarningConfirmService {
private JsonResult check(Integer tenantId, WarningConfirmRequest request) {
// 判断预警id是否为空
if (ObjectUtil.isNotNull(request.getId())) {
throw new ServiceException(0, "预警ID为空");
throw new ServiceException(-1, "预警ID为空");
}
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.eq(Warning::getId, request.getId())
.eq(Warning::getTenantId, tenantId)
.eq(Warning::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(warning)) {
throw new ServiceException(0, "预警信息不存在");
throw new ServiceException(-1, "预警信息不存在");
}
if (!tenantId.equals(warning.getTenantId())) {
throw new ServiceException(0, "该租户没有查询该预警信息的权限");
throw new ServiceException(-1, "该租户没有查询该预警信息的权限");
}
return JsonResult.success(warning);
}
@@ -91,7 +91,7 @@ public class WarningConfirmService {
Integer rowCount = warningMapper.confirm(map);
if (rowCount <= 0) {
log.info("修改预警状态, 确认失败");
throw new ServiceException(0, "修改预警状态, 确认失败");
throw new ServiceException(-1, "修改预警状态, 确认失败");
}
return JsonResult.success();
}

+ 4
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/ignore/WarningIgnoreService.java Прегледај датотеку

@@ -58,16 +58,16 @@ public class WarningIgnoreService {
private JsonResult check(Integer tenantId, Integer id) {
// 判断预警id是否为空
if (ObjectUtil.isNotNull(id)) {
throw new ServiceException(0, "预警ID为空");
throw new ServiceException(-1, "预警ID为空");
}
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.in(Warning::getId, id)
.eq(Warning::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(warning)) {
throw new ServiceException(0, "预警信息不存在");
throw new ServiceException(-1, "预警信息不存在");
}
if (!tenantId.equals(warning.getTenantId())) {
throw new ServiceException(0, "该租户没有查询该预警信息的权限");
throw new ServiceException(-1, "该租户没有查询该预警信息的权限");
}
return JsonResult.success(warning);
}
@@ -89,7 +89,7 @@ public class WarningIgnoreService {
Integer rowCount = warningMapper.confirm(map);
if (rowCount <= 0) {
log.info("修改预警状态, 确认失败");
throw new ServiceException(0, "修改预警状态, 确认失败");
throw new ServiceException(-1, "修改预警状态, 确认失败");
}
return JsonResult.success();
}

+ 3
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningByIdService.java Прегледај датотеку

@@ -54,17 +54,17 @@ public class QueryWarningByIdService {
private JsonResult check(Integer tenantId, Integer id) {
// 判断预警id是否为空
if (ObjectUtil.isNotNull(id)) {
throw new ServiceException(0, "预警ID为空");
throw new ServiceException(-1, "预警ID为空");
}
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.eq(Warning::getId, id)
.eq(Warning::getTenantId, tenantId)
.eq(Warning::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(warning)) {
throw new ServiceException(0, "预警信息不存在");
throw new ServiceException(-1, "预警信息不存在");
}
if (!tenantId.equals(warning.getTenantId())) {
throw new ServiceException(0, "该租户没有查询该预警信息的权限");
throw new ServiceException(-1, "该租户没有查询该预警信息的权限");
}
return JsonResult.success(warning);
}

+ 0
- 5
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java Прегледај датотеку

@@ -3,17 +3,12 @@ package com.tuoheng.admin.service.warning.query;
import cn.hutool.core.collection.CollectionUtil;
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.conver.WarningConverMapper;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;
import com.tuoheng.admin.entity.vo.warning.WarningListVo;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.GoodsMapper;
import com.tuoheng.admin.mapper.QuestionMapper;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.utils.JsonResult;

+ 2
- 1
tuoheng-admin/src/main/resources/mapper/GoodsMapper.xml Прегледај датотеку

@@ -23,11 +23,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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="getList" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest" resultMap="GoodsResult">
<select id="getListByWarehouseId" parameterType="com.tuoheng.admin.entity.request.goods.QueryGoodsListByWarehouseIdRequest" resultMap="GoodsResult">
<include refid="selectGoodsVo"/>
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
</where>
order by create_time desc
</select>

Loading…
Откажи
Сачувај