| | |
| | | public R<List<UPWarnMsgAdptInfoVo>> findByCreateTimeAfter(Long createTime) { |
| | | return R.fail("查询大于给定日期的所有报警数据失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<UPWarnMsgAdptInfoVo> findByInfoId(Integer infoId) { |
| | | return R.fail("根据信息id查询报警原始数据失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/warnMsgAdptInfo/findByCreateTimeAfter") |
| | | R<List<UPWarnMsgAdptInfoVo>> findByCreateTimeAfter(@RequestParam("createTime") Long createTime); |
| | | |
| | | |
| | | /** |
| | | * 根据信息id查询报警原始数据 |
| | | * |
| | | * @param infoId |
| | | * @return |
| | | */ |
| | | @PostMapping("/warnMsgAdptInfo/findByInfoId") |
| | | R<UPWarnMsgAdptInfoVo> findByInfoId(@RequestParam("infoId") Integer infoId); |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/user/info/{username}") |
| | | public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | | |
| | | @GetMapping("/user/infoShop/{username}") |
| | | public R<LoginUser> infoShop(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); |
| | | |
| | |
| | | package com.ruoyi.system.api.domain; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import com.ruoyi.common.core.annotation.Excel.ColumnType; |
| | | import com.ruoyi.common.core.web.domain.BaseEntity; |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @TableName("sys_role") |
| | | public class SysRole extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysUser extends BaseEntity |
| | | { |
| | | public class SysUser extends BaseEntity { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 用户ID */ |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") |
| | | @TableId(value = "user_id", type = IdType.AUTO) |
| | | private Long userId; |
| | | |
| | | /** 部门ID */ |
| | | /** |
| | | * 部门ID |
| | | */ |
| | | @Excel(name = "部门编号", type = Type.IMPORT) |
| | | @TableField("dept_id") |
| | | private Long deptId; |
| | | |
| | | /** 用户账号 */ |
| | | /** |
| | | * 用户账号 |
| | | */ |
| | | @Excel(name = "登录名称") |
| | | @TableField("user_name") |
| | | private String userName; |
| | | |
| | | /** 用户昵称 */ |
| | | /** |
| | | * 用户昵称 |
| | | */ |
| | | @Excel(name = "用户名称") |
| | | @NotBlank(message = "姓名不能为空") |
| | | @TableField("nick_name") |
| | | private String nickName; |
| | | |
| | | /** 用户邮箱 */ |
| | | /** |
| | | * 用户邮箱 |
| | | */ |
| | | @Excel(name = "用户邮箱") |
| | | private String email; |
| | | |
| | | /** 手机号码 */ |
| | | /** |
| | | * 手机号码 |
| | | */ |
| | | @Excel(name = "手机号码") |
| | | @NotBlank(message = "请输入账号") |
| | | private String phonenumber; |
| | | |
| | | /** 用户性别 */ |
| | | /** |
| | | * 用户性别 |
| | | */ |
| | | @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") |
| | | private String sex; |
| | | |
| | | /** 用户头像 */ |
| | | /** |
| | | * 用户头像 |
| | | */ |
| | | private String avatar; |
| | | |
| | | /** 密码 */ |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** 帐号状态(0正常 1停用) */ |
| | | /** |
| | | * 帐号状态(0正常 1停用) |
| | | */ |
| | | @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
| | | private String status; |
| | | |
| | | /** 删除标志(0代表存在 2代表删除) */ |
| | | /** |
| | | * 删除标志(0代表存在 2代表删除) |
| | | */ |
| | | @TableField("del_flag") |
| | | private String delFlag; |
| | | |
| | | /** 最后登录IP */ |
| | | /** |
| | | * 最后登录IP |
| | | */ |
| | | @Excel(name = "最后登录IP", type = Type.EXPORT) |
| | | @TableField("login_ip") |
| | | private String loginIp; |
| | | |
| | | /** 最后登录时间 */ |
| | | /** |
| | | * 最后登录时间 |
| | | */ |
| | | @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @TableField("login_date") |
| | | private Date loginDate; |
| | | |
| | | /** 部门对象 */ |
| | | /** |
| | | * 部门对象 |
| | | */ |
| | | @Excels({ |
| | | @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), |
| | | @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) |
| | |
| | | @TableField(exist = false) |
| | | private SysDept dept; |
| | | |
| | | /** 角色对象 */ |
| | | /** |
| | | * 角色对象 |
| | | */ |
| | | @TableField(exist = false) |
| | | private List<SysRole> roles; |
| | | |
| | | /** 角色组 */ |
| | | /** |
| | | * 角色组 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Long[] roleIds; |
| | | |
| | | /** 岗位组 */ |
| | | /** |
| | | * 岗位组 |
| | | */ |
| | | @TableField(exist = false) |
| | | private Long[] postIds; |
| | | |
| | | /** 角色ID */ |
| | | /** |
| | | * 角色ID |
| | | */ |
| | | @TableField(exist = false) |
| | | private Long roleId; |
| | | |
| | | /** |
| | | * 角色类型 1=平台 2=门店 |
| | | */ |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=门店") |
| | | @TableField("role_type") |
| | | private Integer roleType; |
| | | |
| | | @Excel(name = "密码修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
| | | @TableField(exist = false) |
| | | private Date passWordUpdate; |
| | | |
| | | @ApiModelProperty(value = "对象ID") |
| | |
| | | private String forbiddenRemark; |
| | | |
| | | @ApiModelProperty(value = "前端用户id") |
| | | @TableField("app_user_id") |
| | | @TableField(exist = false) |
| | | private Long appUserId; |
| | | |
| | | @ApiModelProperty(value = "角色") |
| | |
| | | private List<String> roleNames; |
| | | |
| | | |
| | | public SysUser() { |
| | | |
| | | } |
| | | |
| | | public SysUser(Long userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public static boolean isAdmin(Long userId) { |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | | @Override |
| | | public String getRemark() { |
| | |
| | | @Override |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | public SysUser() |
| | | { |
| | | |
| | | } |
| | | |
| | | public SysUser(Long userId) |
| | | { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public Integer getRoleType() { |
| | | return roleType; |
| | | } |
| | | |
| | | public void setRoleType(Integer roleType) { |
| | | this.roleType = roleType; |
| | | } |
| | | |
| | | public Date getPassWordUpdate() { |
| | |
| | | this.objectId = objectId; |
| | | } |
| | | |
| | | public Long getUserId() |
| | | { |
| | | public Long getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) |
| | | { |
| | | public void setUserId(Long userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public boolean isAdmin() |
| | | { |
| | | public boolean isAdmin() { |
| | | return isAdmin(this.userId); |
| | | } |
| | | |
| | | public static boolean isAdmin(Long userId) |
| | | { |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | | public Long getDeptId() |
| | | { |
| | | public Long getDeptId() { |
| | | return deptId; |
| | | } |
| | | |
| | | public void setDeptId(Long deptId) |
| | | { |
| | | public void setDeptId(Long deptId) { |
| | | this.deptId = deptId; |
| | | } |
| | | |
| | | @Xss(message = "用户昵称不能包含脚本字符") |
| | | @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |
| | | public String getNickName() |
| | | { |
| | | public String getNickName() { |
| | | return nickName; |
| | | } |
| | | |
| | | public void setNickName(String nickName) |
| | | { |
| | | public void setNickName(String nickName) { |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | @Xss(message = "用户账号不能包含脚本字符") |
| | | @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |
| | | public String getUserName() |
| | | { |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) |
| | | { |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | @Email(message = "邮箱格式不正确") |
| | | @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
| | | public String getEmail() |
| | | { |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) |
| | | { |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") |
| | | public String getPhonenumber() |
| | | { |
| | | public String getPhonenumber() { |
| | | return phonenumber; |
| | | } |
| | | |
| | | public void setPhonenumber(String phonenumber) |
| | | { |
| | | public void setPhonenumber(String phonenumber) { |
| | | this.phonenumber = phonenumber; |
| | | } |
| | | |
| | | public String getSex() |
| | | { |
| | | public String getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(String sex) |
| | | { |
| | | public void setSex(String sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getAvatar() |
| | | { |
| | | public String getAvatar() { |
| | | return avatar; |
| | | } |
| | | |
| | | public void setAvatar(String avatar) |
| | | { |
| | | public void setAvatar(String avatar) { |
| | | this.avatar = avatar; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | public String getStatus() |
| | | { |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(String status) |
| | | { |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getDelFlag() |
| | | { |
| | | public String getDelFlag() { |
| | | return delFlag; |
| | | } |
| | | |
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | public void setDelFlag(String delFlag) { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public String getLoginIp() |
| | | { |
| | | public String getLoginIp() { |
| | | return loginIp; |
| | | } |
| | | |
| | | public void setLoginIp(String loginIp) |
| | | { |
| | | public void setLoginIp(String loginIp) { |
| | | this.loginIp = loginIp; |
| | | } |
| | | |
| | | public Date getLoginDate() |
| | | { |
| | | public Date getLoginDate() { |
| | | return loginDate; |
| | | } |
| | | |
| | | public void setLoginDate(Date loginDate) |
| | | { |
| | | public void setLoginDate(Date loginDate) { |
| | | this.loginDate = loginDate; |
| | | } |
| | | |
| | | public SysDept getDept() |
| | | { |
| | | public SysDept getDept() { |
| | | return dept; |
| | | } |
| | | |
| | | public void setDept(SysDept dept) |
| | | { |
| | | public void setDept(SysDept dept) { |
| | | this.dept = dept; |
| | | } |
| | | |
| | | public List<SysRole> getRoles() |
| | | { |
| | | public List<SysRole> getRoles() { |
| | | return roles; |
| | | } |
| | | |
| | | public void setRoles(List<SysRole> roles) |
| | | { |
| | | public void setRoles(List<SysRole> roles) { |
| | | this.roles = roles; |
| | | } |
| | | |
| | | public Long[] getRoleIds() |
| | | { |
| | | public Long[] getRoleIds() { |
| | | return roleIds; |
| | | } |
| | | |
| | | public void setRoleIds(Long[] roleIds) |
| | | { |
| | | public void setRoleIds(Long[] roleIds) { |
| | | this.roleIds = roleIds; |
| | | } |
| | | |
| | | public Long[] getPostIds() |
| | | { |
| | | public Long[] getPostIds() { |
| | | return postIds; |
| | | } |
| | | |
| | | public void setPostIds(Long[] postIds) |
| | | { |
| | | public void setPostIds(Long[] postIds) { |
| | | this.postIds = postIds; |
| | | } |
| | | |
| | | public Long getRoleId() |
| | | { |
| | | public Long getRoleId() { |
| | | return roleId; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) |
| | | { |
| | | public void setRoleId(Long roleId) { |
| | | this.roleId = roleId; |
| | | } |
| | | |
| | |
| | | |
| | | public void setAppUserId(Long appUserId) { |
| | | this.appUserId = appUserId; |
| | | } |
| | | |
| | | public void setRoleNames(List<String> roleNames) { |
| | | this.roleNames = roleNames; |
| | | } |
| | | |
| | | public String getForbiddenRemark() { |
| | |
| | | return roleNames; |
| | | } |
| | | |
| | | public void setRoleNames(List<String> roleNames) { |
| | | this.roleNames = roleNames; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | @ApiModelProperty(value = "发动机排量") |
| | | private String engineCapacity; |
| | | /** |
| | | * 行驶证照片 |
| | | */ |
| | | @TableField("travel_license") |
| | | @ApiModelProperty(value = "行驶证照片") |
| | | private String travelLicense; |
| | | /** |
| | | * 运输证发证机关 |
| | | */ |
| | | @TableField("transport_license_issuing_authority") |
| | |
| | | @ApiModelProperty(value = "车辆状态(1=在线,2=异常,3=离线,4=故障)") |
| | | private Integer status; |
| | | /** |
| | | * 上线时间 |
| | | */ |
| | | @TableField("online_time") |
| | | private LocalDateTime onlineTime; |
| | | /** |
| | | * 下线时间 |
| | | */ |
| | | @TableField("downline_time") |
| | | private LocalDateTime downlineTime; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @TableField("create_time") |
| | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "司机名称") |
| | | private String driverName; |
| | | /** |
| | | * 司机电话 |
| | | */ |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "司机电话") |
| | | private String driverPhone; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "驾驶证") |
| | | private String drivingLicenseNumber; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "驾驶证") |
| | | private String drivingLicense; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "驾驶时长") |
| | | private Long drivingTime; |
| | | } |
| | |
| | | /** |
| | | * ids |
| | | */ |
| | | private List<Integer> ids; |
| | | private List<Long> ids; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | */ |
| | | @TableField("code") |
| | | @ApiModelProperty(value = "订单编号") |
| | | @Excel(name = "订单编号", width = 30) |
| | | private String code; |
| | | /** |
| | | * 车辆id |
| | |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "车牌号") |
| | | @Excel(name = "车牌号", width = 30) |
| | | private String vehicleNumber; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "车牌颜色") |
| | | @Excel(name = "车牌颜色", width = 30) |
| | | private String licensePlateColor; |
| | | /** |
| | | * 驾驶员id |
| | |
| | | private Integer driverId; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "司机姓名") |
| | | private String driverName; |
| | | @ApiModelProperty(value = "驾驶证编号") |
| | | private String drivingLicenseNumber; |
| | | /** |
| | | * 企业id |
| | | */ |
| | |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "企业名称") |
| | | @Excel(name = "车辆所属公司", width = 30) |
| | | private String enterpriseName; |
| | | /** |
| | | * 下单地 |
| | |
| | | @ApiModelProperty(value = "下单地") |
| | | private String orderPlace; |
| | | /** |
| | | * 发起地区划 |
| | | */ |
| | | @TableField("order_place_code") |
| | | @ApiModelProperty(value = "发起地区划") |
| | | private String orderPlaceCode; |
| | | /** |
| | | * 上车点 |
| | | */ |
| | | @TableField("boarding_point") |
| | | @ApiModelProperty(value = "上车点") |
| | | @Excel(name = "上车地点", width = 30) |
| | | private String boardingPoint; |
| | | /** |
| | | * 下车点 |
| | | */ |
| | | @TableField("drop_off_point") |
| | | @ApiModelProperty(value = "下车点") |
| | | @Excel(name = "下车地点", width = 30) |
| | | private String dropOffPoint; |
| | | /** |
| | | * 载客里程 |
| | | */ |
| | | @TableField("passenger_mileage") |
| | | @ApiModelProperty(value = "载客里程") |
| | | @Excel(name = "载客里程", width = 30) |
| | | private String passengerMileage; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "司机姓名") |
| | | @Excel(name = "驾驶员名称", width = 30) |
| | | private String driverName; |
| | | |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "司机电话") |
| | | @Excel(name = "驾驶员电话", width = 30) |
| | | private String driverPhone; |
| | | /** |
| | | * 订单时间 |
| | | */ |
| | |
| | | */ |
| | | @TableField("order_delivery_time") |
| | | @ApiModelProperty(value = "派单时间") |
| | | @Excel(name = "派单时间", width = 30) |
| | | private String orderDeliveryTime; |
| | | /** |
| | | * 订单金额 |
| | | */ |
| | | @TableField("order_amount") |
| | | @ApiModelProperty(value = "订单金额") |
| | | @Excel(name = "订单金额", width = 30) |
| | | private String orderAmount; |
| | | /** |
| | | * 支付金额 |
| | |
| | | @TableField("warn_type") |
| | | private String warnType; |
| | | /** |
| | | * 报警等级 |
| | | */ |
| | | @TableField("warn_level") |
| | | private String warnLevel; |
| | | /** |
| | | * 报警来源 |
| | | */ |
| | | @TableField("warn_source") |
| | | private String warnSource; |
| | | /** |
| | | * 报警次数 |
| | | */ |
| | | @TableField("warn_number") |
| | |
| | | */ |
| | | @TableField("create_time") |
| | | private LocalDateTime createTime; |
| | | /** |
| | | * 原始数据id |
| | | */ |
| | | @TableField("object_id") |
| | | private Integer objectId; |
| | | } |
| | |
| | | package com.ruoyi.common.security.utils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.context.SecurityContextHolder; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * 权限获取工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SecurityUtils |
| | | { |
| | | public class SecurityUtils { |
| | | /** |
| | | * 获取用户ID |
| | | */ |
| | | public static Long getUserId() |
| | | { |
| | | public static Long getUserId() { |
| | | return SecurityContextHolder.getUserId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户名称 |
| | | */ |
| | | public static String getUsername() |
| | | { |
| | | public static String getUsername() { |
| | | return SecurityContextHolder.getUserName(); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户key |
| | | */ |
| | | public static String getUserKey() |
| | | { |
| | | public static String getUserKey() { |
| | | return SecurityContextHolder.getUserKey(); |
| | | } |
| | | |
| | | /** |
| | | * 获取登录用户信息 |
| | | */ |
| | | public static LoginUser getLoginUser() |
| | | { |
| | | public static LoginUser getLoginUser() { |
| | | return SecurityContextHolder.get(SecurityConstants.LOGIN_USER, LoginUser.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | public static String getToken() |
| | | { |
| | | public static String getToken() { |
| | | return getToken(ServletUtils.getRequest()); |
| | | } |
| | | |
| | | /** |
| | | * 根据request获取请求token |
| | | */ |
| | | public static String getToken(HttpServletRequest request) |
| | | { |
| | | public static String getToken(HttpServletRequest request) { |
| | | // 从header获取token标识 |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | return replaceTokenPrefix(token); |
| | |
| | | /** |
| | | * 裁剪token前缀 |
| | | */ |
| | | public static String replaceTokenPrefix(String token) |
| | | { |
| | | public static String replaceTokenPrefix(String token) { |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) |
| | | { |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, ""); |
| | | } |
| | | return token; |
| | |
| | | * @param userId 用户ID |
| | | * @return 结果 |
| | | */ |
| | | public static boolean isAdmin(Long userId) |
| | | { |
| | | public static boolean isAdmin(Long userId) { |
| | | return userId != null && 1L == userId; |
| | | } |
| | | |
| | |
| | | * @param password 密码 |
| | | * @return 加密字符串 |
| | | */ |
| | | public static String encryptPassword(String password) |
| | | { |
| | | public static String encryptPassword(String password) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.encode(password); |
| | | } |
| | |
| | | * @param encodedPassword 加密后字符 |
| | | * @return 结果 |
| | | */ |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) |
| | | { |
| | | public static boolean matchesPassword(String rawPassword, String encodedPassword) { |
| | | BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); |
| | | return passwordEncoder.matches(rawPassword, encodedPassword); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | String s = encryptPassword("0192023a7bbd73250516f069df18b500"); |
| | | String s = encryptPassword("0173940ec8314d1671c2ba365d28fcc1"); |
| | | System.err.println(s); |
| | | |
| | | // System.err.println(matchesPassword("c4ca4238a0b923820dcc509a6f75849b", "$2a$10$/7z/wiZ2ejTjD4GQuuyiSe1ptS8uoxrRAUlGCitiLEmpOO78cISeq")); |
| | |
| | | package com.ruoyi.gateway.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.gateway.config.GatewayProperties; |
| | | import org.springframework.cloud.gateway.route.RouteLocator; |
| | |
| | | import springfox.documentation.swagger.web.SwaggerResource; |
| | | import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 聚合系统接口 |
| | | * |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-dataInterchange</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>3.5.4</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | <version>3.3.0</version> |
| | | <type>pom</type> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.util.List; |
| | |
| | | Driver driver = driverService.getOne(new LambdaQueryWrapper<Driver>().eq(Driver::getVehicleNumber, car.getVehicleNumber()).eq(Driver::getStatus, 1)); |
| | | Enterprise enterprise = enterpriseService.getById(car.getEnterpriseId()); |
| | | car.setEnterpriseName(enterprise.getName()); |
| | | if (null != driver) { |
| | | car.setDriverName(driver.getName()); |
| | | car.setDriverPhone(driver.getPhone()); |
| | | car.setDrivingLicenseNumber(driver.getDrivingLicenceFile()); |
| | | } |
| | | return R.ok(car); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "获取车辆状态汇总数据和公司总数等", tags = {"首页"}) |
| | | public R<CarStatusCount> getCarStatusCount() { |
| | | List<Car> list = carService.list(); |
| | | long online = list.stream().filter(s -> s.getStatus() == 1).count(); |
| | | long offline = list.stream().filter(s -> s.getStatus() == 3).count(); |
| | | long breakdown = list.stream().filter(s -> s.getStatus() == 4).count(); |
| | | long abnormal = list.stream().filter(s -> s.getStatus() == 2).count(); |
| | | long online = list.isEmpty() ? 0 : list.stream().filter(s -> s.getStatus() == 1).count(); |
| | | long offline = list.isEmpty() ? 0 : list.stream().filter(s -> s.getStatus() == 3).count(); |
| | | long breakdown = list.isEmpty() ? 0 : list.stream().filter(s -> s.getStatus() == 4).count(); |
| | | long abnormal = list.isEmpty() ? 0 : list.stream().filter(s -> s.getStatus() == 2).count(); |
| | | CarStatusCount carStatusCount = new CarStatusCount(); |
| | | carStatusCount.setOffline(offline); |
| | | carStatusCount.setOnline(online); |
| | |
| | | @GetMapping("/getMapCarList") |
| | | @ApiOperation(value = "获取地图司机数据", tags = {"首页"}) |
| | | public R<List<Car>> getMapCarList() { |
| | | List<Car> list = carService.list(); |
| | | List<Car> list = carService.list(new LambdaQueryWrapper<Car>().eq(Car::getStatus, 1)); |
| | | for (Car car : list) { |
| | | Long s = (null == car.getDownlineTime() ? LocalDateTime.now() : car.getDownlineTime()).toEpochSecond(ZoneOffset.ofHours(8)) - car.getOnlineTime().toEpochSecond(ZoneOffset.ofHours(8)); |
| | | car.setDrivingTime(s / 60); |
| | | GnssDataVo gnssDataVo = (GnssDataVo) redisTemplate.opsForValue().get("location:" + car.getVehicleNumber()); |
| | | car.setLongitude(Double.valueOf(gnssDataVo.getLon() / 1000000).toString()); |
| | | car.setLatitude(Double.valueOf(gnssDataVo.getLat() / 1000000).toString()); |
| | | if (null != gnssDataVo) { |
| | | car.setLongitude(new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString()); |
| | | car.setLatitude(new BigDecimal(gnssDataVo.getLat()).divide(new BigDecimal(1000000)).toString()); |
| | | } |
| | | } |
| | | return R.ok(list); |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.query.ComplainListReq; |
| | | import com.ruoyi.system.query.ComplainListResp; |
| | | import com.ruoyi.system.service.IComplainService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/exportComplainList") |
| | | @ApiOperation(value = "导出投诉记录列表", tags = {"投诉记录"}) |
| | | public void exportComplainList(ComplainListReq complainListReq, HttpServletResponse response) { |
| | | complainListReq.setPageSize(99999); |
| | | PageInfo<ComplainListResp> page = complainService.getComplainList(complainListReq); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), ComplainListResp.class, page.getRecords()); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("投诉记录.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.dataInterchange.api.feignClient.PlaybackMsgClient; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneOffset; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; /** |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/3/24 17:50 |
| | | */ |
| | |
| | | private PlaybackMsgClient playbackMsgClient; |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("/getOrderList") |
| | | @ApiOperation(value = "获取订单列表", tags = {"车辆管理", "订单管理"}) |
| | | public R<PageInfo<Order>> getOrderList(OrderListReq req){ |
| | |
| | | return R.ok(orderList); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/exportOrderList") |
| | | @ApiOperation(value = "导出订单列表", tags = {"订单管理"}) |
| | | public void exportOrderList(OrderListReq req, HttpServletResponse response) { |
| | | req.setPageSize(99999); |
| | | PageInfo<Order> orderList = orderService.getOrderList(req); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), Order.class, orderList.getRecords()); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("订单列表.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getOrderInfo/{id}") |
| | |
| | | Driver driver = driverService.getById(order.getDriverId()); |
| | | Car car = carService.getById(order.getCarId()); |
| | | Enterprise enterprise = enterpriseService.getById(order.getEnterpriseId()); |
| | | if (null != driver) { |
| | | order.setDriverName(driver.getName()); |
| | | order.setDriverPhone(driver.getPhone()); |
| | | order.setDrivingLicenseNumber(driver.getDrivingLicenseNumber()); |
| | | } |
| | | order.setVehicleNumber(car.getVehicleNumber()); |
| | | order.setEnterpriseName(enterprise.getName()); |
| | | return R.ok(order); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getOrderTravel") |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true) |
| | | }) |
| | | public R<List<OrderTravelVo>> getOrderTravel(@PathVariable("id") Integer id){ |
| | | public R<List<OrderTravelVo>> getOrderTravel(Integer id) { |
| | | Order order = orderService.getById(id); |
| | | if(null == order){ |
| | | return R.fail("失败"); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getOrderMonitoring") |
| | | @ApiOperation(value = "获取订单监控", tags = {"订单管理"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "订单id", name = "id", required = true) |
| | | }) |
| | | public R<RealVideoResp> getOrderMonitoring(@PathVariable("id") Integer id){ |
| | | public R<RealVideoResp> getOrderMonitoring(Integer id) { |
| | | Order order = orderService.getById(id); |
| | | if(null == order){ |
| | | return R.fail("失败"); |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | * 获取部门列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @ApiOperation(value = "获取部门列表", tags = {"管理后台-部门管理"}) |
| | | public AjaxResult list(SysDept dept) { |
| | | List<SysDept> depts = deptService.selectDeptList(dept); |
| | | return success(depts); |
| | |
| | | * 新增部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @ApiOperation(value = "添加部门", tags = {"管理后台-部门管理"}) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysDept dept) { |
| | | if (!deptService.checkDeptNameUnique(dept)) { |
| | |
| | | * 修改部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "编辑部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @ApiOperation(value = "编辑部门", tags = {"管理后台-部门管理"}) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysDept dept) { |
| | | Long deptId = dept.getDeptId(); |
| | |
| | | * 删除部门 |
| | | */ |
| | | @Log(title = "部门管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除部门", tags = {"管理后台-部门管理", "门店后台-部门管理"}) |
| | | @ApiOperation(value = "删除部门", tags = {"管理后台-部门管理"}) |
| | | @DeleteMapping("/{deptId}") |
| | | public AjaxResult remove(@PathVariable Long deptId) |
| | | { |
| | |
| | | ajax.put("posts", postService.selectPostAll()); |
| | | if (StringUtils.isNotNull(userId)) { |
| | | SysUser sysUser = userService.selectUserById(userId); |
| | | if (sysUser.getRoleType() == 2) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser1 = userService.selectUserById(userid); |
| | | UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, sysUser.getUserId()).eq(UserShop::getShopId, sysUser1.getObjectId())); |
| | | sysUser.setDeptId(one.getDeptId()); |
| | | sysUser.setNickName(one.getNickName()); |
| | | SysDept sysDept = deptService.selectDeptById(one.getDeptId()); |
| | | sysUser.setDept(sysDept); |
| | | sysUser.setRoleId(one.getRoleId()); |
| | | } |
| | | |
| | | ajax.put("data", sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | |
| | | } |
| | | user.setCreateBy(SecurityUtils.getUsername()); |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | if (null == user.getRoleType()) { |
| | | user.setRoleType(1); |
| | | } |
| | | userService.insertUser(user); |
| | | SysUserRole sysUserRole = new SysUserRole(); |
| | | sysUserRole.setRoleId(user.getRoleId()); |
| | |
| | | @PostMapping("/saveShopUser") |
| | | public R<Long> saveShopUser(@RequestBody SysUser user) { |
| | | SysUser one = userService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getPhonenumber, user.getPhonenumber()).eq(SysUser::getDelFlag, "0") |
| | | .eq(SysUser::getStatus, "0").eq(SysUser::getRoleType, 2)); |
| | | .eq(SysUser::getStatus, "0")); |
| | | if (null == one) { |
| | | user.setPassword(SecurityUtils.encryptPassword(user.getPassword())); |
| | | userService.save(user); |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PutMapping("/switchShop/{shopId}") |
| | | @ApiOperation(value = "切换门店", tags = {"门店后台-首页"}) |
| | | public R<Set<String>> switchShop(@PathVariable("shopId") Integer shopId) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, userid).eq(UserShop::getShopId, shopId)); |
| | | if (null == one) { |
| | | return R.fail("切换失败"); |
| | | } |
| | | SysUser sysUser = userService.getById(userid); |
| | | sysUser.setObjectId(shopId); |
| | | userService.updateById(sysUser); |
| | | //查询用户权限列表 |
| | | Long roleId = one.getRoleId(); |
| | | Set<String> rolePerms = menuService.selectMenuPermsByRoleId(roleId); |
| | | return R.ok(rolePerms); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 通过账号和账号权限查询用户 |
| | | * |
| | |
| | | .eq(SysUser::getUserName, userName) |
| | | .eq(SysUser::getDelFlag, "0") |
| | | .eq(SysUser::getStatus, 0) |
| | | .eq(SysUser::getRoleType, roleType) |
| | | .last("LIMIT 1")); |
| | | return R.ok(user); |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import com.ruoyi.system.service.IWarnService; |
| | | import com.ruoyi.system.util.GDMapGeocodingUtil; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/exportCarWarnList") |
| | | @ApiOperation(value = "导出车辆预警列表数据", tags = {"预警记录"}) |
| | | public void exportCarWarnList(CarWarnListReq carWarnListReq, HttpServletResponse response) { |
| | | carWarnListReq.setPageSize(99999); |
| | | PageInfo<CarWarnListResp> pageInfo = warnService.getCarWarnList(carWarnListReq); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), CarWarnListResp.class, pageInfo.getRecords()); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("预警记录.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getCarWarnInfo") |
| | | @ApiOperation(value = "获取车辆预警详情数据", tags = {"车辆管理", "预警记录"}) |
| | | public R<CarWarnInfoResp> getCarWarnInfo(@PathVariable("vehicleNumber") String vehicleNumber) { |
| | | public R<CarWarnInfoResp> getCarWarnInfo(String vehicleNumber) { |
| | | Car car = carService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getVehicleNumber, vehicleNumber)); |
| | | if (null == car) { |
| | | return R.ok(); |
| | |
| | | carWarnInfoResp.setSpeed(new BigDecimal(gnssDataVo.getVec1())); |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = GDMapGeocodingUtil.geocode(Double.valueOf(gnssDataVo.getLon() / 1000000).toString(), Double.valueOf(gnssDataVo.getLat() / 1000000).toString()); |
| | | String longitude = new BigDecimal(gnssDataVo.getLon()).divide(new BigDecimal(1000000)).toString(); |
| | | String latitude = new BigDecimal(gnssDataVo.getLat()).divide(new BigDecimal(1000000)).toString(); |
| | | geocode = GDMapGeocodingUtil.geocode(longitude, latitude); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysRoleMapper extends BaseMapper<SysRole> |
| | | { |
| | | public interface SysRoleMapper extends BaseMapper<SysRole> { |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | List<SysRole> getSysRoleByIds(@Param("ids") List<Integer> ids); |
| | | List<SysRole> getSysRoleByIds(@Param("ids") List<Long> ids); |
| | | } |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; /** |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2025/3/27 13:49 |
| | | */ |
| | |
| | | @ApiModel |
| | | public class CarWarnListResp { |
| | | @ApiModelProperty("车辆名称") |
| | | @Excel(name = "车辆名称", width = 30) |
| | | private String carName; |
| | | @ApiModelProperty("车牌号") |
| | | @Excel(name = "车牌号码", width = 30) |
| | | private String vehicleNumber; |
| | | @ApiModelProperty("持续报警") |
| | | private String keepWarn; |
| | | @ApiModelProperty("驾驶员名称") |
| | | @Excel(name = "驾驶员名称", width = 30) |
| | | private String driverName; |
| | | @ApiModelProperty("所属公司") |
| | | @Excel(name = "所属公司", width = 30) |
| | | private String enterpriseName; |
| | | @ApiModelProperty("终端编号") |
| | | @Excel(name = "终端编号", width = 30) |
| | | private String terminalNumber; |
| | | @ApiModelProperty("开始报警时间") |
| | | @Excel(name = "开始报警时间", width = 30) |
| | | private String startTime; |
| | | @ApiModelProperty("结束报警时间") |
| | | @Excel(name = "结束报警时间", width = 30) |
| | | private String endTime; |
| | | @ApiModelProperty("持续报警") |
| | | private String keepWarn; |
| | | @ApiModelProperty("持续时长") |
| | | @Excel(name = "持续时长", width = 30) |
| | | private Integer keepTime; |
| | | @ApiModelProperty("持续里程") |
| | | @Excel(name = "持续里程", width = 30) |
| | | private BigDecimal keepDistance; |
| | | @ApiModelProperty("报警类型") |
| | | @Excel(name = "报警类型", width = 30) |
| | | private String warnType; |
| | | @ApiModelProperty("报警等级") |
| | | @Excel(name = "报警等级", width = 30) |
| | | private String warnLevel; |
| | | @ApiModelProperty("报警次数") |
| | | @Excel(name = "报警次数", width = 30) |
| | | private Integer warnNumber; |
| | | @ApiModelProperty("报警来源") |
| | | @Excel(name = "报警来源", width = 30) |
| | | private String warnSource; |
| | | @ApiModelProperty("处理状态") |
| | | @Excel(name = "处理状态", width = 30) |
| | | private String treatmentState; |
| | | @ApiModelProperty("处理人") |
| | | @Excel(name = "处理人", width = 30) |
| | | private String treatmentUser; |
| | | @ApiModelProperty("处理时间") |
| | | @Excel(name = "处理时间", width = 30) |
| | | private String treatmentTime; |
| | | @ApiModelProperty("处理描述") |
| | | @Excel(name = "处理描述", width = 30) |
| | | private String treatmentRemark; |
| | | } |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @ApiModel |
| | | public class ComplainListResp { |
| | | @ApiModelProperty("车辆名称") |
| | | @Excel(name = "车辆名称", width = 30) |
| | | private String carName; |
| | | @ApiModelProperty("车牌号") |
| | | @Excel(name = "车牌号码", width = 30) |
| | | private String vehicleNumber; |
| | | @ApiModelProperty("投诉内容") |
| | | @Excel(name = "投诉内容", width = 30) |
| | | private String content; |
| | | @ApiModelProperty("投诉人电话") |
| | | @Excel(name = "投诉人电话", width = 30) |
| | | private String complainPhone; |
| | | @ApiModelProperty("驾驶员名称") |
| | | private String driverName; |
| | | @ApiModelProperty("所属公司") |
| | | @Excel(name = "被投诉所属公司", width = 30) |
| | | private String enterpriseName; |
| | | @ApiModelProperty("驾驶员名称") |
| | | @Excel(name = "被投诉驾驶员", width = 30) |
| | | private String driverName; |
| | | @ApiModelProperty("投诉时间") |
| | | @Excel(name = "投诉时间", width = 30) |
| | | private String complainTime; |
| | | @ApiModelProperty("处理状态") |
| | | @Excel(name = "处理状态", width = 30) |
| | | private String treatmentState; |
| | | @ApiModelProperty("处理人") |
| | | @Excel(name = "处理人", width = 30) |
| | | private String treatmentUser; |
| | | @ApiModelProperty("处理时间") |
| | | @Excel(name = "处理时间", width = 30) |
| | | private String treatmentTime; |
| | | @ApiModelProperty("处理描述") |
| | | @Excel(name = "处理描述", width = 30) |
| | | private String treatmentRemark; |
| | | } |
| | |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface ISysRoleService extends IService<SysRole> |
| | | { |
| | | public interface ISysRoleService extends IService<SysRole> { |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param ids 数据id集合 |
| | | * @return |
| | | */ |
| | | List<SysRole> getSysRoleByIds(List<Integer> ids); |
| | | List<SysRole> getSysRoleByIds(List<Long> ids); |
| | | } |
| | |
| | | */ |
| | | void taskSaveNewWarn(); |
| | | |
| | | /** |
| | | * 定时任务修改预警信息处理结果 |
| | | */ |
| | | void taskUpdateWarnStatus(); |
| | | |
| | | |
| | | /** |
| | | * 获取车辆预警列表 |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.dataInterchange.api.feignClient.UPExgMsgRegisterClient; |
| | |
| | | public void taskUpdateCarStatus() { |
| | | List<Car> list = this.list(); |
| | | for (Car car : list) { |
| | | LambdaUpdateWrapper<Car> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | GnssDataVo gnssDataVo = (GnssDataVo) redisTemplate.opsForValue().get("location:" + car.getVehicleNumber()); |
| | | if (null == gnssDataVo) { |
| | | car.setStatus(1); |
| | | if (car.getStatus() == 1) { |
| | | updateWrapper.set(Car::getDownlineTime, LocalDateTime.now()); |
| | | } |
| | | updateWrapper.set(Car::getStatus, 4); |
| | | this.update(updateWrapper); |
| | | } else { |
| | | String dateTime = gnssDataVo.getDate() + " " + gnssDataVo.getTime(); |
| | | LocalDateTime localDateTime = LocalDateTime.parse(dateTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | long second = localDateTime.toEpochSecond(ZoneOffset.ofHours(8)); |
| | | if (System.currentTimeMillis() / 1000 > second + 60) { |
| | | car.setStatus(4); |
| | | if (car.getStatus() == 1) { |
| | | updateWrapper.set(Car::getDownlineTime, LocalDateTime.now()); |
| | | } |
| | | updateWrapper.set(Car::getStatus, 4); |
| | | this.update(updateWrapper); |
| | | } else { |
| | | car.setStatus(1); |
| | | if (car.getStatus() != 1) { |
| | | updateWrapper.set(Car::getDownlineTime, null); |
| | | updateWrapper.set(Car::getOnlineTime, LocalDateTime.now()); |
| | | } |
| | | updateWrapper.set(Car::getStatus, 1); |
| | | this.update(updateWrapper); |
| | | } |
| | | } |
| | | } |
| | | if (list.size() > 0) { |
| | | this.updateBatchById(list); |
| | | } |
| | | } |
| | | } |
| | |
| | | public List<SysDept> selectDeptList(SysDept dept) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | return deptMapper.selectDeptList(dept); |
| | | } |
| | | |
| | |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | return deptMapper.insertDept(dept); |
| | | } |
| | | |
| | |
| | | //判断店铺数据 |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserService.getById(userid); |
| | | if(sysUser.getRoleType() == 2){ |
| | | dept.setShopId(sysUser.getObjectId()); |
| | | } |
| | | int result = deptMapper.updateDept(dept); |
| | | if (UserConstants.DEPT_NORMAL.equals(dept.getStatus()) && StringUtils.isNotEmpty(dept.getAncestors()) |
| | | && !StringUtils.equals("0", dept.getAncestors())) |
| | |
| | | SysUser sysUser = sysUserMapper.selectById(userid); |
| | | SysUserRole sysUserRole = sysUserRoleMapper.selectSysUserRoleByUserId(userid); |
| | | Long roleId = sysUserRole.getRoleId(); |
| | | List<SysMenus> list=null; |
| | | if(roleId!=1){ |
| | | list = menuMapper.getAllOne(sysUser.getRoleType()); |
| | | }else { |
| | | list = menuMapper.getAll(); |
| | | } |
| | | List<SysMenus> list = menuMapper.getAll(); |
| | | |
| | | // 获取所有 |
| | | |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.UserShop; |
| | | import com.ruoyi.system.domain.SysMenu; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | import com.ruoyi.system.service.ISysPermissionService; |
| | | import com.ruoyi.system.service.ISysRoleService; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 用户权限处理 |
| | |
| | | * @return 角色权限信息 |
| | | */ |
| | | @Override |
| | | public Set<String> getRolePermission(SysUser user) |
| | | { |
| | | public Set<String> getRolePermission(SysUser user) { |
| | | Set<String> roles = new HashSet<String>(); |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) |
| | | { |
| | | if (user.isAdmin()) { |
| | | roles.add("admin"); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | roles.addAll(roleService.selectRolePermissionByUserId(user)); |
| | | } |
| | | return roles; |
| | |
| | | * @return 菜单权限信息 |
| | | */ |
| | | @Override |
| | | public Set<String> getMenuPermission(SysUser user) |
| | | { |
| | | public Set<String> getMenuPermission(SysUser user) { |
| | | Set<String> perms = new HashSet<String>(); |
| | | List<UserShop> userShop = userShopService.getUserShop(user.getUserId(), 1); |
| | | // 管理员拥有所有权限 |
| | | if (user.isAdmin()) |
| | | { |
| | | if (user.isAdmin()) { |
| | | perms.add("*:*:*"); |
| | | }else if(user.getRoleType() == 2 && null != userShop && userShop.size() > 0){ |
| | | List<SysMenu> list = menuService.getAllMenu(2); |
| | | return list.stream().map(SysMenu::getPath).collect(Collectors.toSet()); |
| | | } |
| | | else |
| | | { |
| | | } else { |
| | | List<SysRole> roles = user.getRoles(); |
| | | if (!roles.isEmpty() && roles.size() > 1) |
| | | { |
| | | if (!roles.isEmpty() && roles.size() > 1) { |
| | | // 多角色设置permissions属性,以便数据权限匹配权限 |
| | | for (SysRole role : roles) |
| | | { |
| | | for (SysRole role : roles) { |
| | | Set<String> rolePerms = menuService.selectMenuPermsByRoleId(role.getRoleId()); |
| | | role.setPermissions(rolePerms); |
| | | perms.addAll(rolePerms); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(user.getRoleType() == 1){ |
| | | perms.addAll(menuService.selectMenuPermsByUserId(user.getUserId())); |
| | | }else{ |
| | | UserShop one = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()).eq(UserShop::getShopId, user.getObjectId())); |
| | | perms.addAll(menuService.selectMenuPermsByRoleId(one.getRoleId())); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.constant.UserConstants; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.model.UserShop; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | |
| | | |
| | | @Resource |
| | | private UserShopService userShopService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(SysUser user) { |
| | | Set<String> permsSet = new HashSet<>(); |
| | | if(user.getRoleType() == 1){ |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(user.getUserId()); |
| | | for (SysRole perm : perms) { |
| | | if (StringUtils.isNotNull(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | | }else{ |
| | | List<UserShop> list = userShopService.list(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, user.getUserId()) |
| | | .eq(UserShop::getShopId, user.getObjectId())); |
| | | for (UserShop userShop : list) { |
| | | if (StringUtils.isNotNull(userShop)) { |
| | | permsSet.add(userShop.getRoleId() + ""); |
| | | } |
| | | } |
| | | } |
| | | return permsSet; |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysRole> getSysRoleByIds(List<Integer> ids) { |
| | | public List<SysRole> getSysRoleByIds(List<Long> ids) { |
| | | return this.baseMapper.getSysRoleByIds(ids); |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public PageInfo<SysUser> getChangeUserList(ChangeUserQuery query) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser1 = this.getById(userid); |
| | | if (sysUser1.getRoleType() == 2) { |
| | | query.setObjectId(sysUser1.getObjectId()); |
| | | } |
| | | PageInfo<SysUser> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | List<SysUser> list = this.baseMapper.getChangeUserList(pageInfo, query); |
| | | return pageInfo.setRecords(list); |
| | |
| | | warn.setWarnType(WarnType.getWarnTypeName(vo.getWarnType())); |
| | | warn.setWarnNumber(1); |
| | | warn.setSpeed(new BigDecimal(vo.getSpeed())); |
| | | warn.setLongitude(Double.valueOf(vo.getLongitude()).toString()); |
| | | warn.setLatitude(Double.valueOf(vo.getLatitude()).toString()); |
| | | warn.setLongitude(new BigDecimal(vo.getLongitude()).divide(new BigDecimal(1000000)).toString()); |
| | | warn.setLatitude(new BigDecimal(vo.getLatitude()).divide(new BigDecimal(1000000)).toString()); |
| | | Map<String, String> geocode = null; |
| | | try { |
| | | geocode = GDMapGeocodingUtil.geocode(warn.getLongitude(), warn.getLatitude()); |
| | |
| | | break; |
| | | } |
| | | warn.setCreateTime(LocalDateTime.now()); |
| | | warn.setObjectId(vo.getInfoId()); |
| | | warns.add(warn); |
| | | } |
| | | if (warns.size() > 0) { |
| | | this.saveBatch(warns); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改预警信息处理结果 |
| | | */ |
| | | @Override |
| | | public void taskUpdateWarnStatus() { |
| | | List<Warn> warnList = this.list(new LambdaQueryWrapper<Warn>().eq(Warn::getTreatmentState, "处理中")); |
| | | for (Warn warn : warnList) { |
| | | UPWarnMsgAdptInfoVo vo = upWarnMsgAdptInfoClient.findByInfoId(warn.getObjectId()).getData(); |
| | | if (null != vo && null != warn && vo.getResult() != 0x00) { |
| | | switch (vo.getResult()) { |
| | | case 0x00: |
| | | warn.setTreatmentState("处理中"); |
| | | break; |
| | | case 0x01: |
| | | warn.setTreatmentState("已处理完毕"); |
| | | break; |
| | | case 0x02: |
| | | warn.setTreatmentState("不作处理"); |
| | | break; |
| | | case 0x03: |
| | | warn.setTreatmentState("将来处理"); |
| | | break; |
| | | } |
| | | this.updateById(warn); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取车辆预警 |
| | |
| | | for (Map<String, Object> map : list) { |
| | | collect.add(map.get("warnType").toString()); |
| | | } |
| | | if (!collect.isEmpty()) { |
| | | List<Map<String, Object>> warnGroupCount = this.baseMapper.getWarnGroupCount(collect); |
| | | list.addAll(warnGroupCount); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 定时任务修改预警信息处理结果 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 600) |
| | | public void taskUpdateWarnStatus() { |
| | | warnService.taskUpdateWarnStatus(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务获取新订单数据 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | |
| | | /** |
| | | * 定时任务修改车辆状态 |
| | | */ |
| | | @Scheduled(fixedRate = 1000 * 60 * 5) |
| | | @Scheduled(fixedRate = 1000 * 300) |
| | | public void taskUpdateCarStatus() { |
| | | carService.taskUpdateCarStatus(); |
| | | } |
| | |
| | | <result property="updateTime" column="update_time"/> |
| | | <result property="forbiddenRemark" column="forbidden_remark"/> |
| | | <result property="remark" column="remark"/> |
| | | <result property="roleType" column="role_type"/> |
| | | <result property="objectId" column="objectId"/> |
| | | <association property="dept" column="dept_id" javaType="com.ruoyi.system.api.domain.SysDept" |
| | | resultMap="deptResult"/> |
| | |
| | | u.del_flag, |
| | | u.login_ip, |
| | | u.login_date, |
| | | u.role_type, |
| | | u.create_by, |
| | | u.create_time, |
| | | u.remark, |
| | |
| | | r.role_key, |
| | | r.data_scope, |
| | | r.status as role_status, |
| | | u.role_type as roleType, |
| | | u.objectId AS objectId |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | |
| | | <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.user_name = #{userName} and u.del_flag = '0' |
| | | and u.role_type = 1 |
| | | </select> |
| | | <select id="selectUserShopByUserName" parameterType="String" resultMap="SysUserResult"> |
| | | <include refid="selectUserVo"/> |
| | | where u.user_name = #{userName} and u.del_flag = '0' |
| | | and u.role_type = 2 |
| | | </select> |
| | | |
| | | <select id="selectUserById" parameterType="Long" resultMap="SysUserResult"> |
| | |
| | | </select> |
| | | <select id="getAllList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,user_id userId,nick_name userName ,create_time createTime ,login_date loginDate from sys_user where |
| | | role_type=3 and user_id in |
| | | |
| | | user_id in |
| | | <foreach collection="ids" separator="," open="(" item="id" index="index" close=")"> |
| | | #{id} |
| | | </foreach> |
| | |
| | | and objectId = #{query.objectId} |
| | | </if> |
| | | AND del_flag = '0' |
| | | AND role_type = 1 |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | <if test="password != null and password != ''">password,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | <if test="roleType != null and roleType != ''">role_type,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="objectId != null and objectId != ''">objectId,</if> |
| | | <if test="appUserId != null and appUserId != ''">app_user_id,</if> |
| | |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="forbiddenRemark != null">forbidden_remark = #{forbiddenRemark},</if> |
| | | <if test="roleType != null">role_type = #{roleType},</if> |
| | | <if test="objectId != null">objectId = #{objectId},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | |
| | | update sys_user |
| | | set password = #{password} |
| | | where user_name = #{userName} |
| | | and role_type = 1 |
| | | </update> |
| | | <update id="resetUserShopPwd" parameterType="com.ruoyi.system.api.domain.SysUser"> |
| | | update sys_user |
| | | set password = #{password} |
| | | where user_name = #{userName} |
| | | and role_type = 2 |
| | | </update> |
| | | |
| | | <update id="deleteUserById" parameterType="Long"> |
| | |
| | | a.keep_time as keepTime, |
| | | a.keep_distance as keepDistance, |
| | | a.warn_type as warnType, |
| | | a.warn_level as warnLevel, |
| | | a.warn_source as warnSource, |
| | | a.warn_number as warnNumber, |
| | | a.treatment_state as treatmentState, |
| | | a.treatment_user as treatmentUser, |
| | |
| | | <artifactId>ruoyi-service</artifactId> |
| | | <version>3.6.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | <modelVersion>4.0.0</modelVersion>Long |
| | | |
| | | <artifactId>ruoyi-modules-dataInterchange</artifactId> |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | |
| | | UPExgMsgRealLocation realLocation = upExgMsgRealLocationDao.findByVehicleNoOrderByCreateTimeDesc(register.getVehicleNo()); |
| | | if (null != realLocation) { |
| | | GnssData gnssData = realLocation.getGnssData(); |
| | | vo.setLongitude(Double.valueOf(gnssData.getLon() / 1000000).toString()); |
| | | vo.setLatitude(Double.valueOf(gnssData.getLat() / 1000000).toString()); |
| | | String longitude = new BigDecimal(gnssData.getLon()).divide(new BigDecimal(1000000)).toString(); |
| | | String latitude = new BigDecimal(gnssData.getLat()).divide(new BigDecimal(1000000)).toString(); |
| | | vo.setLongitude(longitude); |
| | | vo.setLatitude(latitude); |
| | | } |
| | | voList.add(vo); |
| | | } |
| | |
| | | UPExgMsgRealLocation realLocation = upExgMsgRealLocationDao.findByVehicleNoOrderByCreateTimeDesc(register.getVehicleNo()); |
| | | if (null != realLocation) { |
| | | GnssData gnssData = realLocation.getGnssData(); |
| | | vo.setLongitude(Double.valueOf(gnssData.getLon() / 1000000).toString()); |
| | | vo.setLatitude(Double.valueOf(gnssData.getLat() / 1000000).toString()); |
| | | String longitude = new BigDecimal(gnssData.getLon()).divide(new BigDecimal(1000000)).toString(); |
| | | String latitude = new BigDecimal(gnssData.getLat()).divide(new BigDecimal(1000000)).toString(); |
| | | vo.setLongitude(longitude); |
| | | vo.setLatitude(latitude); |
| | | } |
| | | voList.add(vo); |
| | | } |
| | |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据信息id查询报警原始数据 |
| | | * |
| | | * @param infoId |
| | | * @return |
| | | */ |
| | | @PostMapping("/findByInfoId") |
| | | public R<UPWarnMsgAdptInfoVo> findByInfoId(@RequestParam("infoId") Integer infoId) { |
| | | UPWarnMsgAdptInfo warnMsgAdptInfo = upWarnMsgAdptInfoDao.findByInfoIdIs(infoId); |
| | | UPWarnMsgAdptInfoVo vo = new UPWarnMsgAdptInfoVo(); |
| | | BeanUtils.copyProperties(warnMsgAdptInfo, vo); |
| | | return R.ok(vo); |
| | | } |
| | | } |
| | |
| | | */ |
| | | List<UPWarnMsgAdptInfo> findByCreateTimeAfter(Long createTime); |
| | | |
| | | |
| | | /** |
| | | * 根据信息id查询数据 |
| | | * |
| | | * @param infoId |
| | | * @return |
| | | */ |
| | | UPWarnMsgAdptInfo findByInfoIdIs(Integer infoId); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.dataInterchange.model; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.ByteBufUtil; |
| | | import io.netty.buffer.Unpooled; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 补报车辆静态信息请求 |
| | | * |
| | | * @author zhibing.pu |
| | | * @Date 2025/3/3 17:24 |
| | | */ |
| | |
| | | * 车牌颜色 |
| | | */ |
| | | @JsonProperty("VEHICLE_COLOR") |
| | | private String vehicleColor; |
| | | private int vehicleColor; |
| | | /** |
| | | * 子业务类型标识 |
| | | */ |
| | | @JsonProperty("DATA_TYPE") |
| | | private String dataType; |
| | | private int dataType; |
| | | /** |
| | | * 后续数据长度 |
| | | */ |
| | | @JsonProperty("DATA_LENGTH") |
| | | private String dataLength; |
| | | private int dataLength; |
| | | |
| | | |
| | | /** |
| | | * 编码报文 |
| | | */ |
| | | public byte[] encode() { |
| | | ByteBuf byteBuf = Unpooled.buffer(28); |
| | | byte[] bytes1 = this.getVehicleNo().getBytes(); |
| | | for (int i = 0; i < 21; i++) { |
| | | if (i < bytes1.length) { |
| | | byteBuf.writeByte(bytes1[i]); |
| | | } else { |
| | | byteBuf.writeByte(0x00); |
| | | } |
| | | } |
| | | byteBuf.writeByte(this.getVehicleColor()); |
| | | byteBuf.writeShort(this.getDataType()); |
| | | byteBuf.writeInt(this.getDataLength()); |
| | | byte[] bytes = ByteBufUtil.getBytes(byteBuf); |
| | | byteBuf.release(); |
| | | return bytes; |
| | | } |
| | | } |
| | |
| | | GnssDataVo vo = new GnssDataVo(); |
| | | BeanUtils.copyProperties(upExgMsgRealLocation.getGnssData(), vo); |
| | | redisTemplate.opsForValue().set("location:" + upExgMsgRealLocation.getVehicleNo(), vo); |
| | | //查询车辆信息,没有则主动发起请求 |
| | | UPExgMsgRegister msgRegister = upExgMsgRegisterDao.findByVehicleNo(upExgMsgRealLocation.getVehicleNo()); |
| | | if (null == msgRegister) { |
| | | down_base_msg_vehicle_added(inferiorPlatformId, upExgMsgRealLocation.getVehicleNo(), upExgMsgRealLocation.getVehicleColor()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 补报车辆静态信息 |
| | | */ |
| | | public void down_base_msg_vehicle_added(int inferiorPlatformId, String vehicleNo, int VehicleColor) { |
| | | if (!redisTemplate.hasKey("login:" + inferiorPlatformId)) { |
| | | log.error("链路还未登录校验,拒绝连接"); |
| | | return; |
| | | } |
| | | DOWNBaseMsgVehicleAdded downBaseMsgVehicleAdded = new DOWNBaseMsgVehicleAdded(); |
| | | downBaseMsgVehicleAdded.setVehicleNo(vehicleNo); |
| | | downBaseMsgVehicleAdded.setVehicleColor(VehicleColor); |
| | | downBaseMsgVehicleAdded.setDataType(DataType.DOWN_BASE_MSG_VEHICLE_ADDED.getCode()); |
| | | downBaseMsgVehicleAdded.setDataLength(0); |
| | | |
| | | byte[] body = downBaseMsgVehicleAdded.encode(); |
| | | OuterPacket out = new OuterPacket(DataType.DOWN_BASE_MSG.getCode(), body); |
| | | //获取从链路通道 |
| | | Channel channel = ChannelMap.getClientChannel(inferiorPlatformId); |
| | | if (null != channel && channel.isActive()) { |
| | | channel.writeAndFlush(out); |
| | | log.info("补报车辆静态信息请求({}):{}", DataType.DOWN_BASE_MSG_VEHICLE_ADDED.getCode(), JSON.toJSONString(downBaseMsgVehicleAdded)); |
| | | } |
| | | } |
| | | |
| | | } |