diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/CarInfo.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/CarInfo.java index ecc3ea1..8238ca5 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/CarInfo.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/CarInfo.java @@ -1,5 +1,7 @@ package com.muyu.system.common.domain; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.common.core.web.domain.BaseEntity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -26,7 +28,7 @@ public class CarInfo { /** * 车辆表vin */ - private String carVin; + private String vin; /** * 开启时间 */ diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/EnterpriseInfo.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/EnterpriseInfo.java deleted file mode 100644 index 38e8ea0..0000000 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/EnterpriseInfo.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.muyu.system.common.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.muyu.common.core.annotation.Excel; -import com.muyu.common.core.web.domain.BaseEntity; - -/** - * 企业管理对象 enterprise_info - * - * @author huangdaju - * @date 2024-03-28 - */ -public class EnterpriseInfo extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long enterpriseId; - - /** 企业名称 */ - @Excel(name = "企业名称") - private String enterpriseName; - - /** 联系人邮箱 */ - @Excel(name = "联系人邮箱") - private String email; - - /** 企业地址 */ - @Excel(name = "企业地址") - private String enterpriseAddress; - - /** 企业联系电话 */ - @Excel(name = "企业联系电话") - private String phoneNumber; - - /** 行业类型 */ - @Excel(name = "行业类型") - private String industry; - - /** 企业状态 */ - @Excel(name = "企业状态") - private String status; - - /** 企业标识 */ - @Excel(name = "企业标识") - private String deptId; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** 负责人 */ - @Excel(name = "负责人") - private String leader; - - public void setEnterpriseId(Long enterpriseId) - { - this.enterpriseId = enterpriseId; - } - - public Long getEnterpriseId() - { - return enterpriseId; - } - public void setEnterpriseName(String enterpriseName) - { - this.enterpriseName = enterpriseName; - } - - public String getEnterpriseName() - { - return enterpriseName; - } - public void setEmail(String email) - { - this.email = email; - } - - public String getEmail() - { - return email; - } - public void setEnterpriseAddress(String enterpriseAddress) - { - this.enterpriseAddress = enterpriseAddress; - } - - public String getEnterpriseAddress() - { - return enterpriseAddress; - } - public void setPhoneNumber(String phoneNumber) - { - this.phoneNumber = phoneNumber; - } - - public String getPhoneNumber() - { - return phoneNumber; - } - public void setIndustry(String industry) - { - this.industry = industry; - } - - public String getIndustry() - { - return industry; - } - public void setStatus(String status) - { - this.status = status; - } - - public String getStatus() - { - return status; - } - public void setDeptId(String deptId) - { - this.deptId = deptId; - } - - public String getDeptId() - { - return deptId; - } - public void setDelFlag(String delFlag) - { - this.delFlag = delFlag; - } - - public String getDelFlag() - { - return delFlag; - } - public void setLeader(String leader) - { - this.leader = leader; - } - - public String getLeader() - { - return leader; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("enterpriseId", getEnterpriseId()) - .append("enterpriseName", getEnterpriseName()) - .append("email", getEmail()) - .append("enterpriseAddress", getEnterpriseAddress()) - .append("phoneNumber", getPhoneNumber()) - .append("industry", getIndustry()) - .append("status", getStatus()) - .append("deptId", getDeptId()) - .append("updateTime", getUpdateTime()) - .append("createTime", getCreateTime()) - .append("delFlag", getDelFlag()) - .append("leader", getLeader()) - .toString(); - } -} diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/Fence.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/Fence.java index 088c3ee..c988a86 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/Fence.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/Fence.java @@ -1,12 +1,11 @@ package com.muyu.system.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 lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.experimental.SuperBuilder; /** diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysLogininfor.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysLogininfor.java index c87afdf..03d22e3 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysLogininfor.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysLogininfor.java @@ -1,9 +1,9 @@ package com.muyu.system.common.domain; -import com.fasterxml.jackson.annotation.JsonFormat; import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel.ColumnType; import com.muyu.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; import java.util.Date; diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysOperLog.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysOperLog.java index e2c8a00..2f9ec0b 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysOperLog.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/SysOperLog.java @@ -1,9 +1,9 @@ package com.muyu.system.common.domain; -import com.fasterxml.jackson.annotation.JsonFormat; import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel.ColumnType; import com.muyu.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; import java.util.Date; diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarAddReq.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarAddReq.java index 29b3ce5..a9eba8a 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarAddReq.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarAddReq.java @@ -3,13 +3,12 @@ package com.muyu.system.common.domain.req; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; +import javax.validation.constraints.*; /** * 车辆表添加 diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarInfoAddReq.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarInfoAddReq.java index b5d554b..31872bb 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarInfoAddReq.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarInfoAddReq.java @@ -26,7 +26,7 @@ public class CarInfoAddReq { * 车辆表vin */ @ApiModelProperty(value = "车辆vin") - private String carVin; + private String vin; /** * 开启时间 */ diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarRequest.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarRequest.java index e23c947..26876a3 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarRequest.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarRequest.java @@ -1,6 +1,7 @@ package com.muyu.system.common.domain.req; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarUpdateReq.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarUpdateReq.java index cb0f3bf..4446f14 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarUpdateReq.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/req/CarUpdateReq.java @@ -3,10 +3,12 @@ package com.muyu.system.common.domain.req; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/track.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/track.java new file mode 100644 index 0000000..c7afe1b --- /dev/null +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/track.java @@ -0,0 +1,215 @@ +package com.muyu.system.common.domain; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 实时运行轨迹 + * @ProjectName: cloud-vehicles + * @PackageName: com.muyu.system.common.domain + * @Description TODO + * @Author XiaoFan + * @Date 2024/4/4 10:07 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class track { + /** + * 主键ID + */ + private Integer trackId; + /** + * VIN车辆编码 + */ + private String vin; + /** + * 报文创建时间 + */ + private Date createTime; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + /** + * 速度 + */ + private String speed; + /** + * 里程 + */ + private BigDecimal mileage; + /** + * 总电压 + */ + private String voltage; + /** + * 总电流 + */ + private String current; + /** + * 绝缘电阻 + */ + private String resistance; + /** + * 档位P档位D运行 + */ + private String gear; + /** + * 加速踏板行驶值 + */ + private String accelerationPedel; + /** + * 制动踏板行驶值 + */ + private String brakePedel; + /** + * 燃料消耗率 + */ + private String fuelConsumptionRate; + /** + * 电机控制器温度 + */ + private String motorControllerTemperature; + /** + * 电机转速 + */ + private String motorSpeed; + /** + * 电机转矩 + */ + private String motorTorque; + /** + * 电机温度 + */ + private String motorTemperature; + /** + * 电机电压 + */ + private String motorVoltage; + /** + * 电机电流 + */ + private String motorCurrent; + /** + * 动力电池剩余电量SOC + */ + private BigDecimal remainingBattery; + /** + * 当前状态允许的最大反馈功率 + */ + private String maximumFeedbackPower; + /** + * 当前状态允许的最大放电功率 + */ + private String maximumDischargePower; + /** + * BMS自检计数器 + */ + private String selfCheckCounter; + /** + * 动力电池充放电电流 + */ + private String totalBatteryCurrent; + /** + * 动力电池负载端电压V3 + */ + private String totalBatteryVoltage; + /** + * 单体电池最高电压 + */ + private String singleBatteryMaxVoltage; + /** + * 单体电池最低电压· + */ + private String singleBatteryMinVoltage; + /** + * 单体电池最高温度 + */ + private String singleBatteryMaxTemperature; + /** + * 单体电池最低温度 + */ + private String singleBatteryMinTemperature; + /** + * 动力电池可用容量 + */ + private String availableBatteryCapacity; + /** + * 车辆状态 1:正常 0:故障 + */ + private Integer vehicleStatus; + /** + * 充电状态 1:正常 0:故障 + */ + private Integer chargingStatus; + /** + * 运行状态 1:正常 0:故障 + */ + private Integer operatingStatus; + /** + * SOC 状态 1:正常 0:故障 + */ + private Integer socStatus; + /** + * 可充电储能装置工作状态 1:正常 0:故障 + */ + private Integer chargingEnergyStorageStatus; + /** + * 驱动电机状态 1:正常 0:故障 + */ + private Integer driveMotorStatus; + /** + * 定位是否有效 1:有效 0:无效 + */ + private Integer positionStatus; + /** + * EAS(汽车防盗系统)状态 1:正常 0:故障 + */ + private Integer easStatus; + /** + * PTC(电动加热器)状态 1:正常 0:故障 + */ + private Integer ptcStatus; + /** + * EPS(电动助力系统)状态 1:正常 0:故障 + */ + private Integer epsStatus; + /** + * ABS(防抱死)状态 1:正常 0:故障 + */ + private Integer absStatus; + /** + * MCU(电机/逆变器)状态 1:正常 0:故障 + */ + private Integer mcuStatus; + /** + * 动力电池加热状态 1:正常 0:故障 + */ + private Integer heatingStatus; + /** + * 动力电池当前状态 1:正常 0:故障 + */ + private Integer batteryStatus; + /** + * 动力电池保温状态 1:正常 0:故障 + */ + private Integer batteryinsulationStatus; + /** + * DCDC(电力交换系统) 状态 1:正常 0:故障 + */ + private Integer dcdcStatus; + /** + * CHG(充电机)状态 1:正常 0:故障 + */ + private Integer chgStatus; + +} diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vehicleData.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vehicleData.java new file mode 100644 index 0000000..826a754 --- /dev/null +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vehicleData.java @@ -0,0 +1,110 @@ +package com.muyu.system.common.domain; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 车辆报文数据 + * @ProjectName: cloud-vehicles + * @PackageName: com.muyu.system.common.domain + * @Description TODO + * @Author XiaoFan + * @Date 2024/4/4 15:21 + * @Version 1.0 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class vehicleData { + + /** + * 报文ID + */ + private Integer id; + /** + * VIN + */ + private String vin; + /** + * 时间毫秒值 + */ + private String date_time; + /** + * 车速 + */ + private String speed; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; + /** + * 单体电池最低电压 + */ + private String single_battery_min_voltage; + /** + * 电机电压 + */ + private String motor_voltage; + /** + * 电机转速 + */ + private String motor_speed; + /** + * BMS自检计数器 + */ + private String self_check_counter; + /** + * 总电压 + */ + private String voltage; + /** + * 档位 + */ + private String gear; + /** + * 电池剩余电量 + */ + private String remaining_battery; + /** + * 电机电流 + */ + private String motor_current; + /** + * 制动踏板行程值 + */ + private String brake_pedal; + /** + * 总电流 + */ + private String current; + /** + * 单次最大电压 + */ + private String single_battery_max_voltage; + /** + * 燃料消耗率 + */ + private String fuel_consumption_rate; + /** + * 绝缘电阻 + */ + private String resistance; + /** + * 最大反馈功率 + */ + private String maximum_feedback_power; + /** + * 单体电池最高温度 + */ + private String single_battery_max_temperature; + /** + * 记录ID + */ + private Integer records_id; + +} diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/CarVo.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/CarVo.java index e963ae6..e28df89 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/CarVo.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/CarVo.java @@ -4,8 +4,12 @@ import com.muyu.system.common.domain.req.CarRequest; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotEmpty; /** * 列表条件查询参数 diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/TreeSelect.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/TreeSelect.java index 05541c5..5d114a1 100644 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/TreeSelect.java +++ b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/domain/vo/TreeSelect.java @@ -1,9 +1,9 @@ package com.muyu.system.common.domain.vo; -import com.fasterxml.jackson.annotation.JsonInclude; import com.muyu.system.common.domain.SysDept; import com.muyu.system.common.domain.SysMenu; +import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; import java.util.List; diff --git a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/vo/BusinessVo.java b/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/vo/BusinessVo.java deleted file mode 100644 index e68df0a..0000000 --- a/muyu-modules/muyu-system/muyu-system-common/src/main/java/com/muyu/system/common/vo/BusinessVo.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.muyu.system.common.vo; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; -import org.springframework.format.annotation.DateTimeFormat; - -import java.util.Date; - -/** - * @ProjectName: cloud-vehicles - * @PackageName: com.muyu.system.common.vo - * @Description TODO - * @Author HuangDaJu - * @Date 2024/3/29 18:18 - * @Version 1.0 - */ -@Data -@SuperBuilder -@AllArgsConstructor -@NoArgsConstructor -@TableName("sys_dept") -public class BusinessVo { - - /** 部门ID */ - @TableId(type = IdType.AUTO) - private Long deptId; - - /** 父部门ID 默认查询100*/ - private Long parentId; - - - private String logoType; - - /** 祖级列表 */ - private String ancestors; - - /** 部门名称 */ - private String deptName; - - /** 显示顺序 */ - private Integer orderNum; - - /** 负责人 */ - private String leader; - - /** 联系电话 */ - private String phone; - - /** 邮箱 */ - private String email; - - /** 部门状态:0正常,1停用 */ - private String status; - - /** 删除标志(0代表存在 2代表删除) */ - private String delFlag; - - /** - * 当前页 - */ - @TableField(exist = false) - private Integer pageNum; - - /** - * 每页大小 - */ - @TableField(exist = false) - private Integer pageSize; - - /** - * 创建时间 - */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - /** - * 修改时间 - */ - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - -} diff --git a/muyu-modules/muyu-system/muyu-system-server/pom.xml b/muyu-modules/muyu-system/muyu-system-server/pom.xml index 5c958b6..7bb4f25 100644 --- a/muyu-modules/muyu-system/muyu-system-server/pom.xml +++ b/muyu-modules/muyu-system/muyu-system-server/pom.xml @@ -92,6 +92,12 @@ com.muyu muyu-file-remote + + org.eclipse.paho + org.eclipse.paho.client.mqttv3 + 1.2.5 + + diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/MuYuSystemApplication.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/MuYuSystemApplication.java index 868d09b..197a4a9 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/MuYuSystemApplication.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/MuYuSystemApplication.java @@ -6,6 +6,8 @@ import com.muyu.common.swagger.annotation.EnableCustomSwagger2; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; +import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * 系统模块 @@ -14,10 +16,12 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; */ @EnableCustomConfig @EnableCustomSwagger2 +@EnableSwagger2 @EnableRyFeignClients @SpringBootApplication @MapperScan("com.muyu.system.mapper") -public class MuYuSystemApplication{ +public class MuYuSystemApplication +{ public static void main(String[] args) { SpringApplication.run(MuYuSystemApplication.class, args); diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/CarController.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/CarController.java index decf64b..18c11c4 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/CarController.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/CarController.java @@ -1,11 +1,7 @@ package com.muyu.system.controller; - +import javax.servlet.http.HttpServletResponse; import com.muyu.common.core.domain.PageResult; import com.muyu.common.core.domain.Result; -import com.muyu.common.core.utils.poi.ExcelUtil; -import com.muyu.common.core.web.controller.BaseController; -import com.muyu.common.log.annotation.Log; -import com.muyu.common.log.enums.BusinessType; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.system.common.domain.Car; import com.muyu.system.common.domain.Fence; @@ -16,10 +12,13 @@ import com.muyu.system.remote.VehicleProviderService; import com.muyu.system.service.CarService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; +import com.muyu.common.log.annotation.Log; +import com.muyu.common.log.enums.BusinessType; +import com.muyu.common.core.web.controller.BaseController; +import com.muyu.common.core.utils.poi.ExcelUtil; import java.util.List; /** @@ -73,7 +72,7 @@ public class CarController extends BaseController * 新增车辆信息 */ @PostMapping("/add") -// @RequiresPermissions("system:car:add") + @RequiresPermissions("system:car:add") @Log(title = "车辆管理",businessType = BusinessType.INSERT) public Result add(@RequestBody @Validated CarAddReq carAddReq){ Result result=Result.success(carAddReq); @@ -111,35 +110,16 @@ public class CarController extends BaseController List list=carService.selectFence(); return Result.success(list); } - /** - * 关闭车辆 - */ - @PostMapping("/updateStateClose/{carId}") - @RequiresPermissions("system:car:edit") - @Log(title = "车辆管理") - public Result updateStateClose(@PathVariable Integer carId){ - int i=carService.updateStateClose(carId); - return Result.success(i); - } - /** - * 开启车辆 - */ - @PostMapping("/updateStateOpen/{carId}") - @RequiresPermissions("system:car:edit") - @Log(title = "车辆管理") - public Result updateStateOpen(@PathVariable Integer carId){ - int i=carService.updateStateOpen(carId); - return Result.success(i); - } /** * 车辆上线(连接车联模拟数据) * @param carVin * @return */ - @PostMapping("/open") + @PostMapping("/open/{carVin}") + @RequiresPermissions("system:car:edit") @Log(title = "车辆管理") - public Result open(@RequestParam String carVin){ + public Result open(@PathVariable String carVin){ Result result=carService.callVehicleClientInit(carVin); return result; } @@ -149,9 +129,10 @@ public class CarController extends BaseController * @param carVin * @return */ - @PostMapping("/close") + @PostMapping("/close/{carVin}") + @RequiresPermissions("system:car:edit") @Log(title = "车辆管理") - public Result close(@RequestParam String carVin){ + public Result close(@PathVariable String carVin){ Result result=carService.callVehicleClientClose(carVin); return result; } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/ClientRegController.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/ClientRegController.java index 54581d2..1f763fb 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/ClientRegController.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/ClientRegController.java @@ -1,13 +1,15 @@ package com.muyu.system.controller; import com.muyu.common.core.domain.Result; +import com.muyu.common.core.utils.ip.IpUtils; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.connection.ReactiveSubscription; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.data.redis.core.SetOperations; +import org.springframework.data.redis.core.ValueOperations; +import org.springframework.data.redis.core.ZSetOperations; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.HashSet; diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/EnterpriseInfoController.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/EnterpriseInfoController.java deleted file mode 100644 index f303c9b..0000000 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/controller/EnterpriseInfoController.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.muyu.system.controller; - -import java.util.List; -import com.muyu.common.core.domain.Result; -import com.muyu.common.core.utils.poi.ExcelUtil; -import com.muyu.common.core.web.page.TableDataInfo; -import com.muyu.system.common.domain.EnterpriseInfo; -import com.muyu.system.common.domain.SysDept; - -import com.muyu.system.common.vo.BusinessVo; -import com.muyu.system.service.ISysDeptService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.muyu.common.log.annotation.Log; -import com.muyu.common.log.enums.BusinessType; -import com.muyu.common.security.annotation.RequiresPermissions; - -import com.muyu.system.service.IEnterpriseInfoService; -import com.muyu.common.core.web.controller.BaseController; - -import javax.servlet.http.HttpServletResponse; - - -/** - * 企业管理Controller - * - * @author huangdaju - * @Date 2024-03-28 - */ -@RestController -@RequestMapping("/info") -public class EnterpriseInfoController extends BaseController{ - /** - * 通过@Autowired注解自动注入IEnterpriseInfoService接口的实现,用于处理企业信息的服务。 - */ - @Autowired - private IEnterpriseInfoService enterpriseInfoService; - @Autowired - private ISysDeptService iSysDeptService; - - /** - * 查询企业管理列表 - */ - @RequiresPermissions("system:info:list") - @GetMapping("/list") - public Result list(BusinessVo businessVo) { - startPage(); - List list = enterpriseInfoService.selectList(businessVo); - return getDataTable(list); - } - - /** - * 导出企业管理列表 - */ - @RequiresPermissions("system:info:export") - @Log(title = "企业管理", businessType = BusinessType.EXPORT) - @PostMapping("/export") - public void export(HttpServletResponse response, SysDept sysDept) { - List list = iSysDeptService.selectDeptList(sysDept); - list.forEach(System.out::println); - ExcelUtil util = new ExcelUtil(SysDept.class); - util.exportExcel(response, list, "企业管理数据"); - } - - /** - * 获取企业管理详细信息 为外边提供接口 - */ - @RequiresPermissions("system:info:query") - @GetMapping(value = "/{deptId}") - public Result getInfo(@PathVariable("deptId") Long deptId) { - return success(enterpriseInfoService.selectEnterpriseInfoByEnterpriseId(deptId)); - } - - /** - * 修改企业管理 - */ - @RequiresPermissions("system:info:edit") - @Log(title = "企业管理", businessType = BusinessType.UPDATE) - @PutMapping - public Result edit(@RequestBody BusinessVo BusinessVo) { - return toAjax(enterpriseInfoService.updateEnterpriseInfo(BusinessVo)); - - } - - /** - * 新增企业管理 - */ - @RequiresPermissions("system:info:add") - @Log(title = "企业管理", businessType = BusinessType.INSERT) - @PostMapping - public Result add(@RequestBody BusinessVo businessVo) - { - return toAjax(enterpriseInfoService.insertEnterpriseInfo(businessVo)); - - } - - /** - * 删除企业管理 - */ - @RequiresPermissions("system:info:remove") - @Log(title = "企业管理", businessType = BusinessType.DELETE) - @PostMapping("/{deptId}") - public Result remove(@PathVariable Long[] deptId) { - - return toAjax(enterpriseInfoService.deleteEnterpriseInfoByDateIds(deptId)); - } -} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/CarMapper.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/CarMapper.java index 6eb0532..55ceb35 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/CarMapper.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/CarMapper.java @@ -1,9 +1,13 @@ package com.muyu.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.muyu.common.core.domain.PageResult; +import com.muyu.common.core.domain.Result; import com.muyu.system.common.domain.Car; +import com.muyu.system.common.domain.CarInfo; import com.muyu.system.common.domain.Fence; import com.muyu.system.common.domain.req.CarInfoAddReq; +import com.muyu.system.common.domain.vo.CarVo; import java.util.List; @@ -16,8 +20,6 @@ import java.util.List; */ public interface CarMapper extends BaseMapper { - - /** * 查询车辆信息列表 * @@ -32,27 +34,28 @@ public interface CarMapper extends BaseMapper */ List selectFence(); - /** - * 关闭车辆 - * @param carId - * @return - */ - int updateStateClose(Integer carId); - - /** - * 开启车辆 - * @param carId - * @return - */ - int updateStateOpen(Integer carId); - /** * 添加车辆日志表 * @param carInfoAddReq */ void insertCarInfo(CarInfoAddReq carInfoAddReq); + /** + * 车辆上线 + * @param carVin + */ + void updateVinOpen(String carVin); + /** + * 车辆下线 + * @param carVin + */ + void updateVinClose(String carVin); - + /** + * 根据VIN查询车辆 + * @param carVin + * @return + */ + Car selectByVin(String carVin); } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/EnterpriseInfoMapper.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/EnterpriseInfoMapper.java deleted file mode 100644 index fa0018a..0000000 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/EnterpriseInfoMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.muyu.system.mapper; - -import java.util.List; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.muyu.system.common.domain.EnterpriseInfo; -import com.muyu.system.common.domain.SysDept; -import com.muyu.system.common.vo.BusinessVo; - - - -/** - * 企业管理Mapper接口 - * - * @author huangdaju - * @date 2024-03-28 - */ -public interface EnterpriseInfoMapper extends BaseMapper{ - - - - - - - -} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/SysDeptMapper.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/SysDeptMapper.java index 468a101..5d55949 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/SysDeptMapper.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mapper/SysDeptMapper.java @@ -117,9 +117,4 @@ public interface SysDeptMapper * @return 结果 */ public int deleteDeptById(Long deptId); - - - String selectDept(Long deptId); - - } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mqtt/MqttSubscriber.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mqtt/MqttSubscriber.java new file mode 100644 index 0000000..21b9d16 --- /dev/null +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/mqtt/MqttSubscriber.java @@ -0,0 +1,81 @@ +package com.muyu.system.mqtt; + +import org.eclipse.paho.client.mqttv3.MqttException; +import org.eclipse.paho.client.mqttv3.*; +import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; + +/** + * 接收车联模拟数据 + * @ProjectName: cloud-vehicles + * @PackageName: com.muyu.system.mqtt + * @Description TODO + * @Author XiaoFan + * @Date 2024/3/31 19:49 + * @Version 1.0 + */ +public class MqttSubscriber { + public static void main(String[] args) { + //MQTT服务器地址 + String broker="tcp://10.10.26.4:1883"; + //客户端ID,可根据实际情况自定义 + String clientId="mqttx_58b6074f"; + //订阅的主题 + String topic="test1"; + //消息服务质量 + int qos=2; + //消息持久化方式,这里选择内存持久化 + MemoryPersistence persistence=new MemoryPersistence(); + + try { + //创建MQTT客户端实例 + MqttClient sampleClient = new MqttClient(broker, clientId, persistence); + //设置连接选项 + MqttConnectOptions connOpts = new MqttConnectOptions(); + connOpts.setCleanSession(true); + //打印连接信息 + System.out.println("Connecting to broker:" +broker); + //连接到MQTT代理 + sampleClient.connect(connOpts); + //打印连接成功信息 + System.out.println("Connected"); + //打印订阅信息 + System.out.println("Subscribing to topic:" +topic); + //订阅指定主题 + sampleClient.subscribe(topic,qos); + + //设置消息到打的回调函数 + sampleClient.setCallback(new MqttCallback() { + @Override + public void connectionLost(Throwable throwable) { + //连接丢失时的处理逻辑 + System.out.println("Connection lost!"); + } + + @Override + public void messageArrived(String topic, MqttMessage message) throws Exception { + //接收到消息时的处理逻辑 + System.out.println("Message received:"+new String(message.getPayload())); + + } + + @Override + public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { + //消息发送完成后的处理逻辑 + } + }); + + //循环等待接收消息 + while (true){ + Thread.sleep(1000); + //每隔一秒检查一次是否有新消息 + } + }catch (MqttException | InterruptedException me){ +// System.out.println("reason"+me.getReasonCode()); + System.out.println("msg"+me.getMessage()); + System.out.println("loc"+me.getLocalizedMessage()); + System.out.println("cause"+me.getCause()); + System.out.println("excep"+me); + me.printStackTrace(); + } + } +} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/CarService.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/CarService.java index 174daa2..6779d9d 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/CarService.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/CarService.java @@ -53,15 +53,18 @@ public interface CarService extends IService List selectFence(); /** - * 关闭车辆 + * 车辆上线 + * @param carVin + * @return */ - int updateStateClose(Integer carId); - /** - * 开启车辆 - */ - int updateStateOpen(Integer carId); - Result callVehicleClientInit(String carVin); + /** + * 下线 + * @param carVin + * @return + */ Result callVehicleClientClose(String carVin); + + } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/IEnterpriseInfoService.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/IEnterpriseInfoService.java deleted file mode 100644 index de57581..0000000 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/IEnterpriseInfoService.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.muyu.system.service; - -import java.util.List; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.muyu.system.common.domain.EnterpriseInfo; -import com.muyu.system.common.domain.SysDept; -import com.muyu.system.common.vo.BusinessVo; - - - -/** - * 企业管理Service接口 - * - * @author huangdaju - * @Date 2024-03-28 - */ -public interface IEnterpriseInfoService extends IService -{ - /** - * 查询企业管理 - * - * @param enterpriseId 企业管理主键 - * @return 企业管理 - */ - public BusinessVo selectEnterpriseInfoByEnterpriseId(Long enterpriseId); - - /** - * 查询企业管理列表 - * - * @param enterpriseInfo 企业管理 - * @return 企业管理集合 - */ - - - /** - * 新增企业管理 - * - * @param businessVo 企业管理 - * @return 结果 - */ - public int insertEnterpriseInfo(BusinessVo businessVo); - - /** - * 修改企业管理 - * - * @param businessVo 企业管理 - * @return 结果 - */ - public int updateEnterpriseInfo(BusinessVo businessVo); - - - - /** - * 批量删除企业管理 - * - * @param deptId 需要删除的企业管理主键集合 - * @return 结果 - */ - int deleteEnterpriseInfoByDateIds(Long[] deptId); - - - /** - * 根据传入的业务对象查询相关信息列表。 - * @param businessVo 业务对象,包含查询条件。 - * @return 返回业务信息列表。 - */ - List selectList(BusinessVo businessVo); - - - - - -} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/CarServiceImpl.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/CarServiceImpl.java index eb1f86f..fb073aa 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/CarServiceImpl.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/CarServiceImpl.java @@ -1,5 +1,8 @@ package com.muyu.system.service.impl; +import java.util.Arrays; +import java.util.Date; +import java.util.List; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.pagehelper.PageHelper; @@ -16,14 +19,11 @@ import com.muyu.system.common.domain.Fence; import com.muyu.system.common.domain.req.CarInfoAddReq; import com.muyu.system.common.domain.vo.CarVo; import com.muyu.system.mapper.CarMapper; -import com.muyu.system.service.CarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; -import java.util.Arrays; -import java.util.Date; -import java.util.List; +import com.muyu.system.service.CarService; +import org.springframework.web.client.RestTemplate; /** * 车辆信息Service业务层处理 @@ -104,7 +104,6 @@ public class CarServiceImpl extends ServiceImpl implements CarSer car.setCreateTime(DateUtils.getNowDate()); car.setState(1); car.setCarVin("vin"+ IdUtils.generateShortUUID()); - //创建请求对象 VehicleCreateAddReq vehicleCreateAddReq = new VehicleCreateAddReq(); vehicleCreateAddReq.setVinStr(car.getCarVin()); @@ -158,49 +157,43 @@ public class CarServiceImpl extends ServiceImpl implements CarSer return carMapper.selectFence(); } - /** - * 关闭车辆 - * @param carId - * @return - */ - @Override - public int updateStateClose(Integer carId) { - Car car = carMapper.selectById(carId); - CarInfoAddReq carInfoAddReq = new CarInfoAddReq(); - carInfoAddReq.setCarVin(car.getCarVin()); - carInfoAddReq.setInfoCloseDate(new Date()); - carMapper.insertCarInfo(carInfoAddReq); - return carMapper.updateStateClose(carId); - } /** - * 开启车辆 - * @param carId + * 车辆上线 + * @param carVin * @return */ - @Override - public int updateStateOpen(Integer carId) { - Car car = carMapper.selectById(carId); - CarInfoAddReq carInfoAddReq = new CarInfoAddReq(); - carInfoAddReq.setCarVin(car.getCarVin()); - carInfoAddReq.setInfoOpenDate(new Date()); - carMapper.insertCarInfo(carInfoAddReq); - return carMapper.updateStateOpen(carId); - } - @Override public Result callVehicleClientInit(String carVin) { String url="http://127.0.0.1:81/vehicle/instance/client/init/"+carVin; Result result=restTemplate.postForObject(url,null,Result.class); + carMapper.updateVinOpen(carVin); + Car car = carMapper.selectByVin(carVin); + CarInfoAddReq carInfoAddReq = new CarInfoAddReq(); + carInfoAddReq.setVin(car.getCarVin()); + carInfoAddReq.setInfoOpenDate(new Date()); + carMapper.insertCarInfo(carInfoAddReq); return result; } + /** + * 车辆下线 + * @param carVin + * @return + */ @Override public Result callVehicleClientClose(String carVin) { String url="http://127.0.0.1:81/vehicle/instance/client/close/" +carVin; Result result=restTemplate.postForObject(url,null,Result.class); + carMapper.updateVinClose(carVin); + Car car = carMapper.selectByVin(carVin); + CarInfoAddReq carInfoAddReq = new CarInfoAddReq(); + carInfoAddReq.setVin(car.getCarVin()); + carInfoAddReq.setInfoCloseDate(new Date()); + carMapper.insertCarInfo(carInfoAddReq); return result; } + } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/EnterpriseInfoServiceImpl.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/EnterpriseInfoServiceImpl.java deleted file mode 100644 index 21bf877..0000000 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/EnterpriseInfoServiceImpl.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.muyu.system.service.impl; - -import java.util.List; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.muyu.common.core.utils.DateUtils; -import com.muyu.common.core.utils.StringUtils; -import com.muyu.common.security.utils.SecurityUtils; -import com.muyu.system.common.domain.EnterpriseInfo; -import com.muyu.system.common.domain.SysDept; -import com.muyu.system.common.vo.BusinessVo; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import com.muyu.system.mapper.EnterpriseInfoMapper; - -import com.muyu.system.service.IEnterpriseInfoService; - -/** - * 企业管理Service业务层处理 - * - * @author huangdaju - * @date 2024-03-28 - */ -@Service -public class EnterpriseInfoServiceImpl extends ServiceImpl implements IEnterpriseInfoService { - - /** - * 注入EnterpriseInfoMapper,用于操作企业信息的数据访问层。 - */ - @Autowired - private EnterpriseInfoMapper enterpriseInfoMapper; - - - /** - * 查询企业管理 - * - * @param deptId 企业管理主键 - * @return 企业管理 - */ - @Override - public BusinessVo selectEnterpriseInfoByEnterpriseId(Long deptId){ - return enterpriseInfoMapper.selectById(deptId); - } - - /** - * 查询企业管理 - * - * @param businessVo 企业管理列表 - * @return 企业管理列表 - */ - @Override - public List selectList(BusinessVo businessVo) { - /** - * 100L为 部门表公司数据 - */ - businessVo.setParentId(100L); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.like(StringUtils.isNotEmpty(businessVo.getDeptName()),BusinessVo::getDeptName,businessVo.getDeptName()); - queryWrapper.like(StringUtils.isNotEmpty(businessVo.getLeader()),BusinessVo::getLeader,businessVo.getLeader()); - queryWrapper.like(StringUtils.isNotEmpty(businessVo.getStatus()),BusinessVo::getStatus,businessVo.getStatus()); - queryWrapper.eq(StringUtils.isNotNull(businessVo.getParentId()),BusinessVo::getParentId,businessVo.getParentId()); - queryWrapper.eq(BusinessVo::getDelFlag,"0"); - return enterpriseInfoMapper.selectList(queryWrapper); - } - - - - - /** - * 新增企业管理 - * - * @param businessVo 企业管理 - * @return 结果 - */ - @Override - public int insertEnterpriseInfo(BusinessVo businessVo) - { - // 添加条件 - // "logoType": "hdj", -// "deptName": "黄大举有限公司", -// "leader": "黄大举", -// "phone": "15358324552", -// "email": "87755" - - //和公司同级别的权限 - businessVo.setAncestors("0,100"); - businessVo.setParentId(100L); - - businessVo.setOrderNum(0); - businessVo.setDelFlag("0"); - businessVo.setStatus("0"); - businessVo.setCreateTime(DateUtils.getNowDate()); - return enterpriseInfoMapper.insert(businessVo); - } - - /** - * 修改企业管理 - * - * @param businessVo 企业管理 - * @return 结果 - */ - @Override - public int updateEnterpriseInfo(BusinessVo businessVo){ - businessVo.setUpdateTime(DateUtils.getNowDate()); - return enterpriseInfoMapper.updateById(businessVo); - } - - - - /** - * 批量删除企业管理 - * - * @param deptIds 需要删除的企业管理主键 - * @return 结果 - */ - @Override - public int deleteEnterpriseInfoByDateIds(Long[] deptIds){ - - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.in("dept_id", deptIds); - BusinessVo updateEntity = new BusinessVo(); - updateEntity.setDelFlag("2"); - return enterpriseInfoMapper.update(updateEntity, updateWrapper); - } - - - - -} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysDeptServiceImpl.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysDeptServiceImpl.java index 240da4e..50b2c49 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysDeptServiceImpl.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysDeptServiceImpl.java @@ -46,18 +46,7 @@ public class SysDeptServiceImpl implements ISysDeptService @DataScope(deptAlias = "d") public List selectDeptList(SysDept dept) { - //获取登录人信息 - Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId(); - String logoType= deptMapper.selectDept(deptId); - - if (!logoType.equals("ry")) { -// dept.setLogoType(logoType); - return deptMapper.selectDeptList(dept); - } - - List deptList = deptMapper.selectDeptList(dept); - deptList.forEach(System.out::println); - return deptList; + return deptMapper.selectDeptList(dept); } /** diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysUserServiceImpl.java b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysUserServiceImpl.java index dc28df6..0627208 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysUserServiceImpl.java +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/java/com/muyu/system/service/impl/SysUserServiceImpl.java @@ -66,14 +66,8 @@ public class SysUserServiceImpl implements ISysUserService public List selectUserList(SysUser user) { //获取登录人信息 - SysUser sysUser = SecurityUtils.getLoginUser().getSysUser(); - Long userId = sysUser.getUserId(); - //判断用户是不是管理员 - log.info("userId:{}",userId); - if (userId!=null && userId!=1){ - user.setDeptId(sysUser.getDeptId()); - return userMapper.selectUserList(user); - } + LoginUser loginUser = SecurityUtils.getLoginUser(); + return userMapper.selectUserList(user); } diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/CarMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/CarMapper.xml index 88459b5..6fb60ea 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/CarMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/CarMapper.xml @@ -24,11 +24,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{infoCloseDate} ) - - update car set state=1 where car_id=#{carId} + + update car set state=0 where car_vin=#{carVin} - - update car set state=0 where car_id=#{carId} + + update car set state=1 where car_vin=#{carVin} select fence_id,fence_name from fence + diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/EnterpriseInfoMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/EnterpriseInfoMapper.xml deleted file mode 100644 index 446038e..0000000 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/EnterpriseInfoMapper.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - select enterprise_id, enterprise_name, contact_person, contact_email, user_id, enterprise_address, phone_number, industry, employee_count, status, identifier from enterprise_info - - - - - - - - insert into enterprise_info - - enterprise_name, - contact_person, - contact_email, - user_id, - enterprise_address, - phone_number, - industry, - employee_count, - status, - identifier, - - - #{enterpriseName}, - #{contactPerson}, - #{contactEmail}, - #{userId}, - #{enterpriseAddress}, - #{phoneNumber}, - #{industry}, - #{employeeCount}, - #{status}, - #{identifier}, - - - - - update enterprise_info - - enterprise_name = #{enterpriseName}, - contact_person = #{contactPerson}, - contact_email = #{contactEmail}, - user_id = #{userId}, - enterprise_address = #{enterpriseAddress}, - phone_number = #{phoneNumber}, - industry = #{industry}, - employee_count = #{employeeCount}, - status = #{status}, - identifier = #{identifier}, - - where enterprise_id = #{enterpriseId} - - - - delete from enterprise_info where enterprise_id = #{enterpriseId} - - - - delete from enterprise_info where enterprise_id in - - #{enterpriseId} - - - diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysConfigMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysConfigMapper.xml index 06d8d46..966cce3 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysConfigMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysConfigMapper.xml @@ -33,12 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - @@ -69,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where config_key = #{configKey} limit 1 - + insert into sys_config ( config_name, config_key, @@ -89,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - + update sys_config config_name = #{configName}, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDeptMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDeptMapper.xml index c18a785..71a626b 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDeptMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_dept d - where d.del_flag = '0' @@ -42,12 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND status = #{status} - - AND logo_type = #{logoType} - ${params.dataScope} - order by d.parent_id, d.order_num @@ -88,12 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1 - - - + insert into sys_dept( dept_id, parent_id, @@ -121,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - + update sys_dept parent_id = #{parentId}, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictDataMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictDataMapper.xml index a13e62d..668b8bb 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictDataMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictDataMapper.xml @@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_dict_data - @@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by dict_sort asc - where status = '0' and dict_type = #{dictType} order by dict_sort asc @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update sys_dict_data dict_sort = #{dictSort}, @@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sys_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType} - + insert into sys_dict_data( dict_sort, dict_label, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictTypeMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictTypeMapper.xml index 1b0cc09..d8dee1d 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictTypeMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDictTypeMapper.xml @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_dict_type - @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update sys_dict_type dict_name = #{dictName}, @@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where dict_id = #{dictId} - + insert into sys_dict_type( dict_name, dict_type, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysLogininforMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysLogininforMapper.xml index 709c439..768d6f0 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysLogininforMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysLogininforMapper.xml @@ -13,12 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + insert into sys_logininfor (user_name, status, ipaddr, msg, access_time) values (#{userName}, #{status}, #{ipaddr}, #{msg}, sysdate()) - select info_id, user_name, ipaddr, status, msg, access_time from sys_logininfor diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysMenuMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysMenuMapper.xml index 827defa..fcb8072 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysMenuMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysMenuMapper.xml @@ -32,7 +32,7 @@ from sys_menu - @@ -54,7 +54,7 @@ order by m.parent_id, m.order_num - select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time from sys_menu m left join sys_role_menu rm on m.menu_id = rm.menu_id @@ -127,12 +127,12 @@ select count(1) from sys_menu where parent_id = #{menuId} - where menu_name=#{menuName} and parent_id = #{parentId} limit 1 - + update sys_menu menu_name = #{menuName}, @@ -155,7 +155,7 @@ where menu_id = #{menuId} - + insert into sys_menu( menu_id, parent_id, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysNoticeMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysNoticeMapper.xml index 5bb1960..cb15200 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysNoticeMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysNoticeMapper.xml @@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where notice_id = #{noticeId} - @@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + insert into sys_notice ( notice_title, notice_type, @@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - + update sys_notice notice_title = #{noticeTitle}, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysOperLogMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysOperLogMapper.xml index 7bab87a..d484bb8 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysOperLogMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysOperLogMapper.xml @@ -28,12 +28,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_oper_log - + insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, cost_time, oper_time) values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate()) - diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysPostMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysPostMapper.xml index d5f7610..4146a19 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysPostMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysPostMapper.xml @@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_post - @@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where post_code=#{postCode} limit 1 - + update sys_post post_code = #{postCode}, @@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where post_id = #{postId} - + insert into sys_post( post_id, post_code, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysRoleMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysRoleMapper.xml index b3d0c10..4a635d4 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysRoleMapper.xml @@ -30,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sys_dept d on u.dept_id = d.dept_id - where r.del_flag = '0' @@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where r.role_key=#{roleKey} and r.del_flag = '0' limit 1 - + insert into sys_role( role_id, role_name, @@ -121,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - + update sys_role role_name = #{roleName}, diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserMapper.xml index 0b9ec87..07885a4 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserMapper.xml @@ -56,11 +56,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join sys_role r on r.role_id = ur.role_id - select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u left join sys_dept d on u.dept_id = d.dept_id where u.del_flag = '0' - + + AND u.user_id = #{userId} + AND u.user_name like concat('%', #{userName}, '%') @@ -83,13 +85,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} - select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time from sys_user u left join sys_dept d on u.dept_id = d.dept_id left join sys_user_role ur on u.user_id = ur.user_id left join sys_role r on r.role_id = ur.role_id - where u.del_flag = '0' and r.role_id = #{roleId} and + where u.del_flag = '0' and r.role_id = #{roleId} AND u.user_name like concat('%', #{userName}, '%') @@ -100,7 +102,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} - select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time from sys_user u left join sys_dept d on u.dept_id = d.dept_id @@ -140,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 - + insert into sys_user( user_id, dept_id, @@ -172,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) - + update sys_user dept_id = #{deptId}, @@ -193,15 +195,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} - + update sys_user set status = #{status} where user_id = #{userId} - + update sys_user set avatar = #{avatar} where user_name = #{userName} - + update sys_user set password = #{password} where user_name = #{userName} diff --git a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserRoleMapper.xml b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserRoleMapper.xml index 0f3ae02..9dd1ca9 100644 --- a/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserRoleMapper.xml +++ b/muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysUserRoleMapper.xml @@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}