Merge branch 'server_five' of https://gitea.qinmian.online/five-groups/five-groups-couplet into server_five_dongxiaodong
# Conflicts: # couplet-common/couplet-common-system/src/main/java/com/couplet/common/system/domain/SysDept.javaserver_five_liuyunhu
commit
b17a7104e0
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -33,6 +33,8 @@ public class BaseEntity implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
*/
|
*/
|
||||||
|
@ -44,6 +46,7 @@ public class BaseEntity implements Serializable {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
/**
|
/**
|
||||||
* 更新者
|
* 更新者
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -55,4 +55,5 @@ public enum BusinessType {
|
||||||
* 清空数据
|
* 清空数据
|
||||||
*/
|
*/
|
||||||
CLEAN,
|
CLEAN,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class SecurityUtils {
|
||||||
* 获取登录企业ID
|
* 获取登录企业ID
|
||||||
*/
|
*/
|
||||||
public static Long getEnterpriseId(){
|
public static Long getEnterpriseId(){
|
||||||
Long enterpriseId = getLoginUser().getEnterpriseId();
|
Long enterpriseId = getLoginUser().getDeptId();
|
||||||
Assert.notNull(enterpriseId, "该用户未绑定负责企业");
|
Assert.notNull(enterpriseId, "该用户未绑定负责企业");
|
||||||
return enterpriseId;
|
return enterpriseId;
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ public class SecurityUtils {
|
||||||
* 根据request获取请求token
|
* 根据request获取请求token
|
||||||
*/
|
*/
|
||||||
public static String getToken (HttpServletRequest request) {
|
public static String getToken (HttpServletRequest request) {
|
||||||
// 从header获取token标识
|
// 从header标识
|
||||||
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
||||||
return replaceTokenPrefix(token);
|
return replaceTokenPrefix(token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class LoginUser implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 企业ID
|
* 企业ID
|
||||||
*/
|
*/
|
||||||
private Long enterpriseId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.couplet.common.system.domain;
|
package com.couplet.common.system.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.couplet.common.core.web.domain.BaseEntity;
|
import com.couplet.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
|
@ -13,13 +13,30 @@ public class SysFirm {
|
||||||
/**
|
/**
|
||||||
* 企业id
|
* 企业id
|
||||||
**/
|
**/
|
||||||
private Integer firmId;
|
private Integer deptId;
|
||||||
/**
|
/**
|
||||||
* 企业名称
|
* 企业名称
|
||||||
**/
|
**/
|
||||||
private String firmName;
|
private String deptName;
|
||||||
/**
|
/**
|
||||||
* 企业认证
|
* 企业负责人
|
||||||
**/
|
**/
|
||||||
private Integer approveId;
|
private String leader;
|
||||||
|
/**
|
||||||
|
* 企业联系电话
|
||||||
|
**/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 企业删除
|
||||||
|
**/
|
||||||
|
private Integer delFlag;
|
||||||
|
/**
|
||||||
|
* 企业状态
|
||||||
|
**/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 企业创建人
|
||||||
|
**/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,16 +2,16 @@ package com.couplet.common.system.remote;
|
||||||
|
|
||||||
import com.couplet.common.core.constant.ServiceNameConstants;
|
import com.couplet.common.core.constant.ServiceNameConstants;
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.core.web.page.TableDataInfo;
|
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import com.couplet.common.system.domain.SysUser;
|
|
||||||
import com.couplet.common.system.remote.factory.RemoteDeptFallbackFactory;
|
import com.couplet.common.system.remote.factory.RemoteDeptFallbackFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
@FeignClient(contextId = "remoteFileService" ,
|
@FeignClient(contextId = "remoteDeptService" ,
|
||||||
value = ServiceNameConstants.SYSTEM_SERVICE,
|
value = ServiceNameConstants.SYSTEM_SERVICE,
|
||||||
fallbackFactory = RemoteDeptFallbackFactory.class,
|
fallbackFactory = RemoteDeptFallbackFactory.class,
|
||||||
path = "/dept"
|
path = "/dept"
|
||||||
|
@ -28,9 +28,70 @@ public interface RemoteDeptService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
* @param enterpriseId 企业ID
|
*
|
||||||
|
* @param deptId 企业ID
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getSysDeptByEnterpriseId/{enterpriseId}")
|
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||||
public Result<SysDept> getSysDeptByEnterpriseId(@PathVariable(value = "enterpriseId") Long enterpriseId);
|
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param dept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 企业部门添加
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public Result add (@Validated @RequestBody SysDept dept);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param dept:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 企业部门修改
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public Result edit (@Validated @RequestBody SysDept dept);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param null:
|
||||||
|
* @return null
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{deptId}")
|
||||||
|
public Result remove (@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据deptId获取部门详情
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/{deptId}")
|
||||||
|
public Result getInfo (@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 查询部门列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
|
public Result excludeChild (@PathVariable(value = "deptId") Long deptId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ public interface RemoteUserService {
|
||||||
*
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@GetMapping("/user/info/{username}")
|
@GetMapping("/user/info/{username}")
|
||||||
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public Result<LoginUser> getUserInfo (@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.couplet.common.system.remote.factory;
|
package com.couplet.common.system.remote.factory;
|
||||||
|
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.core.web.page.TableDataInfo;
|
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import com.couplet.common.system.domain.SysUser;
|
|
||||||
import com.couplet.common.system.remote.RemoteDeptService;
|
import com.couplet.common.system.remote.RemoteDeptService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fufanrui
|
* @author fufanrui
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
|
@ -20,24 +20,88 @@ public class RemoteDeptFallbackFactory implements FallbackFactory<RemoteDeptServ
|
||||||
@Override
|
@Override
|
||||||
public RemoteDeptService create(Throwable cause) {
|
public RemoteDeptService create(Throwable cause) {
|
||||||
log.error("sys服务调用失败:{}", cause.getMessage());
|
log.error("sys服务调用失败:{}", cause.getMessage());
|
||||||
|
|
||||||
return new RemoteDeptService() {
|
return new RemoteDeptService() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result list(SysDept dept) {
|
public Result list(SysDept dept) {
|
||||||
return Result.error("调用失败..."+cause.getMessage());
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
*
|
*
|
||||||
* @param enterpriseId 企业ID
|
* @param deptId 企业ID
|
||||||
*
|
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<SysDept> getSysDeptByEnterpriseId (Long enterpriseId) {
|
public Result<List<SysDept>> getSysDeptByDeptId(Long deptId) {
|
||||||
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* @param cause:
|
||||||
|
* @return RemoteDeptService
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result add(SysDept dept) {
|
||||||
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param dept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 修改企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result edit(SysDept dept) {
|
||||||
return Result.error("调用失败..."+cause.getMessage());
|
return Result.error("调用失败..."+cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 删除企业部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result remove(Long deptId) {
|
||||||
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据deptId获取部门详情
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result getInfo(Long deptId) {
|
||||||
|
return Result.error("调用失败....."+cause.getMessage());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* @param deptId:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 查询部门列表
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Result excludeChild(Long deptId) {
|
||||||
|
return Result.error("调用失败...."+cause.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.couplet.map.common.domain;
|
||||||
|
|
||||||
|
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.couplet.common.core.web.domain.BaseEntity;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
* 电子围栏类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("couplet_fence_info")
|
||||||
|
public class Fence extends BaseEntity{
|
||||||
|
|
||||||
|
@TableId(value = "fence_id", type = IdType.AUTO)
|
||||||
|
/**
|
||||||
|
* 围栏id
|
||||||
|
*/
|
||||||
|
private Long fenceId;
|
||||||
|
/**
|
||||||
|
* 围栏名称
|
||||||
|
*/
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 围栏经纬度
|
||||||
|
*/
|
||||||
|
private String fenceLongitudeLatitude;
|
||||||
|
/**
|
||||||
|
* 围栏描述
|
||||||
|
*/
|
||||||
|
private String fenceDescription;
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
/**
|
||||||
|
* 围栏状态
|
||||||
|
*/
|
||||||
|
private Integer fenceState;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createName;
|
||||||
|
/**
|
||||||
|
* 维护人
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String maintainerName;
|
||||||
|
/**
|
||||||
|
* 告警状态
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Integer alarmStatus;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
/**
|
||||||
|
* 标识
|
||||||
|
*/
|
||||||
|
private Integer[] logoId;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String logoName;
|
||||||
|
|
||||||
|
public static Fence updateFenceStatus(FenceUpdateRequest fenceUpdateRequest) {
|
||||||
|
|
||||||
|
return Fence.builder()
|
||||||
|
.fenceName(fenceUpdateRequest.getFenceName())
|
||||||
|
.fenceDescription(fenceUpdateRequest.getFenceDescription())
|
||||||
|
.fenceState(fenceUpdateRequest.getFenceState())
|
||||||
|
.fenceLongitudeLatitude(fenceUpdateRequest.getFenceLongitudeLatitude())
|
||||||
|
.createName(fenceUpdateRequest.getCrateName())
|
||||||
|
.createTime(fenceUpdateRequest.getCreateTime())
|
||||||
|
.isDelete(fenceUpdateRequest.getIsDelete())
|
||||||
|
.maintainerName(fenceUpdateRequest.getMaintainerName())
|
||||||
|
.alarmStatus(fenceUpdateRequest.getAlarmStatus())
|
||||||
|
.updateTime(fenceUpdateRequest.getUpdateTime())
|
||||||
|
.fenceId(fenceUpdateRequest.getFenceId())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public static Fence fenceInsert(FenceRequest fenceRequest) {
|
||||||
|
//
|
||||||
|
// return Fence.builder()
|
||||||
|
// .fenceName(fenceRequest.getFenceName())
|
||||||
|
// .fenceLongitudeLatitude(fenceRequest.getFenceLongitudeLatitude())
|
||||||
|
// .fenceState(fenceRequest.getFenceState())
|
||||||
|
// .fenceDescription(fenceRequest.getFenceDescription())
|
||||||
|
// .createTime(fenceRequest.getCreateTime())
|
||||||
|
// .updateTime(fenceRequest.getUpdateTime())
|
||||||
|
// .isDelete(fenceRequest.getIsDelete())
|
||||||
|
// .alarmStatus(fenceRequest.getAlarmStatus())
|
||||||
|
// .logoId(fenceRequest.getLogoId())
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.couplet.map.common.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/29
|
||||||
|
* 标识实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
@TableName("couplet_logo_info")
|
||||||
|
public class Logo {
|
||||||
|
|
||||||
|
private Integer logoId;
|
||||||
|
private String logoName;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.couplet.map.common.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class FenceConfig {
|
||||||
|
|
||||||
|
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 围栏状态
|
||||||
|
*/
|
||||||
|
private Integer fenceState;
|
||||||
|
private Integer pageNum=1;
|
||||||
|
private Integer pageSize=3;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.couplet.map.common.domain.request;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class FenceRequest {
|
||||||
|
/**
|
||||||
|
* 围栏id
|
||||||
|
*/
|
||||||
|
private Integer fenceId;
|
||||||
|
/**
|
||||||
|
* 新增电子名称
|
||||||
|
*/
|
||||||
|
private String fenceName;
|
||||||
|
/**
|
||||||
|
* 围栏经纬度
|
||||||
|
*/
|
||||||
|
private String fenceLongitudeLatitude;
|
||||||
|
/**
|
||||||
|
* 围栏描述
|
||||||
|
*/
|
||||||
|
private String fenceDescription;
|
||||||
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
/**
|
||||||
|
* 围栏状态
|
||||||
|
*/
|
||||||
|
private Integer fenceState;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String crateName;
|
||||||
|
/**
|
||||||
|
* 维护人
|
||||||
|
*/
|
||||||
|
private String maintainerName;
|
||||||
|
/**
|
||||||
|
* 报警状态
|
||||||
|
*/
|
||||||
|
private Integer alarmStatus;
|
||||||
|
/**
|
||||||
|
* 标识
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String[] logoId;
|
||||||
|
}
|
|
@ -1,32 +1,31 @@
|
||||||
package com.couplet.map.common.domin;
|
package com.couplet.map.common.domain.request;
|
||||||
|
|
||||||
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.couplet.common.core.web.domain.BaseEntity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.NoArgsConstructor;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiJiaYao
|
* @Author: LiJiaYao
|
||||||
* @Date: 2024/3/28
|
* @Date: 2024/3/29
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@AllArgsConstructor
|
||||||
@TableName("couplet_fence")
|
@NoArgsConstructor
|
||||||
public class Fence extends BaseEntity {
|
@Builder
|
||||||
|
public class FenceUpdateRequest {
|
||||||
|
|
||||||
@TableId(value = "fence_id", type = IdType.AUTO)
|
|
||||||
/**
|
/**
|
||||||
* 围栏id
|
* 新增电子
|
||||||
*/
|
*/
|
||||||
private Long fenceId;
|
private Long fenceId;
|
||||||
/**
|
/**
|
||||||
* 围栏名称
|
* 新增电子名称
|
||||||
*/
|
*/
|
||||||
private String fenceName;
|
private String fenceName;
|
||||||
/**
|
/**
|
||||||
|
@ -45,36 +44,37 @@ public class Fence extends BaseEntity {
|
||||||
* 围栏状态
|
* 围栏状态
|
||||||
*/
|
*/
|
||||||
private Integer fenceState;
|
private Integer fenceState;
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
private Date createTime;
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
private String createName;
|
private String crateName;
|
||||||
/**
|
/**
|
||||||
* 维护人
|
* 维护人
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private String maintainerName;
|
private String maintainerName;
|
||||||
/**
|
/**
|
||||||
* 告警状态
|
* 报警状态
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Integer alarmStatus;
|
private Integer alarmStatus;
|
||||||
/**
|
|
||||||
* 围栏类型
|
|
||||||
*/
|
|
||||||
private Integer fenceType;
|
|
||||||
|
|
||||||
|
public Integer getIsDelete() {
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelete(Integer isDelete) {
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
package com.couplet.map.common.domin.request;
|
|
||||||
|
|
||||||
import com.couplet.common.core.web.domain.BaseEntity;
|
|
||||||
import com.couplet.map.common.domin.Fence;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: LiJiaYao
|
|
||||||
* @Date: 2024/3/28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class FenceConfig{
|
|
||||||
|
|
||||||
|
|
||||||
private String fenceName;
|
|
||||||
/**
|
|
||||||
* 围栏经纬度
|
|
||||||
*/
|
|
||||||
private String fenceLongitudeLatitude;
|
|
||||||
private Integer pageNum=1;
|
|
||||||
private Integer pageSize=3;
|
|
||||||
|
|
||||||
}
|
|
|
@ -48,6 +48,7 @@
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<!-- Swagger UI -->
|
<!-- Swagger UI -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.springfox</groupId>
|
<groupId>io.springfox</groupId>
|
||||||
|
@ -84,6 +85,10 @@
|
||||||
<groupId>com.couplet</groupId>
|
<groupId>com.couplet</groupId>
|
||||||
<artifactId>couplet-common-swagger</artifactId>
|
<artifactId>couplet-common-swagger</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.couplet</groupId>
|
||||||
|
<artifactId>couplet-common-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,19 @@ package com.couplet.map.server.controller;
|
||||||
|
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.core.web.controller.BaseController;
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
import com.couplet.map.common.domin.Fence;
|
import com.couplet.common.log.annotation.Log;
|
||||||
import com.couplet.map.common.domin.request.FenceConfig;
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import com.couplet.map.common.domain.request.FenceConfig;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
import com.couplet.map.server.service.FenceService;
|
import com.couplet.map.server.service.FenceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.couplet.common.core.utils.PageUtils.startPage;
|
import static com.couplet.common.core.utils.PageUtils.startPage;
|
||||||
|
@ -18,6 +22,7 @@ import static com.couplet.common.core.utils.PageUtils.startPage;
|
||||||
/**
|
/**
|
||||||
* @Author: LiJiaYao
|
* @Author: LiJiaYao
|
||||||
* @Date: 2024/3/28
|
* @Date: 2024/3/28
|
||||||
|
* 电子围栏信息
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fence")
|
@RequestMapping("/fence")
|
||||||
|
@ -29,12 +34,10 @@ public class FenceController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FenceService fenceService;
|
private FenceService fenceService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取围栏列表
|
@Log(title = "电子围栏管理", businessType = BusinessType.OTHER)
|
||||||
* @return
|
@RequiresPermissions("couplet:fence:fenceList")
|
||||||
* @param fenceConfig
|
@PostMapping("/fenceList")
|
||||||
*/
|
|
||||||
@GetMapping("/fenceList")
|
|
||||||
public Result<?> fenceList(@RequestBody FenceConfig fenceConfig){
|
public Result<?> fenceList(@RequestBody FenceConfig fenceConfig){
|
||||||
|
|
||||||
startPage();
|
startPage();
|
||||||
|
@ -42,5 +45,59 @@ public class FenceController extends BaseController {
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏新增
|
||||||
|
* @param fenceRequest
|
||||||
|
* @return
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@PostMapping("/fenceAdd")
|
||||||
|
@RequiresPermissions("couplet:fence:fenceAdd")
|
||||||
|
@Log(title = "电子围栏新增",businessType = BusinessType.INSERT)
|
||||||
|
public Result<?> fenceInsert(HttpServletRequest request, @RequestBody FenceRequest fenceRequest){
|
||||||
|
|
||||||
|
fenceService.fenceInsert(request,fenceRequest);
|
||||||
|
return Result.success("新增成功");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏修改
|
||||||
|
* @param fenceUpdateRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/fenceUpdate")
|
||||||
|
@RequiresPermissions("couplet:fence:fenceUpdate")
|
||||||
|
@Log(title = "电子围栏修改",businessType = BusinessType.UPDATE)
|
||||||
|
public Result<?> fenceUpdate(@Validated @RequestBody FenceUpdateRequest fenceUpdateRequest){
|
||||||
|
|
||||||
|
fenceService.changeFenceStatus(fenceUpdateRequest);
|
||||||
|
return Result.success("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电子围栏删除
|
||||||
|
* @param fenceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{fenceId}")
|
||||||
|
@RequiresPermissions("couplet:fence:fenceDelete")
|
||||||
|
@Log(title = "电子围栏删除",businessType = BusinessType.DELETE)
|
||||||
|
public Result<?> fenceDelete(@PathVariable Long fenceId){
|
||||||
|
boolean b = fenceService.removeById(fenceId);
|
||||||
|
// fenceService.removeByFenceId(fenceId);
|
||||||
|
return toAjax(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/fenceState")
|
||||||
|
@RequiresPermissions("couplet:fence:fenceState")
|
||||||
|
@Log(title = "围栏启用和停用",businessType = BusinessType.OTHER)
|
||||||
|
public Result<?> fenceState(@RequestBody FenceUpdateRequest fenceUpdateRequest){
|
||||||
|
|
||||||
|
fenceService.changeFenceStatus(fenceUpdateRequest);
|
||||||
|
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.couplet.map.server.controller;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
|
import com.couplet.common.log.annotation.Log;
|
||||||
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.map.common.domain.Logo;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
|
import com.couplet.map.server.service.LogoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/29
|
||||||
|
* 标识信息
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/logo")
|
||||||
|
public class LogoController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用服务
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private LogoService logoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标识信息列表
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Log(title = "标识管理", businessType = BusinessType.OTHER)
|
||||||
|
@RequiresPermissions("couplet:fence:fenceList")
|
||||||
|
@PostMapping("/queryByLogo")
|
||||||
|
public Result<?> queryByLogo(){
|
||||||
|
List<Logo> list = logoService.queryByLogo();
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.couplet.map.server.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface FenAndLogoMapper extends BaseMapper<Fence> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量新增
|
||||||
|
* @param fenceId
|
||||||
|
* @param logoIds
|
||||||
|
*/
|
||||||
|
void addBach(@Param("fenceId") Integer fenceId, @Param("logoIds") String[] logoIds);
|
||||||
|
}
|
|
@ -1,13 +1,35 @@
|
||||||
package com.couplet.map.server.mapper;
|
package com.couplet.map.server.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.couplet.map.common.domin.Fence;
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import com.couplet.map.common.domain.request.FenceConfig;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: LiJiaYao
|
* @Author: LiJiaYao
|
||||||
* @Date: 2024/3/28
|
* @Date: 2024/3/28
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FenceMapper extends BaseMapper<Fence> {
|
public interface FenceMapper extends BaseMapper<Fence> {
|
||||||
|
/**
|
||||||
|
* 改变围栏信息
|
||||||
|
* @param fenceUpdateRequest
|
||||||
|
*/
|
||||||
|
void changeFence(FenceUpdateRequest fenceUpdateRequest);
|
||||||
|
|
||||||
|
int insertFence(FenceRequest fenceRequest);
|
||||||
|
|
||||||
|
void removeByFenceId(Long fenceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param fenceConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Fence> pageQuery(FenceConfig fenceConfig);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.couplet.map.server.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import com.couplet.map.common.domain.Logo;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface LogoMapper extends BaseMapper<Logo> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.couplet.map.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
public interface FenAndLogoService extends IService<Fence> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量添加
|
||||||
|
* @param fenceId
|
||||||
|
* @param logoIds
|
||||||
|
*/
|
||||||
|
void addBach(Integer fenceId, String[] logoIds);
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
package com.couplet.map.server.service;
|
package com.couplet.map.server.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.couplet.map.common.domin.Fence;
|
import com.couplet.map.common.domain.Fence;
|
||||||
import com.couplet.map.common.domin.request.FenceConfig;
|
import com.couplet.map.common.domain.request.FenceConfig;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,4 +15,24 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface FenceService extends IService<Fence> {
|
public interface FenceService extends IService<Fence> {
|
||||||
List<Fence> pageQuery(FenceConfig fenceConfig);
|
List<Fence> pageQuery(FenceConfig fenceConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改围栏状态
|
||||||
|
* @param fenceUpdateRequest
|
||||||
|
*/
|
||||||
|
void changeFenceStatus(FenceUpdateRequest fenceUpdateRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增电子围栏
|
||||||
|
*
|
||||||
|
* @param fenceRequest
|
||||||
|
*/
|
||||||
|
void fenceInsert(HttpServletRequest request,FenceRequest fenceRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除电子围栏
|
||||||
|
* @param fenceId
|
||||||
|
*/
|
||||||
|
void removeByFenceId(Long fenceId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.couplet.map.server.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.couplet.map.common.domain.Logo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
public interface LogoService extends IService<Logo> {
|
||||||
|
List<Logo> queryByLogo();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.couplet.map.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import com.couplet.map.server.mapper.FenAndLogoMapper;
|
||||||
|
import com.couplet.map.server.service.FenAndLogoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
* 中间表信息
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FenAndLogoServiceImpl extends ServiceImpl<FenAndLogoMapper, Fence> implements FenAndLogoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用围栏mapper
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private FenAndLogoMapper fenAndLogoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入redis模板
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBach(Integer fenceId, String[] logoIds) {
|
||||||
|
fenAndLogoMapper.addBach(fenceId,logoIds);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,20 @@
|
||||||
package com.couplet.map.server.service.impl;
|
package com.couplet.map.server.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.couplet.map.common.domin.Fence;
|
import com.couplet.map.common.domain.Fence;
|
||||||
import com.couplet.map.common.domin.request.FenceConfig;
|
import com.couplet.map.common.domain.request.FenceConfig;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
import com.couplet.map.server.mapper.FenceMapper;
|
import com.couplet.map.server.mapper.FenceMapper;
|
||||||
|
import com.couplet.map.server.service.FenAndLogoService;
|
||||||
import com.couplet.map.server.service.FenceService;
|
import com.couplet.map.server.service.FenceService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,10 +30,48 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
|
||||||
@Autowired
|
@Autowired
|
||||||
private FenceMapper fenceMapper;
|
private FenceMapper fenceMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用围栏和标识中间表
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private FenAndLogoService fenAndLogoService;
|
||||||
|
/**
|
||||||
|
* 注入redis模板
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Fence> pageQuery(FenceConfig fenceConfig) {
|
public List<Fence> pageQuery(FenceConfig fenceConfig) {
|
||||||
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
List<Fence> list= fenceMapper.pageQuery(fenceConfig);
|
||||||
return this.list(queryWrapper);
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void changeFenceStatus(FenceUpdateRequest fenceUpdateRequest) {
|
||||||
|
|
||||||
|
fenceMapper.changeFence(fenceUpdateRequest);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fenceInsert(HttpServletRequest request,FenceRequest fenceRequest) {
|
||||||
|
|
||||||
|
|
||||||
|
int a= fenceMapper.insertFence(fenceRequest);
|
||||||
|
String[] logoId = fenceRequest.getLogoId();
|
||||||
|
String[] split=null;
|
||||||
|
if (logoId != null && logoId.length> 0){
|
||||||
|
split = logoId[0].split(",");
|
||||||
|
}
|
||||||
|
if (a>0){
|
||||||
|
fenAndLogoService.addBach(fenceRequest.getFenceId(),split);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeByFenceId(Long fenceId) {
|
||||||
|
fenceMapper.removeByFenceId(fenceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.couplet.map.server.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.couplet.map.common.domain.Fence;
|
||||||
|
import com.couplet.map.common.domain.Logo;
|
||||||
|
import com.couplet.map.common.domain.request.FenceRequest;
|
||||||
|
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||||
|
import com.couplet.map.server.mapper.LogoMapper;
|
||||||
|
import com.couplet.map.server.service.LogoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: LiJiaYao
|
||||||
|
* @Date: 2024/3/28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LogoServiceImpl extends ServiceImpl<LogoMapper, Logo> implements LogoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用围栏mapper
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private LogoMapper fenceMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注入redis模板
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Logo> queryByLogo() {
|
||||||
|
LambdaQueryWrapper<Logo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: couplet-electronic-fence
|
name: couplet-electronic-fence
|
||||||
|
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
|
@ -15,11 +16,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?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.couplet.map.server.mapper.FenAndLogoMapper">
|
||||||
|
|
||||||
|
<resultMap id="map" type="com.couplet.map.common.domain.Fence">
|
||||||
|
<id property="fenceId" column="fence_id"/>
|
||||||
|
<result property="fenceName" column="fence_name"/>
|
||||||
|
<result property="fenceDescription" column="fence_description"/>
|
||||||
|
<result property="fenceLongitudeLatitude" column="fence_longitude_latitude"/>
|
||||||
|
<result property="fenceState" column="fence_state"/>
|
||||||
|
<result property="createName" column="create_name" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="isDelete" column="is_delete" />
|
||||||
|
<result property="maintainerName" column="maintainer_name" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="logoMap" type="com.couplet.map.common.domain.Logo">
|
||||||
|
<id property="logoId" column="logo_id"/>
|
||||||
|
<result property="logoName" column="logo_name" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="addBach">
|
||||||
|
INSERT INTO `couplet-cloud`.`couplet_fences_and_logo`
|
||||||
|
(`fences_id`, `logo_id`) VALUES
|
||||||
|
<foreach collection="logoIds" item="logoItemId" separator="," close="(" open=")">
|
||||||
|
(#{fenceId}, #{logoItemId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -4,6 +4,79 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.couplet.map.server.mapper.FenceMapper">
|
<mapper namespace="com.couplet.map.server.mapper.FenceMapper">
|
||||||
|
|
||||||
|
<resultMap id="map" type="com.couplet.map.common.domain.Fence">
|
||||||
|
<id property="fenceId" column="fence_id"/>
|
||||||
|
<result property="fenceName" column="fence_name"/>
|
||||||
|
<result property="fenceDescription" column="fence_description"/>
|
||||||
|
<result property="fenceLongitudeLatitude" column="fence_longitude_latitude"/>
|
||||||
|
<result property="fenceState" column="fence_state"/>
|
||||||
|
<result property="createName" column="create_name" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="isDelete" column="is_delete" />
|
||||||
|
<result property="maintainerName" column="maintainer_name" />
|
||||||
|
</resultMap>
|
||||||
|
<resultMap id="logoMap" type="com.couplet.map.common.domain.Logo">
|
||||||
|
<id property="logoId" column="logo_id"/>
|
||||||
|
<result property="logoName" column="logo_name" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="selectFence">
|
||||||
|
SELECT
|
||||||
|
fence_id,
|
||||||
|
fence_name,
|
||||||
|
fence_longitude_latitude,
|
||||||
|
fence_description,
|
||||||
|
is_delete,
|
||||||
|
fence_state,
|
||||||
|
create_time,
|
||||||
|
update_time,
|
||||||
|
create_name,
|
||||||
|
maintainer_name,
|
||||||
|
alarm_status,
|
||||||
|
l.logo_id,
|
||||||
|
logo_name
|
||||||
|
FROM couplet_fence_info f INNER JOIN couplet_fences_and_logo m on
|
||||||
|
f.fence_id=m.fences_id INNER JOIN couplet_logo_info l on l.logo_id=m.logo_id GROUP BY fence_id
|
||||||
|
</sql>
|
||||||
|
<insert id="insertFence" parameterType="com.couplet.map.common.domain.request.FenceRequest" keyProperty="fenceId"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
|
||||||
|
INSERT INTO `couplet-cloud`.`couplet_fence_info`
|
||||||
|
(`fence_name`, `fence_description`, `is_delete`, `fence_state`, `create_time`,
|
||||||
|
`create_name`, `maintainer_name`, `alarm_status`)
|
||||||
|
VALUES
|
||||||
|
(#{fenceName}, #{fenceDescription}, 0, 0, now(), #{createTime},
|
||||||
|
#{createName}, 0);
|
||||||
|
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="changeFence" parameterType="com.couplet.map.common.domain.request.FenceUpdateRequest">
|
||||||
|
|
||||||
|
UPDATE `couplet-cloud`.`couplet_fence_info`
|
||||||
|
SET `fence_name` = #{fenceName},
|
||||||
|
`fence_longitude_latitude` = #{fenceLongitudeLatitude},
|
||||||
|
`fence_description` = #{fenceDescription},
|
||||||
|
`is_delete` = #{isDelete},
|
||||||
|
`fence_state` = #{fenceState},
|
||||||
|
`update_time` = now(),
|
||||||
|
`maintainer_name` = 'admin',
|
||||||
|
`alarm_status` = #{alarmStatus}
|
||||||
|
WHERE `fence_id` = #{fenceId}
|
||||||
|
|
||||||
|
</update>
|
||||||
|
<delete id="removeByFenceId" parameterType="java.lang.Long">
|
||||||
|
delete from couplet_fence_info where fence_id = #{fenceId}
|
||||||
|
</delete>
|
||||||
|
<select id="pageQuery" resultMap="map"
|
||||||
|
parameterType="com.couplet.map.common.domain.request.FenceConfig">
|
||||||
|
<include refid="selectFence"></include>
|
||||||
|
<where>
|
||||||
|
<if test="fenceName!=null and fenceName!='' ">
|
||||||
|
and fence_name like concat('%',#{fenceName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="fenceState!=null">
|
||||||
|
and fence_state = #{fenceState}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -1,23 +1,92 @@
|
||||||
package com.couplet.server.controller;
|
package com.couplet.server.controller;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import com.couplet.common.core.domain.Result;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import com.couplet.common.log.annotation.Log;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.common.system.domain.SysDept;
|
||||||
|
import com.couplet.server.service.ManageServer;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author fufanrui
|
|
||||||
* @version 1.0
|
|
||||||
* @description: TODO
|
|
||||||
* @date 2024/3/27 15:33
|
|
||||||
*/
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/manage")
|
@RequestMapping("/manage")
|
||||||
public class ManageController {
|
public class ManageController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ManageServer manageServer;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param sysDept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 登入后获取到企业下的所有部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@GetMapping("manageList")
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
public Result<List<SysDept>> manageList() {
|
||||||
|
List<SysDept> sysDepts = manageServer.selectDeptList();
|
||||||
|
return Result.success(sysDepts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param sysDept:
|
||||||
|
* @return Result
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 添加企业中的部门
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:add")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public Result manageInsert(@RequestBody SysDept sysDept) {
|
||||||
|
return manageServer.insertDept(sysDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:edit")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public Result manageEdit(@RequestBody SysDept sysDept) {
|
||||||
|
return manageServer.manageEdit(sysDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:remove")
|
||||||
|
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{deptId}")
|
||||||
|
public Result manageRemove(@PathVariable Long deptId){
|
||||||
|
return manageServer.manageRemove(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||||
|
// public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId) {
|
||||||
|
// return manageServer.getSysDeptByDeptId(deptId);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:query")
|
||||||
|
@GetMapping(value = "/{deptId}")
|
||||||
|
public Result getInfo(@PathVariable Long deptId) {
|
||||||
|
return manageServer.getInfo(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
@GetMapping("/list/exclude/{deptId}")
|
||||||
|
public Result excludeChild(@PathVariable(value = "deptId") Long deptId) {
|
||||||
|
return manageServer.excludeChild(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,23 @@
|
||||||
package com.couplet.server.service;
|
package com.couplet.server.service;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ManageServer {
|
public interface ManageServer {
|
||||||
|
|
||||||
|
|
||||||
|
List<SysDept> selectDeptList();
|
||||||
|
|
||||||
|
Result insertDept(SysDept sysDept);
|
||||||
|
|
||||||
|
Result manageEdit(SysDept sysDept);
|
||||||
|
|
||||||
|
Result manageRemove(Long deptId);
|
||||||
|
|
||||||
|
Result getInfo(Long deptId);
|
||||||
|
|
||||||
|
Result excludeChild(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,72 @@
|
||||||
package com.couplet.server.service.impl;
|
package com.couplet.server.service.impl;
|
||||||
|
|
||||||
|
import com.couplet.common.core.constant.SecurityConstants;
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.utils.StringUtils;
|
||||||
import com.couplet.common.security.utils.SecurityUtils;
|
import com.couplet.common.security.utils.SecurityUtils;
|
||||||
|
import com.couplet.common.system.domain.LoginUser;
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import com.couplet.common.system.remote.RemoteDeptService;
|
import com.couplet.common.system.remote.RemoteDeptService;
|
||||||
|
import com.couplet.common.system.remote.RemoteUserService;
|
||||||
import com.couplet.server.service.ManageServer;
|
import com.couplet.server.service.ManageServer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fufanrui
|
* @author fufanrui
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @description: TODO
|
* @description: 管理企业业务层
|
||||||
* @date 2024/3/27 15:34
|
* @date 2024/3/27 15:34
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ManageServiceImpl implements ManageServer {
|
public class ManageServiceImpl implements ManageServer{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteDeptService remoteDeptService;
|
private RemoteDeptService remoteDeptService;
|
||||||
{
|
@Autowired
|
||||||
Long enterpriseId = SecurityUtils.getEnterpriseId();
|
private RemoteUserService remoteUserService;
|
||||||
Result<SysDept> sysDeptByEnterpriseId = remoteDeptService.getSysDeptByEnterpriseId(enterpriseId);
|
|
||||||
if (sysDeptByEnterpriseId.getCode() == 200){
|
@Override
|
||||||
SysDept sysDept = sysDeptByEnterpriseId.getData();
|
public List<SysDept> selectDeptList() {
|
||||||
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
String username = loginUser.getUsername();
|
||||||
|
Result<LoginUser> userInfo = remoteUserService.getUserInfo(username, SecurityConstants.FROM_SOURCE);
|
||||||
|
LoginUser user = userInfo.getData();
|
||||||
|
Long deptId = user.getDeptId();
|
||||||
|
Result<List<SysDept>> sysDeptByDeptId = remoteDeptService.getSysDeptByDeptId(deptId);
|
||||||
|
List<SysDept> dept = sysDeptByDeptId.getData();
|
||||||
|
return dept;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result insertDept(SysDept sysDept) {
|
||||||
|
|
||||||
|
return remoteDeptService.add(sysDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result manageEdit(SysDept sysDept) {
|
||||||
|
return remoteDeptService.edit(sysDept);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result manageRemove(Long deptId) {
|
||||||
|
return remoteDeptService.remove(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result getInfo(Long deptId) {
|
||||||
|
return remoteDeptService.getInfo(deptId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result excludeChild(Long deptId) {
|
||||||
|
return remoteDeptService.excludeChild(deptId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c159
|
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<version>3.6.3</version>
|
<version>3.6.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>couplet-modules-mqtt</artifactId>
|
<artifactId>couplet-modules-mq</artifactId>
|
||||||
|
|
||||||
<!-- <properties>-->
|
<!-- <properties>-->
|
||||||
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<!-- </properties>-->
|
<!-- </properties>-->
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
couplet-modules-mqttx获取报文模块
|
couplet-modules-mq MQ模块
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -91,6 +91,11 @@
|
||||||
<version>1.2.5</version>
|
<version>1.2.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RabbitMQ依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
|
@ -1,4 +1,4 @@
|
||||||
package com.couplet.mqtt;
|
package com.couplet.mq;
|
||||||
|
|
||||||
import com.couplet.common.security.annotation.EnableCustomConfig;
|
import com.couplet.common.security.annotation.EnableCustomConfig;
|
||||||
import com.couplet.common.security.annotation.EnableMyFeignClients;
|
import com.couplet.common.security.annotation.EnableMyFeignClients;
|
||||||
|
@ -10,15 +10,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @ProjectName: Default (Template) Project
|
* @ProjectName: Default (Template) Project
|
||||||
* @Author: LiuYunHu
|
* @Author: LiuYunHu
|
||||||
* @CreateTime: 2024/3/28
|
* @CreateTime: 2024/3/28
|
||||||
* @Description: 获取报文模块启动类
|
* @Description: rabbitMq模块启动类
|
||||||
*/
|
*/
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableMyFeignClients
|
@EnableMyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class CoupletMqttxApplatcaion {
|
public class CoupletMqApplatcaion {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(CoupletMqttxApplatcaion.class, args);
|
SpringApplication.run(CoupletMqApplatcaion.class, args);
|
||||||
System.out.println("获取报文模块启动成功");
|
System.out.println("获取报文、RabbitMQ模块启动成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,149 @@
|
||||||
|
package com.couplet.mq.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/29
|
||||||
|
* @Description: rabbitMQ配置类
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
public class RabbitMQConfig implements RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnsCallback {
|
||||||
|
// 通过注入的方式获取队列名、交换机名和路由键
|
||||||
|
//队列名
|
||||||
|
@Value("${mq.queueName}")
|
||||||
|
public String queueName;
|
||||||
|
|
||||||
|
//交换机
|
||||||
|
@Value("${mq.exchangeName}")
|
||||||
|
public String exchangeName;
|
||||||
|
|
||||||
|
//路由键
|
||||||
|
@Value(("${mq.routingKey}"))
|
||||||
|
public String routingKey;
|
||||||
|
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:25
|
||||||
|
* @Description: 创建并返回一个消息转换器,用于转换消息体。
|
||||||
|
* @Param: []
|
||||||
|
* @Return: 返回一个Jackson2JsonMessageConverter实例,用于JSON格式的消息转换。
|
||||||
|
**/
|
||||||
|
@Bean
|
||||||
|
public MessageConverter messageConverter() {
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:26
|
||||||
|
* @Description: 创建并返回一个持久化的队列。
|
||||||
|
* @Param: []
|
||||||
|
* @Return: 返回一个配置好的Queue实例。
|
||||||
|
**/
|
||||||
|
@Bean
|
||||||
|
public Queue queue() {
|
||||||
|
return new Queue(queueName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:26
|
||||||
|
* @Description: 创建并返回一个直连交换机。
|
||||||
|
* @Param: []
|
||||||
|
* @Return: 返回一个配置好的DirectExchange实例。
|
||||||
|
**/
|
||||||
|
@Bean("exchange")
|
||||||
|
public DirectExchange directExchange() {
|
||||||
|
return new DirectExchange(exchangeName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:27
|
||||||
|
* @Description: 配置并返回RabbitTemplate实例,用于发送消息。
|
||||||
|
* @Param: connectionFactory RabbitMQ连接工厂。
|
||||||
|
* @Return: 配置好的RabbitTemplate实例。
|
||||||
|
**/
|
||||||
|
@Primary
|
||||||
|
@Bean
|
||||||
|
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
|
||||||
|
RabbitTemplate rabbitTempalte = new RabbitTemplate(connectionFactory);
|
||||||
|
this.rabbitTemplate = rabbitTempalte;
|
||||||
|
rabbitTempalte.setMessageConverter(messageConverter());
|
||||||
|
rabbitTempalte();
|
||||||
|
|
||||||
|
return rabbitTempalte;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:27
|
||||||
|
* @Description: 配置RabbitTemplate的回调函数。
|
||||||
|
* @Param: []
|
||||||
|
* @Return: void
|
||||||
|
**/
|
||||||
|
public void rabbitTempalte() {
|
||||||
|
rabbitTemplate.setConfirmCallback(this);
|
||||||
|
rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:27
|
||||||
|
* @Description: 创建并返回一个绑定,将队列与交换机绑定,并指定路由键
|
||||||
|
* @Param: []
|
||||||
|
* @Return: 返回一个配置好的Binding实例
|
||||||
|
**/
|
||||||
|
@Bean
|
||||||
|
public Binding binding() {
|
||||||
|
return BindingBuilder.bind(queue()).to(directExchange()).with(routingKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:28
|
||||||
|
* @Description: 消息确认回调函数。
|
||||||
|
* 当消息被交换机成功处理后调用,或当消息未能被正确处理时调用。
|
||||||
|
* @Param: correlationData 关联数据,用于追踪消息
|
||||||
|
* @Param: ack 消息是否被成功处理
|
||||||
|
* @Param: s 附加信息
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean ack, String s) {
|
||||||
|
if (ack) {
|
||||||
|
log.info("{}消息到达交换机", correlationData.getId());
|
||||||
|
} else {
|
||||||
|
log.error("{}消息丢失", correlationData.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/29 21:29
|
||||||
|
* @Description: 消息返回回调函数。
|
||||||
|
* 当消息未能被正确路由到队列时调用
|
||||||
|
* @Param: returnedMessage 被返回的消息
|
||||||
|
* @Return: void
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
log.error("{}消息未到达队列", returnedMessage.getMessage().getMessageProperties().getMessageId());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.couplet.mq.controller;
|
||||||
|
|
||||||
|
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||||
|
import com.couplet.mq.config.RabbitMQConfig;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/29
|
||||||
|
* @Description: MQController类
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mq")
|
||||||
|
@Slf4j
|
||||||
|
public class MqController {
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@GetMapping("/receive/{data}")
|
||||||
|
public void receive(@PathVariable("data") String data) {
|
||||||
|
//创建配置类对象,用于获取配置值
|
||||||
|
RabbitMQConfig config = new RabbitMQConfig();
|
||||||
|
|
||||||
|
rabbitTemplate.convertAndSend(config.exchangeName, config.routingKey, data , message -> {
|
||||||
|
message.getMessageProperties().setMessageId(IdUtils.randomUUID());
|
||||||
|
return message;
|
||||||
|
}, new CorrelationData(IdUtils.randomUUID()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.couplet.mq.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/29
|
||||||
|
* @Description: 测试 参数类
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Test implements Serializable {
|
||||||
|
public String data;
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.couplet.mq.service;
|
||||||
|
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/28
|
||||||
|
* @Description: MQ消费者类
|
||||||
|
*/
|
||||||
|
@RabbitListener(queues = "${mq.queueName}")
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class Consumer {
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
public void receive(String data, Channel channel, Message message) throws IOException {
|
||||||
|
log.info("消费者接受到数据:{}", data);
|
||||||
|
|
||||||
|
//获取信息的标记
|
||||||
|
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||||
|
|
||||||
|
//获取到消息的id
|
||||||
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
|
|
||||||
|
Long add = redisTemplate.opsForSet().add("set:" + messageId, "set:" + messageId);
|
||||||
|
|
||||||
|
if (!redisTemplate.hasKey("value:" + messageId)) {
|
||||||
|
redisTemplate.opsForValue().set("value:" + messageId, String.valueOf(deliveryTag), 10, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (add == 1) {
|
||||||
|
log.info("---------------消费者开始消费---------------");
|
||||||
|
|
||||||
|
System.out.println(data);
|
||||||
|
|
||||||
|
log.info("---------------消费者结束消费---------------");
|
||||||
|
}else {
|
||||||
|
log.error("重复消费!");
|
||||||
|
channel.basicReject(deliveryTag, false);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
String s = redisTemplate.opsForValue().get("value:" + messageId);
|
||||||
|
long oldTag = Long.parseLong(s);
|
||||||
|
|
||||||
|
if ((oldTag + 2) != deliveryTag) {
|
||||||
|
log.info("重新入队!");
|
||||||
|
channel.basicNack(deliveryTag, false, true);
|
||||||
|
}else {
|
||||||
|
log.error("三次无法消费,不再入队!");
|
||||||
|
channel.basicNack(deliveryTag, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.couplet.mqtt.service.impl;
|
package com.couplet.mq.service;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.eclipse.paho.client.mqttv3.*;
|
import org.eclipse.paho.client.mqttv3.*;
|
|
@ -6,7 +6,7 @@ server:
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: couplet-mqtt
|
name: couplet-mq
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
|
@ -40,3 +40,9 @@ mqtt:
|
||||||
clientid: mqttx
|
clientid: mqttx
|
||||||
qos: 0
|
qos: 0
|
||||||
topic: test
|
topic: test
|
||||||
|
|
||||||
|
# RabbitMQ配置
|
||||||
|
mq:
|
||||||
|
queueName: queue
|
||||||
|
exchangeName: exchange
|
||||||
|
routingKey: routingKey
|
|
@ -1,15 +0,0 @@
|
||||||
package com.couplet.mqtt.mapper;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ProjectName: five-groups-couplet
|
|
||||||
* @Author: LiuYunHu
|
|
||||||
* @CreateTime: 2024/3/28
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Mapper
|
|
||||||
public interface MqttMapper {
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.couplet.mqtt.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ProjectName: five-groups-couplet
|
|
||||||
* @Author: LiuYunHu
|
|
||||||
* @CreateTime: 2024/3/28
|
|
||||||
* @Description: MQTT服务接口
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface MqttService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.couplet.mqtt.service.impl;
|
|
||||||
|
|
||||||
import com.couplet.mqtt.service.MqttService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ProjectName: five-groups-couplet
|
|
||||||
* @Author: LiuYunHu
|
|
||||||
* @CreateTime: 2024/3/28
|
|
||||||
* @Description: MQTT服务实现类
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
public class MqttServiceImpl implements MqttService {
|
|
||||||
}
|
|
|
@ -4,7 +4,8 @@ import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.core.web.controller.BaseController;
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
import com.couplet.common.log.annotation.Log;
|
import com.couplet.common.log.annotation.Log;
|
||||||
import com.couplet.common.log.enums.BusinessType;
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
import com.couplet.vehicle.domain.LyhVehicle;
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.vehicle.domain.Vehicle;
|
||||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||||
|
@ -34,11 +35,12 @@ public class VehicleController extends BaseController {
|
||||||
* @Param: [listParams]
|
* @Param: [listParams]
|
||||||
* @Return: com.couplet.common.core.domain.Result
|
* @Return: com.couplet.common.core.domain.Result
|
||||||
**/
|
**/
|
||||||
|
@RequiresPermissions("couplet:vehicle:list")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@Log(title = "车辆列表")
|
@Log(title = "车辆列表")
|
||||||
public Result list(@RequestBody VehicleListParams listParams) {
|
public Result list(@RequestBody VehicleListParams listParams) {
|
||||||
|
|
||||||
List<LyhVehicle> List = vehicleService.list(listParams);
|
List<Vehicle> List = vehicleService.list(listParams);
|
||||||
|
|
||||||
return Result.success(List);
|
return Result.success(List);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +52,7 @@ public class VehicleController extends BaseController {
|
||||||
* @Param: [vehicleId]
|
* @Param: [vehicleId]
|
||||||
* @Return: com.couplet.common.core.domain.Result
|
* @Return: com.couplet.common.core.domain.Result
|
||||||
**/
|
**/
|
||||||
|
@RequiresPermissions("couplet:vehicle:deleteById")
|
||||||
@GetMapping("/deleteById/{vehicleId}")
|
@GetMapping("/deleteById/{vehicleId}")
|
||||||
@Log(title = "删除车辆", businessType = BusinessType.DELETE)
|
@Log(title = "删除车辆", businessType = BusinessType.DELETE)
|
||||||
public Result deleteById(@PathVariable Long vehicleId) {
|
public Result deleteById(@PathVariable Long vehicleId) {
|
||||||
|
@ -66,6 +69,7 @@ public class VehicleController extends BaseController {
|
||||||
* @Param: [editParams]
|
* @Param: [editParams]
|
||||||
* @Return: com.couplet.common.core.domain.Result
|
* @Return: com.couplet.common.core.domain.Result
|
||||||
**/
|
**/
|
||||||
|
@RequiresPermissions("couplet:vehicle:editById")
|
||||||
@PostMapping("/editById")
|
@PostMapping("/editById")
|
||||||
@Log(title = "编辑车辆", businessType = BusinessType.UPDATE)
|
@Log(title = "编辑车辆", businessType = BusinessType.UPDATE)
|
||||||
public Result editById(@RequestBody VehicleEditParams editParams) {
|
public Result editById(@RequestBody VehicleEditParams editParams) {
|
||||||
|
@ -82,6 +86,7 @@ public class VehicleController extends BaseController {
|
||||||
* @Param: [insertParams]
|
* @Param: [insertParams]
|
||||||
* @Return: com.couplet.common.core.domain.Result
|
* @Return: com.couplet.common.core.domain.Result
|
||||||
**/
|
**/
|
||||||
|
@RequiresPermissions("couplet:vehicle:insert")
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
@Log(title = "新增车辆", businessType = BusinessType.INSERT)
|
@Log(title = "新增车辆", businessType = BusinessType.INSERT)
|
||||||
public Result insert(@RequestBody @Validated VehicleInsertParams insertParams) {
|
public Result insert(@RequestBody @Validated VehicleInsertParams insertParams) {
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.couplet.vehicle.controller;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
|
import com.couplet.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.couplet.vehicle.domain.VehicleType;
|
||||||
|
import com.couplet.vehicle.service.VehicleTypeService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/31
|
||||||
|
* @Description: 车辆类型控制器
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/vehicleType")
|
||||||
|
public class VehicleTypeController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private VehicleTypeService service;
|
||||||
|
|
||||||
|
//获取所有的车辆类型
|
||||||
|
@RequiresPermissions("couplet:vehicle:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<List<VehicleType>> list() {
|
||||||
|
List<VehicleType> vehicleTypeList = service.list();
|
||||||
|
return success(vehicleTypeList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,8 +20,8 @@ import lombok.experimental.SuperBuilder;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@TableName("lyh_vehicle")
|
@TableName("couplet_vehicle")
|
||||||
public class LyhVehicle {
|
public class Vehicle {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*车辆id
|
*车辆id
|
||||||
|
@ -33,7 +33,13 @@ public class LyhVehicle {
|
||||||
*车辆类型
|
*车辆类型
|
||||||
* */
|
* */
|
||||||
@TableField(value = "vehicle_type")
|
@TableField(value = "vehicle_type")
|
||||||
private Integer vehicleType;
|
private Long vehicleType;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 车辆类型名称
|
||||||
|
* */
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String vehicleTypeName;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.couplet.vehicle.domain;
|
||||||
|
|
||||||
|
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 lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/30
|
||||||
|
* @Description: 车辆和标志中间表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("couplet_vehicle_and_logo")
|
||||||
|
public class VehicleAndLogo {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 车辆、标志中间表id
|
||||||
|
* */
|
||||||
|
@TableId(type = IdType.AUTO, value = "vehicle_logo_middle_id")
|
||||||
|
private Long vehicleLogoMiddleId;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 车辆id
|
||||||
|
* */
|
||||||
|
@TableField("vehicle_id")
|
||||||
|
private Long vehicleId;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 标志id
|
||||||
|
* */
|
||||||
|
@TableField("logo_id")
|
||||||
|
private Long logoId;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.couplet.vehicle.domain;
|
||||||
|
|
||||||
|
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 lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/31
|
||||||
|
* @Description: 车辆类型
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("couplet_vehicle_type")
|
||||||
|
public class VehicleType {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 车辆类型id
|
||||||
|
* */
|
||||||
|
@TableId(type = IdType.AUTO, value = "vehicle_type_id")
|
||||||
|
private Long vehicleTypeId;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 车辆类型名称
|
||||||
|
* */
|
||||||
|
@TableField(value = "vehicle_type_name")
|
||||||
|
private String vehicleTypeName;
|
||||||
|
}
|
|
@ -5,6 +5,9 @@ import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ProjectName: five-groups-couplet
|
* @ProjectName: five-groups-couplet
|
||||||
* @Author: LiuYunHu
|
* @Author: LiuYunHu
|
||||||
|
@ -20,11 +23,13 @@ public class VehicleEditParams {
|
||||||
/*
|
/*
|
||||||
*车辆id
|
*车辆id
|
||||||
* */
|
* */
|
||||||
|
@NotNull(message = "车辆id不能为空")
|
||||||
private Long vehicleId;
|
private Long vehicleId;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*车辆类型
|
*车辆类型
|
||||||
* */
|
* */
|
||||||
|
@NotNull(message="车辆类型不能为空")
|
||||||
private Integer vehicleType;
|
private Integer vehicleType;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ProjectName: five-groups-couplet
|
* @ProjectName: five-groups-couplet
|
||||||
|
@ -25,7 +27,7 @@ public class VehicleInsertParams {
|
||||||
*车辆类型
|
*车辆类型
|
||||||
* */
|
* */
|
||||||
@NotNull(message = "车辆类型不能为空")
|
@NotNull(message = "车辆类型不能为空")
|
||||||
private Integer vehicleType;
|
private Long vehicleType;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,4 +54,10 @@ public class VehicleInsertParams {
|
||||||
@NotBlank(message = "电池编号不能为空")
|
@NotBlank(message = "电池编号不能为空")
|
||||||
private String batteryNumber;
|
private String batteryNumber;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 一辆车可以绑定多个标识
|
||||||
|
* */
|
||||||
|
@Size(min = 1, message = "车辆至少绑定一个标识")
|
||||||
|
private List<Long> logoIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.couplet.vehicle.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/29
|
||||||
|
* @Description: 车辆异常响应
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VehicleException extends RuntimeException {
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public VehicleException(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VehicleException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VehicleException() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.couplet.vehicle.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.couplet.vehicle.domain.VehicleAndLogo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/26
|
||||||
|
* @Description: 车辆与标志Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Component
|
||||||
|
public interface VehicleAndLogoMapper extends BaseMapper<VehicleAndLogo> {
|
||||||
|
int vehicleBindLogo(@Param("vehicleId") Long vehicleId, @Param("logoIds") List<Long> logoIds);
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package com.couplet.vehicle.mapper;
|
package com.couplet.vehicle.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.couplet.vehicle.domain.LyhVehicle;
|
import com.couplet.vehicle.domain.Vehicle;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -13,5 +13,5 @@ import org.springframework.stereotype.Component;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
@Component
|
@Component
|
||||||
public interface VehicleMapper extends BaseMapper<LyhVehicle> {
|
public interface VehicleMapper extends BaseMapper<Vehicle> {
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.couplet.vehicle.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.couplet.vehicle.domain.Vehicle;
|
||||||
|
import com.couplet.vehicle.domain.VehicleType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/26
|
||||||
|
* @Description: 车辆类型Mapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
@Component
|
||||||
|
public interface VehicleTypeMapper extends BaseMapper<VehicleType> {
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.couplet.vehicle.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.couplet.vehicle.domain.VehicleAndLogo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/30
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface VehicleAndLogoService extends IService<VehicleAndLogo> {
|
||||||
|
int vehicleBindLogo(Long vehicleId, List<Long> logoIds);
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package com.couplet.vehicle.service;
|
package com.couplet.vehicle.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.couplet.vehicle.domain.LyhVehicle;
|
import com.couplet.vehicle.domain.Vehicle;
|
||||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||||
|
@ -15,8 +15,8 @@ import java.util.List;
|
||||||
* @Description: 车辆服务
|
* @Description: 车辆服务
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface VehicleService extends IService<LyhVehicle> {
|
public interface VehicleService extends IService<Vehicle> {
|
||||||
List<LyhVehicle> list(VehicleListParams listParams);
|
List<Vehicle> list(VehicleListParams listParams);
|
||||||
|
|
||||||
String deleteById(Long vehicleId);
|
String deleteById(Long vehicleId);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.couplet.vehicle.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.couplet.vehicle.domain.VehicleType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/31
|
||||||
|
* @Description: 车辆类型服务层
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface VehicleTypeService extends IService<VehicleType> {
|
||||||
|
List<VehicleType> list();
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.couplet.vehicle.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.couplet.vehicle.domain.VehicleAndLogo;
|
||||||
|
import com.couplet.vehicle.mapper.VehicleAndLogoMapper;
|
||||||
|
import com.couplet.vehicle.service.VehicleAndLogoService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/30
|
||||||
|
* @Description: 车辆和标识关联
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class VehicleAndLogoServiceImpl extends ServiceImpl<VehicleAndLogoMapper, VehicleAndLogo> implements VehicleAndLogoService {
|
||||||
|
|
||||||
|
//注入mapper
|
||||||
|
@Autowired
|
||||||
|
private VehicleAndLogoMapper mapper;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/30 11:51
|
||||||
|
* @Description: 车辆绑定标志
|
||||||
|
* @Param: [vehicleId, logoIds]
|
||||||
|
* @Return: int
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public int vehicleBindLogo(Long vehicleId, List<Long> logoIds) {
|
||||||
|
|
||||||
|
return mapper.vehicleBindLogo(vehicleId, logoIds);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,12 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.couplet.common.core.utils.StringUtils;
|
import com.couplet.common.core.utils.StringUtils;
|
||||||
import com.couplet.vehicle.domain.LyhVehicle;
|
import com.couplet.vehicle.domain.Vehicle;
|
||||||
|
import com.couplet.vehicle.domain.VehicleType;
|
||||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||||
|
import com.couplet.vehicle.exception.VehicleException;
|
||||||
import com.couplet.vehicle.mapper.VehicleMapper;
|
import com.couplet.vehicle.mapper.VehicleMapper;
|
||||||
|
import com.couplet.vehicle.service.VehicleAndLogoService;
|
||||||
import com.couplet.vehicle.service.VehicleService;
|
import com.couplet.vehicle.service.VehicleService;
|
||||||
|
import com.couplet.vehicle.service.VehicleTypeService;
|
||||||
import com.couplet.vehicle.utils.SnowflakeIdGenerator;
|
import com.couplet.vehicle.utils.SnowflakeIdGenerator;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -26,10 +30,19 @@ import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> implements VehicleService {
|
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, Vehicle> implements VehicleService {
|
||||||
|
//车辆mapper
|
||||||
@Autowired
|
@Autowired
|
||||||
private VehicleMapper vehicleMapper;
|
private VehicleMapper vehicleMapper;
|
||||||
|
|
||||||
|
//车辆类型服务
|
||||||
|
@Autowired
|
||||||
|
private VehicleTypeService vehicleTypeService;
|
||||||
|
|
||||||
|
//车辆与标志关联 的mapper
|
||||||
|
@Autowired
|
||||||
|
private VehicleAndLogoService vehicleAndLogoService;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Author: LiuYunHu
|
* @Author: LiuYunHu
|
||||||
* @Date: 2024/3/26 22:11
|
* @Date: 2024/3/26 22:11
|
||||||
|
@ -38,25 +51,40 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
* @Return: java.util.List<com.couplet.vehicle.domain.LyhVehicle>
|
* @Return: java.util.List<com.couplet.vehicle.domain.LyhVehicle>
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public List<LyhVehicle> list(VehicleListParams listParams) {
|
public List<Vehicle> list(VehicleListParams listParams) {
|
||||||
// 创建查询条件包装器
|
// 创建查询条件包装器
|
||||||
LambdaQueryWrapper<LyhVehicle> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Vehicle> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
// 如果车辆类型不为空,添加车辆类型作为查询条件
|
// 如果车辆类型不为空,添加车辆类型作为查询条件
|
||||||
if (!StringUtils.isNull(listParams.getVehicleType())) {
|
if (!StringUtils.isNull(listParams.getVehicleType())) {
|
||||||
queryWrapper.eq(LyhVehicle::getVehicleType, listParams.getVehicleType());
|
queryWrapper.eq(Vehicle::getVehicleType, listParams.getVehicleType());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果车辆状态不为空,添加车辆状态作为查询条件
|
// 如果车辆状态不为空,添加车辆状态作为查询条件
|
||||||
if (!StringUtils.isNull(listParams.getVehicleState())) {
|
if (!StringUtils.isNull(listParams.getVehicleState())) {
|
||||||
queryWrapper.eq(LyhVehicle::getVehicleState, listParams.getVehicleState());
|
queryWrapper.eq(Vehicle::getVehicleState, listParams.getVehicleState());
|
||||||
}
|
}
|
||||||
|
|
||||||
//只查询车辆未被删除的
|
//只查询车辆未被删除的
|
||||||
queryWrapper.eq(LyhVehicle::getIsdelete, 0);
|
queryWrapper.eq(Vehicle::getIsdelete, 0);
|
||||||
|
|
||||||
// 执行查询并返回结果
|
// 执行查询
|
||||||
return this.list(queryWrapper);
|
List<Vehicle> list = this.list(queryWrapper);
|
||||||
|
|
||||||
|
//调用服务,得到车辆类型
|
||||||
|
List<VehicleType> vehicleTypes = vehicleTypeService.list();
|
||||||
|
|
||||||
|
//将类型id一样的记录 名称进行赋值
|
||||||
|
list.forEach(vehicle -> {
|
||||||
|
vehicleTypes.forEach(vehicleType -> {
|
||||||
|
if (vehicle.getVehicleType() == vehicleType.getVehicleTypeId()) {
|
||||||
|
vehicle.setVehicleTypeName(vehicleType.getVehicleTypeName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -70,7 +98,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
public String deleteById(Long vehicleId) {
|
public String deleteById(Long vehicleId) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
UpdateWrapper<LyhVehicle> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<Vehicle> updateWrapper = new UpdateWrapper<>();
|
||||||
|
|
||||||
updateWrapper.set("isdelete", 1)
|
updateWrapper.set("isdelete", 1)
|
||||||
.eq("vehicle_id", vehicleId);
|
.eq("vehicle_id", vehicleId);
|
||||||
|
@ -79,7 +107,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
|
|
||||||
if (!update) {
|
if (!update) {
|
||||||
result = "删除失败";
|
result = "删除失败";
|
||||||
throw new RuntimeException(result);
|
throw new VehicleException(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = "删除成功!";
|
result = "删除成功!";
|
||||||
|
@ -98,7 +126,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
public String editById(VehicleEditParams editParams) {
|
public String editById(VehicleEditParams editParams) {
|
||||||
String result = "";
|
String result = "";
|
||||||
|
|
||||||
UpdateWrapper<LyhVehicle> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<Vehicle> updateWrapper = new UpdateWrapper<>();
|
||||||
|
|
||||||
//编辑车辆类型
|
//编辑车辆类型
|
||||||
|
|
||||||
|
@ -124,7 +152,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
|
|
||||||
if (!update) {
|
if (!update) {
|
||||||
result = "编辑失败";
|
result = "编辑失败";
|
||||||
throw new RuntimeException(result);
|
throw new VehicleException(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = "编辑成功!";
|
result = "编辑成功!";
|
||||||
|
@ -148,14 +176,33 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
||||||
long randomId = idGenerator.nextId();
|
long randomId = idGenerator.nextId();
|
||||||
String vin = "VIN" + randomId;
|
String vin = "VIN" + randomId;
|
||||||
|
|
||||||
|
|
||||||
|
//创建入参对象
|
||||||
|
Vehicle vehicle = new Vehicle();
|
||||||
|
|
||||||
|
vehicle.setVehicleType(insertParams.getVehicleType());
|
||||||
|
vehicle.setMotorManufacturer(insertParams.getMotorManufacturer());
|
||||||
|
vehicle.setBatteryManufacturer(insertParams.getBatteryManufacturer());
|
||||||
|
vehicle.setMotorNumber(insertParams.getMotorNumber());
|
||||||
|
vehicle.setBatteryNumber(insertParams.getBatteryNumber());
|
||||||
|
vehicle.setVin(vin);
|
||||||
|
vehicle.setVehicleState(0);
|
||||||
|
vehicle.setIsdelete(0);
|
||||||
|
|
||||||
|
|
||||||
//执行插入操作
|
//执行插入操作
|
||||||
int insert = vehicleMapper.insert(new LyhVehicle(null, insertParams.getVehicleType(), insertParams.getMotorManufacturer(), insertParams.getBatteryManufacturer(), insertParams.getMotorNumber(), insertParams.getBatteryNumber(), vin, 0, 0));
|
int insert = vehicleMapper.insert(vehicle);
|
||||||
|
|
||||||
if (insert == 0) {
|
if (insert == 0) {
|
||||||
result = "新增失败";
|
result = "新增失败";
|
||||||
throw new RuntimeException(result);
|
throw new VehicleException(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取新增的车辆id值
|
||||||
|
//执行添加电子围栏
|
||||||
|
int i = vehicleAndLogoService.vehicleBindLogo(vehicle.getVehicleId(), insertParams.getLogoIds());
|
||||||
|
|
||||||
|
|
||||||
result = "新增成功!";
|
result = "新增成功!";
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.couplet.vehicle.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.couplet.vehicle.domain.VehicleType;
|
||||||
|
import com.couplet.vehicle.mapper.VehicleTypeMapper;
|
||||||
|
import com.couplet.vehicle.service.VehicleTypeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName: five-groups-couplet
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @CreateTime: 2024/3/31
|
||||||
|
* @Description: 车辆类型服务实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class VehicleTypeServiceImpl extends ServiceImpl<VehicleTypeMapper, VehicleType> implements VehicleTypeService {
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @Author: LiuYunHu
|
||||||
|
* @Date: 2024/3/31 10:17
|
||||||
|
* @Description: 获取所有的车辆类型
|
||||||
|
* @Param: []
|
||||||
|
* @Return: java.util.List<com.couplet.vehicle.domain.VehicleType>
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public List<VehicleType> list() {
|
||||||
|
LambdaQueryWrapper<VehicleType> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +1,6 @@
|
||||||
Spring Boot Version: ${spring-boot.version}
|
Spring Boot Version: ${spring-boot.version}
|
||||||
Spring Application Name: ${spring.application.name}
|
Spring Application Name: ${spring.application.name}
|
||||||
|
_ _ ____ _ _ ____ ___ __ ____
|
||||||
|
( \/ )( ___)( )_( )(_ _) / __)( ) ( ___)
|
||||||
|
\ / )__) ) _ ( _)(_ ( (__ )(__ )__)
|
||||||
|
\/ (____)(_) (_)(____) \___)(____)(____)
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?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.couplet.vehicle.mapper.VehicleAndLogoMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="vehicleBindLogo">
|
||||||
|
INSERT INTO `couplet_vehicle_and_logo` ( `vehicle_id`, `logo_id`)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="logoIds" item="logoId" separator=",">
|
||||||
|
(#{vehicleId},#{logoId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
</mapper>
|
|
@ -2,7 +2,7 @@
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.couplet.mqtt.mapper.MqttMapper">
|
<mapper namespace="com.couplet.vehicle.mapper.VehicleTypeMapper">
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -11,6 +11,7 @@ import com.couplet.common.security.utils.SecurityUtils;
|
||||||
import com.couplet.common.system.domain.SysDept;
|
import com.couplet.common.system.domain.SysDept;
|
||||||
import com.couplet.system.service.SysDeptService;
|
import com.couplet.system.service.SysDeptService;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.apache.commons.math3.analysis.solvers.BrentSolver;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -110,12 +111,13 @@ public class SysDeptController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
* @param enterpriseId 企业ID
|
* @param deptId 企业ID
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getSysDeptByEnterpriseId/{enterpriseId}")
|
@GetMapping("/getSysDeptByDeptId/{deptId}")
|
||||||
public Result<SysDept> getSysDeptByEnterpriseId(@PathVariable(value = "enterpriseId") Long enterpriseId){
|
public Result<List<SysDept>> getSysDeptByDeptId(@PathVariable(value = "deptId") Long deptId){
|
||||||
SysDept sysDept = deptService.getSysDeptByEnterpriseId(enterpriseId);
|
List<SysDept> sysDept = deptService.getSysDeptByDeptId(deptId);
|
||||||
return Result.success(sysDept);
|
Result<List<SysDept>> success = Result.success(sysDept);
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,9 @@ package com.couplet.system.controller;
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.system.domain.SysFirm;
|
import com.couplet.common.system.domain.SysFirm;
|
||||||
import com.couplet.system.service.SysFirmService;
|
import com.couplet.system.service.SysFirmService;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -61,4 +59,17 @@ public class SysFirmController {
|
||||||
Result<Integer> result = Result.success(i);
|
Result<Integer> result = Result.success(i);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description // 删除企业 附属的员工一并删除
|
||||||
|
* @Date 2024/3/29
|
||||||
|
* @param deptId
|
||||||
|
* @return com.couplet.common.core.domain.Result
|
||||||
|
**/
|
||||||
|
@DeleteMapping("delFirm/{deptId}")
|
||||||
|
public Result delFirm(@PathVariable Integer deptId){
|
||||||
|
int i = sysFirmService.delFirm(deptId);
|
||||||
|
Result<Integer> success = Result.success(i);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,6 @@ public class SysUserController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取当前用户信息
|
* 获取当前用户信息
|
||||||
*/
|
*/
|
||||||
@InnerAuth
|
|
||||||
@GetMapping("/info/{username}")
|
@GetMapping("/info/{username}")
|
||||||
public Result<LoginUser> info (@PathVariable("username") String username) {
|
public Result<LoginUser> info (@PathVariable("username") String username) {
|
||||||
SysUser sysUser = userService.selectUserByUserName(username);
|
SysUser sysUser = userService.selectUserByUserName(username);
|
||||||
|
@ -113,10 +112,9 @@ public class SysUserController extends BaseController {
|
||||||
sysUserVo.setSysUser(sysUser);
|
sysUserVo.setSysUser(sysUser);
|
||||||
sysUserVo.setRoles(roles);
|
sysUserVo.setRoles(roles);
|
||||||
sysUserVo.setPermissions(permissions);
|
sysUserVo.setPermissions(permissions);
|
||||||
sysUserVo.setEnterpriseId(deptId);
|
sysUserVo.setDeptId(deptId);
|
||||||
return Result.success(sysUserVo);
|
return Result.success(sysUserVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户信息
|
* 注册用户信息
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -128,4 +128,9 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById (Long deptId);
|
public int deleteDeptById (Long deptId);
|
||||||
|
|
||||||
|
SysDept selectDeptIdByLeader(String userName);
|
||||||
|
|
||||||
|
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,6 @@ public interface SysFirmMapper {
|
||||||
|
|
||||||
int updateFirm(SysFirm sysFirm);
|
int updateFirm(SysFirm sysFirm);
|
||||||
|
|
||||||
|
int delFirm(Integer deptId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,15 +138,15 @@ public interface SysDeptService extends IService<SysDept> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过负责人查询企业ID
|
* 通过负责人查询企业ID
|
||||||
* @param leader 负责人
|
* @param userName 负责人
|
||||||
* @return 企业ID
|
* @return 企业ID
|
||||||
*/
|
*/
|
||||||
Long selectDeptIdByLeader (String leader);
|
Long selectDeptIdByLeader (String userName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
* @param enterpriseId 企业ID
|
* @param deptId 企业ID
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
SysDept getSysDeptByEnterpriseId (Long enterpriseId);
|
List<SysDept> getSysDeptByDeptId(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,6 @@ public interface SysFirmService {
|
||||||
int addFirm(SysFirm sysFirm);
|
int addFirm(SysFirm sysFirm);
|
||||||
|
|
||||||
int updateFirm(SysFirm sysFirm);
|
int updateFirm(SysFirm sysFirm);
|
||||||
|
|
||||||
|
int delFirm(Integer deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.couplet.system.service.impl;
|
package com.couplet.system.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.couplet.common.core.constant.UserConstants;
|
import com.couplet.common.core.constant.UserConstants;
|
||||||
import com.couplet.common.core.exception.ServiceException;
|
import com.couplet.common.core.exception.ServiceException;
|
||||||
|
@ -63,7 +63,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||||
return buildDeptTreeSelect(depts);
|
return buildDeptTreeSelect(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建前端所需要树结构
|
* 构建前端所需要树结构
|
||||||
*
|
*
|
||||||
|
@ -285,31 +284,33 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
/**
|
/**
|
||||||
* 通过负责人查询企业ID
|
* 通过负责人查询企业ID
|
||||||
*
|
*
|
||||||
* @param leader 负责人
|
* @param userName 负责人
|
||||||
*
|
*
|
||||||
* @return 企业ID
|
* @return 企业ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long selectDeptIdByLeader (String leader) {
|
public Long selectDeptIdByLeader (String userName) {
|
||||||
SysDept sysDept = getOne(new LambdaQueryWrapper<>() {{
|
|
||||||
eq(SysDept::getLeader, leader);
|
SysDept sysDept = deptMapper.selectDeptIdByLeader(userName);
|
||||||
}});
|
|
||||||
|
|
||||||
return sysDept == null ? null : sysDept.getDeptId();
|
return sysDept == null ? null : sysDept.getDeptId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据企业ID获取企业下部门
|
* 根据企业ID获取企业下部门
|
||||||
*
|
*
|
||||||
* @param enterpriseId 企业ID
|
* @param deptId 企业ID
|
||||||
*
|
*
|
||||||
* @return 企业信息,内含有部门
|
* @return 企业信息,内含有部门
|
||||||
*/
|
*/
|
||||||
@Override
|
|
||||||
public SysDept getSysDeptByEnterpriseId (Long enterpriseId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysDept> getSysDeptByDeptId(Long deptId) {
|
||||||
|
|
||||||
|
return deptMapper.getSysDeptByDeptId(deptId);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,4 +32,9 @@ public class SysFirmServiceImpl implements SysFirmService {
|
||||||
public int updateFirm(SysFirm sysFirm) {
|
public int updateFirm(SysFirm sysFirm) {
|
||||||
return sysFirmMapper.updateFirm(sysFirm);
|
return sysFirmMapper.updateFirm(sysFirm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delFirm(Integer deptId) {
|
||||||
|
return sysFirmMapper.delFirm(deptId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -108,6 +108,12 @@
|
||||||
<include refid="selectDeptVo"/>
|
<include refid="selectDeptVo"/>
|
||||||
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectDeptIdByLeader" resultType="com.couplet.common.system.domain.SysDept">
|
||||||
|
SELECT * FROM sys_dept d LEFT JOIN sys_user u on d.dept_id = u.dept_id WHERE u.user_name = #{userName}
|
||||||
|
</select>
|
||||||
|
<select id="getSysDeptByDeptId" resultType="com.couplet.common.system.domain.SysDept">
|
||||||
|
SELECT * FROM sys_dept WHERE parent_id = #{deptId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertDept" parameterType="com.couplet.common.system.domain.SysDept">
|
<insert id="insertDept" parameterType="com.couplet.common.system.domain.SysDept">
|
||||||
insert into sys_dept(
|
insert into sys_dept(
|
||||||
|
|
|
@ -4,19 +4,27 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.couplet.system.mapper.SysFirmMapper">
|
<mapper namespace="com.couplet.system.mapper.SysFirmMapper">
|
||||||
<insert id="addFirm">
|
<insert id="addFirm">
|
||||||
INSERT INTO `ry-cloud`.`yyh_firm` ( `firm_name`)
|
INSERT INTO `ry-cloud`.`sys_dept`
|
||||||
VALUES ( #{firmName});
|
( `dept_name`, `leader`, `phone`, `status`, `del_flag`, `create_by` )
|
||||||
|
VALUES ( #{deptName}, #{leader}, #{phone}, #{status}, #{delFlag}, #{createBy});
|
||||||
|
|
||||||
|
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateFirm">
|
<update id="updateFirm">
|
||||||
|
|
||||||
UPDATE `ry-cloud`.`yyh_firm`
|
UPDATE `ry-cloud`.`sys_dept`
|
||||||
SET `firm_name` = #{firmName}, `approve_id` = #{approveId}
|
SET `dept_name` = #{deptName}, `leader` = #{leader}, `phone` = #{phone}, `status` = #{status}, `del_flag` = 0, `create_by` = #{createBy}
|
||||||
WHERE `firm_id` = #{firmId};
|
WHERE `dept_id` = #{deptId};
|
||||||
|
|
||||||
|
|
||||||
</update>
|
</update>
|
||||||
|
<delete id="delFirm">
|
||||||
|
update `sys_dept`
|
||||||
|
set del_flag = '2'
|
||||||
|
where dept_id = #{deptId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="firmList" resultType="com.couplet.common.system.domain.SysFirm">
|
<select id="firmList" resultType="com.couplet.common.system.domain.SysFirm">
|
||||||
select * from yyh_firm;
|
select * from sys_dept where del_flag = 0
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<module>couplet-trouble</module>
|
<module>couplet-trouble</module>
|
||||||
<module>couplet-electronic-fence</module>
|
<module>couplet-electronic-fence</module>
|
||||||
<module>couplet-modules-vehicle</module>
|
<module>couplet-modules-vehicle</module>
|
||||||
<module>couplet-modules-mqtt</module>
|
<module>couplet-modules-mq</module>
|
||||||
<module>couplet-enterprisemanagement</module>
|
<module>couplet-enterprisemanagement</module>
|
||||||
<module>couplet-msg</module>
|
<module>couplet-msg</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 121.89.211.230:8848
|
server-addr: 121.89.211.230:8848
|
||||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
14
pom.xml
14
pom.xml
|
@ -246,6 +246,20 @@
|
||||||
<version>${couplet.version}</version>
|
<version>${couplet.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 车辆管理模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.couplet</groupId>
|
||||||
|
<artifactId>couplet-modules-vehicle</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RabbitMq模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.couplet</groupId>
|
||||||
|
<artifactId>couplet-modules-mq</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue