Compare commits
13 Commits
ecf40782e2
...
09c28eb1fb
Author | SHA1 | Date |
---|---|---|
|
09c28eb1fb | |
|
089068a745 | |
|
3303cfd0b3 | |
|
5cd149e502 | |
|
96f9bc50f1 | |
|
3a4ddc8f2e | |
|
2f74b536d9 | |
|
21045e1d5a | |
|
203e7b6561 | |
|
e59a8b3300 | |
|
486e7a3c7a | |
|
f26476a526 | |
|
9b649d2e60 |
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -33,6 +33,8 @@ public class BaseEntity implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String searchValue;
|
||||
|
||||
@TableField(exist = false)
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
|
@ -44,6 +46,7 @@ public class BaseEntity implements Serializable {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
|
@ -55,9 +58,11 @@ public class BaseEntity implements Serializable {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
|
|
|
@ -55,4 +55,5 @@ public enum BusinessType {
|
|||
* 清空数据
|
||||
*/
|
||||
CLEAN,
|
||||
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SecurityUtils {
|
|||
* 根据request获取请求token
|
||||
*/
|
||||
public static String getToken (HttpServletRequest request) {
|
||||
// 从header获取token标识
|
||||
// 从header标识
|
||||
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
||||
return replaceTokenPrefix(token);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.couplet.common.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.couplet.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
@ -82,11 +83,13 @@ public class SysDept extends BaseEntity {
|
|||
/**
|
||||
* 父部门名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String parentName;
|
||||
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<SysDept> children = new ArrayList<SysDept>();
|
||||
|
||||
public Long getDeptId () {
|
||||
|
|
|
@ -13,13 +13,30 @@ public class SysFirm {
|
|||
/**
|
||||
* 企业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;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.couplet.common.log.aop;
|
||||
|
||||
/**
|
||||
* @author DongXiaoDong
|
||||
* @version 1.0
|
||||
* @date 2024/3/28 23:12
|
||||
* @description
|
||||
*/
|
||||
public class AopRecord {
|
||||
}
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
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,26 @@
|
|||
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;
|
||||
|
||||
}
|
|
@ -1,32 +1,29 @@
|
|||
package com.couplet.map.common.domin;
|
||||
package com.couplet.map.common.domain.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/3/28
|
||||
* @Date: 2024/3/29
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@TableName("couplet_fence")
|
||||
public class Fence extends BaseEntity {
|
||||
|
||||
@TableId(value = "fence_id", type = IdType.AUTO)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class FenceRequest {
|
||||
/**
|
||||
* 围栏id
|
||||
*/
|
||||
private Long fenceId;
|
||||
private Integer fenceId;
|
||||
/**
|
||||
* 围栏名称
|
||||
* 新增电子名称
|
||||
*/
|
||||
private String fenceName;
|
||||
/**
|
||||
|
@ -45,36 +42,32 @@ public class Fence extends BaseEntity {
|
|||
* 围栏状态
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
private String crateName;
|
||||
/**
|
||||
* 维护人
|
||||
*/
|
||||
|
||||
private String maintainerName;
|
||||
/**
|
||||
* 告警状态
|
||||
* 报警状态
|
||||
*/
|
||||
|
||||
private Integer alarmStatus;
|
||||
/**
|
||||
* 围栏类型
|
||||
* 标识
|
||||
*/
|
||||
private Integer fenceType;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String[] logoId;
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
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 FenceUpdateRequest {
|
||||
|
||||
/**
|
||||
* 新增电子
|
||||
*/
|
||||
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")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String crateName;
|
||||
/**
|
||||
* 维护人
|
||||
*/
|
||||
private String maintainerName;
|
||||
/**
|
||||
* 报警状态
|
||||
*/
|
||||
private Integer alarmStatus;
|
||||
|
||||
}
|
|
@ -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>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
|
@ -84,6 +85,10 @@
|
|||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -2,15 +2,19 @@ package com.couplet.map.server.controller;
|
|||
|
||||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.core.web.controller.BaseController;
|
||||
import com.couplet.map.common.domin.Fence;
|
||||
import com.couplet.map.common.domin.request.FenceConfig;
|
||||
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.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
import static com.couplet.common.core.utils.PageUtils.startPage;
|
||||
|
@ -18,6 +22,7 @@ import static com.couplet.common.core.utils.PageUtils.startPage;
|
|||
/**
|
||||
* @Author: LiJiaYao
|
||||
* @Date: 2024/3/28
|
||||
* 电子围栏信息
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fence")
|
||||
|
@ -29,12 +34,10 @@ public class FenceController extends BaseController {
|
|||
@Autowired
|
||||
private FenceService fenceService;
|
||||
|
||||
/**
|
||||
* 获取围栏列表
|
||||
* @return
|
||||
* @param fenceConfig
|
||||
*/
|
||||
@GetMapping("/fenceList")
|
||||
|
||||
@Log(title = "电子围栏管理", businessType = BusinessType.OTHER)
|
||||
@RequiresPermissions("couplet:fence:fenceList")
|
||||
@PostMapping("/fenceList")
|
||||
public Result<?> fenceList(@RequestBody FenceConfig fenceConfig){
|
||||
|
||||
startPage();
|
||||
|
@ -42,5 +45,59 @@ public class FenceController extends BaseController {
|
|||
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("/{fenceDelete}")
|
||||
@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,7 +1,9 @@
|
|||
package com.couplet.map.server.mapper;
|
||||
|
||||
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.FenceRequest;
|
||||
import com.couplet.map.common.domain.request.FenceUpdateRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
|
@ -10,4 +12,14 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
*/
|
||||
@Mapper
|
||||
public interface FenceMapper extends BaseMapper<Fence> {
|
||||
/**
|
||||
* 改变围栏信息
|
||||
* @param fenceUpdateRequest
|
||||
*/
|
||||
void changeFence(FenceUpdateRequest fenceUpdateRequest);
|
||||
|
||||
int insertFence(FenceRequest fenceRequest);
|
||||
|
||||
void removeByFenceId(Long fenceId);
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.couplet.map.common.domin.Fence;
|
||||
import com.couplet.map.common.domin.request.FenceConfig;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -12,4 +15,24 @@ import java.util.List;
|
|||
*/
|
||||
public interface FenceService extends IService<Fence> {
|
||||
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;
|
||||
|
||||
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.couplet.map.common.domin.Fence;
|
||||
import com.couplet.map.common.domin.request.FenceConfig;
|
||||
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.mapper.FenceMapper;
|
||||
import com.couplet.map.server.service.FenAndLogoService;
|
||||
import com.couplet.map.server.service.FenceService;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -25,10 +30,62 @@ public class FenceServiceImpl extends ServiceImpl<FenceMapper, Fence> implements
|
|||
@Autowired
|
||||
private FenceMapper fenceMapper;
|
||||
|
||||
/**
|
||||
* 调用围栏和标识中间表
|
||||
*/
|
||||
@Autowired
|
||||
private FenAndLogoService fenAndLogoService;
|
||||
/**
|
||||
* 注入redis模板
|
||||
*/
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public List<Fence> pageQuery(FenceConfig fenceConfig) {
|
||||
LambdaQueryWrapper<Fence> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
/**
|
||||
* 模糊查询电子围栏名称
|
||||
*/
|
||||
if (StringUtils.isNotEmpty(fenceConfig.getFenceName())){
|
||||
|
||||
queryWrapper.like(Fence::getFenceName,fenceConfig.getFenceName());
|
||||
}
|
||||
/**
|
||||
* 查询标识类型
|
||||
*/
|
||||
if (fenceConfig.getFenceState()!=null){
|
||||
queryWrapper.like(Fence::getFenceState,fenceConfig.getFenceState());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -16,11 +16,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
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,49 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<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>
|
||||
<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_longitude_latitude`, `fence_description`, `is_delete`, `fence_state`, `create_time`,
|
||||
`create_name`, `maintainer_name`, `alarm_status`)
|
||||
VALUES
|
||||
(#{fenceName}, #{fenceLongitudeLatitude}, #{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 t_fence where fence_id = #{fenceId}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
|
@ -17,15 +17,15 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class ManageServiceImpl implements ManageServer {
|
||||
|
||||
@Autowired
|
||||
private RemoteDeptService remoteDeptService;
|
||||
{
|
||||
Long enterpriseId = SecurityUtils.getEnterpriseId();
|
||||
Result<SysDept> sysDeptByEnterpriseId = remoteDeptService.getSysDeptByEnterpriseId(enterpriseId);
|
||||
if (sysDeptByEnterpriseId.getCode() == 200){
|
||||
SysDept sysDept = sysDeptByEnterpriseId.getData();
|
||||
}
|
||||
}
|
||||
// @Autowired
|
||||
// private RemoteDeptService remoteDeptService;
|
||||
// {
|
||||
// Long enterpriseId = SecurityUtils.getEnterpriseId();
|
||||
// Result<SysDept> sysDeptByEnterpriseId = remoteDeptService.getSysDeptByEnterpriseId(enterpriseId);
|
||||
// if (sysDeptByEnterpriseId.getCode() == 200){
|
||||
// SysDept sysDept = sysDeptByEnterpriseId.getData();
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,11 +15,9 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>couplet-modules-mqtt</artifactId>
|
||||
<artifactId>couplet-modules-mq</artifactId>
|
||||
|
||||
<!-- <properties>-->
|
||||
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
||||
|
@ -18,7 +18,7 @@
|
|||
<!-- </properties>-->
|
||||
|
||||
<description>
|
||||
couplet-modules-mqttx获取报文模块
|
||||
couplet-modules-mq MQ模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
@ -91,6 +91,11 @@
|
|||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RabbitMQ依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<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.EnableMyFeignClients;
|
||||
|
@ -10,15 +10,15 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
* @ProjectName: Default (Template) Project
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: 获取报文模块启动类
|
||||
* @Description: rabbitMq模块启动类
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class CoupletMqttxApplatcaion {
|
||||
public class CoupletMqApplatcaion {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletMqttxApplatcaion.class, args);
|
||||
System.out.println("获取报文模块启动成功");
|
||||
SpringApplication.run(CoupletMqApplatcaion.class, args);
|
||||
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,36 @@
|
|||
package com.couplet.mq.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.couplet.common.core.utils.uuid.IdUtils;
|
||||
import com.couplet.mq.config.RabbitMQConfig;
|
||||
import com.couplet.mq.domain.Test;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/29
|
||||
* @Description: MQController类
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mq")
|
||||
@Slf4j
|
||||
public class MqController {
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@PostMapping("/receive")
|
||||
public void receive(@RequestBody Test data) {
|
||||
//创建配置类对象,用于获取配置值
|
||||
RabbitMQConfig config = new RabbitMQConfig();
|
||||
|
||||
rabbitTemplate.convertAndSend(config.exchangeName, config.routingKey, JSON.toJSONString(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,72 @@
|
|||
package com.couplet.mq.service;
|
||||
|
||||
import com.couplet.mq.config.RabbitMQConfig;
|
||||
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 org.springframework.stereotype.Service;
|
||||
|
||||
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 org.eclipse.paho.client.mqttv3.*;
|
|
@ -6,7 +6,7 @@ server:
|
|||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-mqtt
|
||||
name: couplet-mq
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -40,3 +40,9 @@ mqtt:
|
|||
clientid: mqttx
|
||||
qos: 0
|
||||
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 {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
<?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.mqtt.mapper.MqttMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -5,6 +5,9 @@ import lombok.Data;
|
|||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
|
@ -20,11 +23,13 @@ public class VehicleEditParams {
|
|||
/*
|
||||
*车辆id
|
||||
* */
|
||||
@NotNull(message = "车辆id不能为空")
|
||||
private Long vehicleId;
|
||||
|
||||
/*
|
||||
*车辆类型
|
||||
* */
|
||||
@NotNull(message="车辆类型不能为空")
|
||||
private Integer vehicleType;
|
||||
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import com.couplet.vehicle.domain.LyhVehicle;
|
|||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
import com.couplet.vehicle.exception.VehicleException;
|
||||
import com.couplet.vehicle.mapper.VehicleMapper;
|
||||
import com.couplet.vehicle.service.VehicleService;
|
||||
import com.couplet.vehicle.utils.SnowflakeIdGenerator;
|
||||
|
@ -79,7 +80,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (!update) {
|
||||
result = "删除失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "删除成功!";
|
||||
|
@ -124,7 +125,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (!update) {
|
||||
result = "编辑失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "编辑成功!";
|
||||
|
@ -153,7 +154,7 @@ public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> i
|
|||
|
||||
if (insert == 0) {
|
||||
result = "新增失败";
|
||||
throw new RuntimeException(result);
|
||||
throw new VehicleException(result);
|
||||
}
|
||||
|
||||
result = "新增成功!";
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -3,11 +3,9 @@ package com.couplet.system.controller;
|
|||
import com.couplet.common.core.domain.Result;
|
||||
import com.couplet.common.system.domain.SysFirm;
|
||||
import com.couplet.system.service.SysFirmService;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -61,4 +59,17 @@ public class SysFirmController {
|
|||
Result<Integer> result = Result.success(i);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,6 @@ public interface SysFirmMapper {
|
|||
|
||||
int updateFirm(SysFirm sysFirm);
|
||||
|
||||
int delFirm(Integer deptId);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,4 +16,6 @@ public interface SysFirmService {
|
|||
int addFirm(SysFirm sysFirm);
|
||||
|
||||
int updateFirm(SysFirm sysFirm);
|
||||
|
||||
int delFirm(Integer deptId);
|
||||
}
|
||||
|
|
|
@ -32,4 +32,9 @@ public class SysFirmServiceImpl implements SysFirmService {
|
|||
public int updateFirm(SysFirm sysFirm) {
|
||||
return sysFirmMapper.updateFirm(sysFirm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delFirm(Integer deptId) {
|
||||
return sysFirmMapper.delFirm(deptId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 968741d4-299d-483c-8d30-ede2aff8cfd4
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -4,19 +4,27 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.system.mapper.SysFirmMapper">
|
||||
<insert id="addFirm">
|
||||
INSERT INTO `ry-cloud`.`yyh_firm` ( `firm_name`)
|
||||
VALUES ( #{firmName});
|
||||
INSERT INTO `ry-cloud`.`sys_dept`
|
||||
( `dept_name`, `leader`, `phone`, `status`, `del_flag`, `create_by` )
|
||||
VALUES ( #{deptName}, #{leader}, #{phone}, #{status}, #{delFlag}, #{createBy});
|
||||
|
||||
|
||||
</insert>
|
||||
<update id="updateFirm">
|
||||
|
||||
UPDATE `ry-cloud`.`yyh_firm`
|
||||
SET `firm_name` = #{firmName}, `approve_id` = #{approveId}
|
||||
WHERE `firm_id` = #{firmId};
|
||||
UPDATE `ry-cloud`.`sys_dept`
|
||||
SET `dept_name` = #{deptName}, `leader` = #{leader}, `phone` = #{phone}, `status` = #{status}, `del_flag` = 0, `create_by` = #{createBy}
|
||||
WHERE `dept_id` = #{deptId};
|
||||
|
||||
|
||||
</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 * from yyh_firm;
|
||||
select * from sys_dept where del_flag = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -19,9 +19,65 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules-system</artifactId>
|
||||
<artifactId>couplet-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||
* @description
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = "com.couplet.**")
|
||||
@EnableFeignClients(basePackages = "com.couplet.**")
|
||||
public class CoupletTroubleApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CoupletTroubleApplication.class);
|
||||
|
|
|
@ -6,13 +6,13 @@ import com.couplet.common.core.web.page.TableDataInfo;
|
|||
import com.couplet.common.log.annotation.Log;
|
||||
import com.couplet.common.log.enums.BusinessType;
|
||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
||||
import com.couplet.trouble.domain.req.TroubleAddReq;
|
||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
||||
import com.couplet.trouble.service.SysTroubleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -42,8 +42,8 @@ public class SysTroubleController extends BaseController {
|
|||
*/
|
||||
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping("insertTrouble")
|
||||
public Result<?> insert(@Validated @RequestBody TroubleAddReq troubleAddReq) {
|
||||
return toAjax(troubleService.addTrouble(troubleAddReq));
|
||||
public Result<?> insert(@Validated @RequestBody coupletTroubleCode troubleAddReq) {
|
||||
return toAjax(troubleService.save(troubleAddReq));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,8 +51,8 @@ public class SysTroubleController extends BaseController {
|
|||
*/
|
||||
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
|
||||
@PostMapping("updateTrouble")
|
||||
public Result<?> edit(@Validated @RequestBody TroubleUpdReq troubleUpdReq) {
|
||||
return toAjax(troubleService.updateTrouble(troubleUpdReq));
|
||||
public Result<?> edit(@Validated @RequestBody coupletTroubleCode troubleUpdReq) {
|
||||
return toAjax(troubleService.updateById(troubleUpdReq));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,8 +18,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class coupletTroubleCode extends BaseEntity {
|
||||
public class coupletTroubleCode {
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
|||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class TroubleGrade {
|
||||
public class coupletTroubleGrade {
|
||||
private Integer gradeId;
|
||||
private String gradeName;
|
||||
}
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
|||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class TroubleType {
|
||||
public class coupletTroubleType {
|
||||
private Integer typeId;
|
||||
private String typeName;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package com.couplet.trouble.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.couplet.common.core.annotation.Excel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
@ -19,6 +21,7 @@ public class TroubleUpdReq {
|
|||
* 主键id
|
||||
*/
|
||||
@Excel(name = "故障码主键", cellType = Excel.ColumnType.NUMERIC)
|
||||
@TableId(value = "trouble_id",type = IdType.AUTO)
|
||||
private Integer troubleId;
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.util.List;
|
|||
public interface SysTroubleMapper extends BaseMapper<coupletTroubleCode> {
|
||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
||||
|
||||
int addTrouble(TroubleAddReq troubleAddReq);
|
||||
// int addTrouble(TroubleAddReq troubleAddReq);
|
||||
|
||||
int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
// int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
public interface SysTroubleService extends IService<coupletTroubleCode> {
|
||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
||||
|
||||
int addTrouble (TroubleAddReq troubleAddReq);
|
||||
// int addTrouble (TroubleAddReq troubleAddReq);
|
||||
|
||||
int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
// int updateTrouble(TroubleUpdReq troubleUpdReq);
|
||||
}
|
||||
|
|
|
@ -35,23 +35,23 @@ public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, couplet
|
|||
|
||||
/**
|
||||
* 新增故障码数据
|
||||
* @param troubleAddReq
|
||||
// * @param troubleAddReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addTrouble(TroubleAddReq troubleAddReq) {
|
||||
return sysTroubleMapper.addTrouble(troubleAddReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改故障码数据
|
||||
* @param troubleUpdReq
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateTrouble(TroubleUpdReq troubleUpdReq) {
|
||||
return sysTroubleMapper.updateTrouble(troubleUpdReq);
|
||||
}
|
||||
// @Override
|
||||
// public int addTrouble(TroubleAddReq troubleAddReq) {
|
||||
// return sysTroubleMapper.addTrouble(troubleAddReq);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改故障码数据
|
||||
// * @param troubleUpdReq
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public int updateTrouble(TroubleUpdReq troubleUpdReq) {
|
||||
// return sysTroubleMapper.updateTrouble(troubleUpdReq);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
@ -30,3 +30,6 @@ spring:
|
|||
logging:
|
||||
level:
|
||||
com.couplet.trouble.mapper: DEBUG
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
|
|
|
@ -12,10 +12,6 @@
|
|||
<result property="troubleTag" column="trouble_tag"/>
|
||||
<result property="troubleTypeId" column="trouble_typeId"/>
|
||||
<result property="troubleValue" column="trouble_value"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTroubleVo">
|
||||
|
@ -23,20 +19,20 @@
|
|||
LEFT JOIN couplet_trouble_grade g on t.trouble_grade_id = g.grade_id
|
||||
LEFT JOIN couplet_trouble_type y on t.trouble_type_id= y.type_id
|
||||
</sql>
|
||||
<insert id="addTrouble">
|
||||
insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)
|
||||
values (#{troubleCode},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleTypeId},#{troubleGradeId})
|
||||
</insert>
|
||||
<update id="updateTrouble">
|
||||
update couplet_trouble_code set
|
||||
trouble_code = #{troubleCode},
|
||||
trouble_position = #{troublePosition},
|
||||
trouble_value = #{troubleValue},
|
||||
trouble_tag = #{troubleTag},
|
||||
trouble_type_id = #{troubleTypeId},
|
||||
trouble_grade_id = #{troubleGradeId}
|
||||
where trouble_id = #{troubleId}
|
||||
</update>
|
||||
<!-- <insert id="addTrouble">-->
|
||||
<!-- insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)-->
|
||||
<!-- values (#{troubleCode},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleTypeId},#{troubleGradeId})-->
|
||||
<!-- </insert>-->
|
||||
<!-- <update id="updateTrouble">-->
|
||||
<!-- update couplet_trouble_code set-->
|
||||
<!-- trouble_code = #{troubleCode},-->
|
||||
<!-- trouble_position = #{troublePosition},-->
|
||||
<!-- trouble_value = #{troubleValue},-->
|
||||
<!-- trouble_tag = #{troubleTag},-->
|
||||
<!-- trouble_type_id = #{troubleTypeId},-->
|
||||
<!-- trouble_grade_id = #{troubleGradeId}-->
|
||||
<!-- where trouble_id = #{troubleId}-->
|
||||
<!-- </update>-->
|
||||
<!-- <update id="updateTrouble" parameterType="com.couplet.trouble.domain.req.TroubleUpdReq">-->
|
||||
<!-- update dxd_trouble_code-->
|
||||
<!-- <set>-->
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<module>couplet-trouble</module>
|
||||
<module>couplet-electronic-fence</module>
|
||||
<module>couplet-modules-vehicle</module>
|
||||
<module>couplet-modules-mqtt</module>
|
||||
<module>couplet-modules-mq</module>
|
||||
<module>couplet-enterprisemanagement</module>
|
||||
</modules>
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
namespace: 00004c44-c962-48f0-bc9a-7e589b2881e3
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
14
pom.xml
14
pom.xml
|
@ -246,6 +246,20 @@
|
|||
<version>${couplet.version}</version>
|
||||
</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>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue