1修改账号相关接口

This commit is contained in:
fengjundan 2021-07-22 16:02:30 +08:00
parent a020d66fd0
commit 98d7917553
20 changed files with 638 additions and 153 deletions

View File

@ -39,6 +39,7 @@
<common-pool.version>2.6.2</common-pool.version> <common-pool.version>2.6.2</common-pool.version>
<commons-collections.version>3.2.2</commons-collections.version> <commons-collections.version>3.2.2</commons-collections.version>
<alipay.sdk>4.15.14.ALL</alipay.sdk> <alipay.sdk>4.15.14.ALL</alipay.sdk>
<commons-beanutils.sdk>1.9.3</commons-beanutils.sdk>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
@ -236,7 +237,11 @@
<artifactId>ruoyi-api-system</artifactId> <artifactId>ruoyi-api-system</artifactId>
<version>${ruoyi.version}</version> <version>${ruoyi.version}</version>
</dependency> </dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.sdk}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
@ -258,6 +263,7 @@
<artifactId>spring-cloud-starter-bootstrap</artifactId> <artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>

View File

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-common-core</artifactId> <artifactId>ruoyi-common-core</artifactId>
<description> <description>
ruoyi-common-core核心模块 ruoyi-common-core核心模块
</description> </description>
@ -22,7 +22,7 @@
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency> </dependency>
<!-- SpringCloud Loadbalancer --> <!-- SpringCloud Loadbalancer -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
@ -107,6 +107,12 @@
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
</dependency> </dependency>
<!-- beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -3,6 +3,7 @@ package com.ruoyi.common.core.utils;
import com.ruoyi.common.core.text.StrFormatter; import com.ruoyi.common.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import java.beans.PropertyDescriptor;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -483,4 +484,27 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return String.valueOf(obj); return String.valueOf(obj);
} }
} }
/**
* @param bean 对象
* @param propertyName 属性
* @return
* @Title: isProperty
* @Description: 判断对象是否存在某属性
* @return: boolean 有则反之true 反之false
*/
public static boolean isProperty(Object bean, String propertyName) {
if (bean == null) {
return false;
}
Class<?> cls = bean.getClass();
PropertyDescriptor[] propertys = org.springframework.beans.BeanUtils.getPropertyDescriptors(cls);
for (PropertyDescriptor property : propertys) {
String fieldName = property.getName();
if (fieldName != null && propertyName != null && fieldName.equals(propertyName)) {
return true;
}
}
return false;
}
} }

View File

@ -1,111 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.job.mapper.SysJobMapper"> <mapper namespace="com.ruoyi.job.mapper.SysJobMapper">
<resultMap type="SysJob" id="SysJobResult"> <resultMap type="SysJob" id="SysJobResult">
<id property="jobId" column="job_id" /> <id property="jobId" column="job_id" />
<result property="jobName" column="job_name" /> <result property="jobName" column="job_name" />
<result property="jobGroup" column="job_group" /> <result property="jobGroup" column="job_group" />
<result property="invokeTarget" column="invoke_target" /> <result property="invokeTarget" column="invoke_target" />
<result property="cronExpression" column="cron_expression" /> <result property="cronExpression" column="cron_expression" />
<result property="misfirePolicy" column="misfire_policy" /> <result property="misfirePolicy" column="misfire_policy" />
<result property="concurrent" column="concurrent" /> <result property="concurrent" column="concurrent" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
</resultMap> </resultMap>
<sql id="selectJobVo"> <sql id="selectJobVo">
select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark select job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent, status, create_by, create_time, remark
from sys_job from sys_job
</sql> </sql>
<select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult"> <select id="selectJobList" parameterType="SysJob" resultMap="SysJobResult">
<include refid="selectJobVo"/> <include refid="selectJobVo"/>
<where> <where>
<if test="jobName != null and jobName != ''"> <if test="jobName != null and jobName != ''">
AND job_name like concat('%', #{jobName}, '%') AND job_name like concat('%', #{jobName}, '%')
</if> </if>
<if test="jobGroup != null and jobGroup != ''"> <if test="jobGroup != null and jobGroup != ''">
AND job_group = #{jobGroup} AND job_group = #{jobGroup}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND status = #{status} AND status = #{status}
</if> </if>
<if test="invokeTarget != null and invokeTarget != ''"> <if test="invokeTarget != null and invokeTarget != ''">
AND invoke_target like concat('%', #{invokeTarget}, '%') AND invoke_target like concat('%', #{invokeTarget}, '%')
</if> </if>
</where> </where>
</select> </select>
<select id="selectJobAll" resultMap="SysJobResult"> <select id="selectJobAll" resultMap="SysJobResult">
<include refid="selectJobVo"/> <include refid="selectJobVo"/>
</select> </select>
<select id="selectJobById" parameterType="Long" resultMap="SysJobResult"> <select id="selectJobById" parameterType="Long" resultMap="SysJobResult">
<include refid="selectJobVo"/> <include refid="selectJobVo"/>
where job_id = #{jobId} where job_id = #{jobId}
</select> </select>
<delete id="deleteJobById" parameterType="Long"> <delete id="deleteJobById" parameterType="Long">
delete from sys_job where job_id = #{jobId} delete from sys_job where job_id = #{jobId}
</delete> </delete>
<delete id="deleteJobByIds" parameterType="Long"> <delete id="deleteJobByIds" parameterType="Long">
delete from sys_job where job_id in delete from sys_job where job_id in
<foreach collection="array" item="jobId" open="(" separator="," close=")"> <foreach collection="array" item="jobId" open="(" separator="," close=")">
#{jobId} #{jobId}
</foreach> </foreach>
</delete> </delete>
<update id="updateJob" parameterType="SysJob"> <update id="updateJob" parameterType="SysJob">
update sys_job update sys_job
<set> <set>
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if> <if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if> <if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
<if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if> <if test="invokeTarget != null and invokeTarget != ''">invoke_target = #{invokeTarget},</if>
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if> <if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if> <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
<if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if> <if test="concurrent != null and concurrent != ''">concurrent = #{concurrent},</if>
<if test="status !=null">status = #{status},</if> <if test="status !=null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if> <if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where job_id = #{jobId} where job_id = #{jobId}
</update> </update>
<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId"> <insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
insert into sys_job( insert into sys_job(
<if test="jobId != null and jobId != 0">job_id,</if> <if test="jobId != null and jobId != 0">job_id,</if>
<if test="jobName != null and jobName != ''">job_name,</if> <if test="jobName != null and jobName != ''">job_name,</if>
<if test="jobGroup != null and jobGroup != ''">job_group,</if> <if test="jobGroup != null and jobGroup != ''">job_group,</if>
<if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if> <if test="invokeTarget != null and invokeTarget != ''">invoke_target,</if>
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if> <if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if> <if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
<if test="concurrent != null and concurrent != ''">concurrent,</if> <if test="concurrent != null and concurrent != ''">concurrent,</if>
<if test="status != null and status != ''">status,</if> <if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="jobId != null and jobId != 0">#{jobId},</if> <if test="jobId != null and jobId != 0">#{jobId},</if>
<if test="jobName != null and jobName != ''">#{jobName},</if> <if test="jobName != null and jobName != ''">#{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if> <if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
<if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if> <if test="invokeTarget != null and invokeTarget != ''">#{invokeTarget},</if>
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if> <if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if> <if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
<if test="concurrent != null and concurrent != ''">#{concurrent},</if> <if test="concurrent != null and concurrent != ''">#{concurrent},</if>
<if test="status != null and status != ''">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
</mapper> </mapper>

View File

@ -15,6 +15,11 @@
账号服务 账号服务
</description> </description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos --> <!-- SpringCloud Alibaba Nacos -->

View File

@ -0,0 +1,108 @@
package com.xhpc.user.aspect;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.utils.StringUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
/*
* TODO AO切面插入创建人创建时间修改人修改时间
* @author fjd
* @date 2020-07-09 11:59
*/
@Aspect
@Component
@Configuration
public class DaoAspect {
private static final String CREATE_USER = "createUser";
private static final String CREATE_TIME = "createTime";
private static final String UPDATE_USER = "updateUser";
private static final String UPDATE_TIME = "updateTime";
@Pointcut("execution(* com.xhpc..*.update*(..))")
public void daoUpdate() {
}
@Pointcut("execution(* com.xhpc..*.insert*(..))")
public void daoCreate() {
}
@Around("daoUpdate()")
public Object doAroundUpdate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (userName != null){
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, new Date());
}
}
}
}
Object object = point.proceed();
return object;
}
@Around("daoCreate()")
public Object doAroundCreate(ProceedingJoinPoint point) throws Throwable {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes == null) {
return point.proceed();
}
Object[] objects = point.getArgs();
if (objects != null && objects.length > 0) {
for (Object arg : objects) {
//String userName = StringUtils.valueOf(SecurityUtils.getUsername());
String userName = "";
Date date = new Date();
if (StringUtils.isNull(userName)) {
userName = "admin";
}
if (isProperty(arg, CREATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_USER))) {
BeanUtils.setProperty(arg, CREATE_USER, userName);
}
if (isProperty(arg, UPDATE_USER) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_USER))) {
BeanUtils.setProperty(arg, UPDATE_USER, userName);
}
if (isProperty(arg, CREATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, CREATE_TIME))) {
BeanUtils.setProperty(arg, CREATE_TIME, date);
}
if (isProperty(arg, UPDATE_TIME) && StringUtils.isNull(BeanUtils.getProperty(arg, UPDATE_TIME))) {
BeanUtils.setProperty(arg, UPDATE_TIME, date);
}
}
}
Object object = point.proceed();
return object;
}
public static boolean isProperty(Object bean, String field){
return StringUtils.isProperty(bean, field);
}
}

View File

@ -6,6 +6,7 @@ import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.PreAuthorize; import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.openfeign.RemoteSystemService; import com.xhpc.user.openfeign.RemoteSystemService;
import com.xhpc.user.service.IXhpcOperatorService; import com.xhpc.user.service.IXhpcOperatorService;
@ -62,6 +63,13 @@ public class XhpcUserController extends BaseController {
if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) { if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) {
return ajaxResult; return ajaxResult;
} }
SysRole role = new SysRole();
role.setRoleName(sysUser.getUserName());
role.setRoleKey(sysUser.getUserName());
ajaxResult = remoteSystemService.addRole(role);
if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) {
return ajaxResult;
}
return AjaxResult.success(); return AjaxResult.success();
} }
@ -124,6 +132,13 @@ public class XhpcUserController extends BaseController {
if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) { if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) {
return ajaxResult; return ajaxResult;
} }
SysRole role = new SysRole();
role.setRoleName(sysUser.getUserName());
role.setRoleKey(sysUser.getUserName());
ajaxResult = remoteSystemService.addRole(role);
if (null != ajaxResult && !"200".equals(StringUtils.valueOf(ajaxResult.get("code")))) {
return ajaxResult;
}
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -2,6 +2,7 @@ package com.xhpc.user.domain;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 运营商设置流量方黑名单 xhpc_operator_internet_blacklist * 运营商设置流量方黑名单 xhpc_operator_internet_blacklist
@ -12,6 +13,11 @@ public class XhpcOperatorInternetBlacklist implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 运营商设置流量方黑名单id
*/
private Long xhpcOperatorInternetBlacklistId;
/** /**
* 运营商id * 运营商id
*/ */
@ -24,6 +30,35 @@ public class XhpcOperatorInternetBlacklist implements Serializable {
@NotNull(message = "流量用户id不能为空") @NotNull(message = "流量用户id不能为空")
private Long internetUserId; private Long internetUserId;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新者
*/
private String updateBy;
/**
* 备注
*/
private String remark;
public XhpcOperatorInternetBlacklist() { public XhpcOperatorInternetBlacklist() {
} }
@ -44,4 +79,59 @@ public class XhpcOperatorInternetBlacklist implements Serializable {
this.internetUserId = internetUserId; this.internetUserId = internetUserId;
} }
public Long getXhpcOperatorInternetBlacklistId() {
return xhpcOperatorInternetBlacklistId;
}
public void setXhpcOperatorInternetBlacklistId(Long xhpcOperatorInternetBlacklistId) {
this.xhpcOperatorInternetBlacklistId = xhpcOperatorInternetBlacklistId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
} }

View File

@ -2,6 +2,7 @@ package com.xhpc.user.domain;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 流量用户设置流量方黑名单 xhpc_operator_internet_blacklist * 流量用户设置流量方黑名单 xhpc_operator_internet_blacklist
@ -12,6 +13,13 @@ public class XhpcStationInternetBlacklist implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**
* 运营者子账号权限id
*/
private Long xhpcUserPrivilegeId;
/** /**
* 流量用户id * 流量用户id
*/ */
@ -24,6 +32,35 @@ public class XhpcStationInternetBlacklist implements Serializable {
@NotNull(message = "电站id不能为空") @NotNull(message = "电站id不能为空")
private Long chargingStationId; private Long chargingStationId;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新者
*/
private String updateBy;
/**
* 备注
*/
private String remark;
public XhpcStationInternetBlacklist() { public XhpcStationInternetBlacklist() {
} }
@ -44,4 +81,59 @@ public class XhpcStationInternetBlacklist implements Serializable {
this.chargingStationId = chargingStationId; this.chargingStationId = chargingStationId;
} }
public Long getXhpcUserPrivilegeId() {
return xhpcUserPrivilegeId;
}
public void setXhpcUserPrivilegeId(Long xhpcUserPrivilegeId) {
this.xhpcUserPrivilegeId = xhpcUserPrivilegeId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
} }

View File

@ -80,6 +80,14 @@ public interface XhpcOperatorMapper {
*/ */
public int deleteUserPostByUserId(@Param("userId") Long userId); public int deleteUserPostByUserId(@Param("userId") Long userId);
/**
* 删除角色信息
*
* @param roleName 角色名称
* @return 结果
*/
public int deleteRoleByName(@Param("roleName") String roleName);
/** /**
* 通过用户ID删除用户 * 通过用户ID删除用户
* *

View File

@ -1,11 +1,14 @@
package com.xhpc.user.openfeign; package com.xhpc.user.openfeign;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory; import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
/** /**
* 用户服务降级处理 * 用户服务降级处理
@ -29,6 +32,10 @@ public class RemoteSystemFallbackFactory implements FallbackFactory<RemoteSystem
public AjaxResult editUser(SysUser sysUser) { public AjaxResult editUser(SysUser sysUser) {
return AjaxResult.error(throwable.getMessage()); return AjaxResult.error(throwable.getMessage());
} }
@Override
public AjaxResult addRole(SysRole role) {
return AjaxResult.error(throwable.getMessage());
}
}; };
} }
} }

View File

@ -2,6 +2,7 @@ package com.xhpc.user.openfeign;
import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.SysRole;
import com.ruoyi.system.api.domain.SysUser; import com.ruoyi.system.api.domain.SysUser;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -34,4 +35,12 @@ public interface RemoteSystemService {
@PutMapping(value = "/user") @PutMapping(value = "/user")
public AjaxResult editUser(@Validated @RequestBody SysUser sysUser); public AjaxResult editUser(@Validated @RequestBody SysUser sysUser);
/**
* 新增角色
*
* @param role 角色信息
* @return 结果
*/
@PostMapping(value = "/role")
public AjaxResult addRole(@Validated @RequestBody SysRole role);
} }

View File

@ -114,6 +114,12 @@ public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
xhpcOperatorMapper.deleteUserRoleByUserId(userId); xhpcOperatorMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表 // 删除用户与岗位表
xhpcOperatorMapper.deleteUserPostByUserId(userId); xhpcOperatorMapper.deleteUserPostByUserId(userId);
Map<String, Object> map = xhpcUserMapper.pcInfo(userId);
if (StringUtils.isNotNull(map)) {
String userName = StringUtils.valueOf(map.get("userName"));
// 删除用户与岗位表
xhpcOperatorMapper.deleteRoleByName(userName);
}
return xhpcOperatorMapper.deleteUserById(userId, "2"); return xhpcOperatorMapper.deleteUserById(userId, "2");
} }

View File

@ -62,13 +62,13 @@
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
create_by, create_by,
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
create_time, create_time,
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
update_by, update_by,
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
update_time, update_time,
</if> </if>
<if test="null != remark and '' != remark"> <if test="null != remark and '' != remark">
@ -112,13 +112,13 @@
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
#{createBy}, #{createBy},
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
#{createTime}, #{createTime},
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
#{updateBy}, #{updateBy},
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
#{updateTime}, #{updateTime},
</if> </if>
<if test="null != remark and '' != remark"> <if test="null != remark and '' != remark">
@ -141,9 +141,9 @@
<if test="null != status and '' != status">status = #{status},</if> <if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if> <if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if> <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if> <if test="null != updateTime ">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if> <if test="null != remark and '' != remark">remark = #{remark}</if>
</set> </set>
WHERE app_user_id = #{appUserId} WHERE app_user_id = #{appUserId}

View File

@ -95,13 +95,13 @@
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
create_by, create_by,
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
create_time, create_time,
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
update_by, update_by,
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
update_time, update_time,
</if> </if>
<if test="null != remark and '' != remark"> <if test="null != remark and '' != remark">
@ -169,13 +169,13 @@
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
#{createBy}, #{createBy},
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
#{createTime}, #{createTime},
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
#{updateBy}, #{updateBy},
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
#{updateTime}, #{updateTime},
</if> </if>
<if test="null != remark and '' != remark"> <if test="null != remark and '' != remark">
@ -210,9 +210,9 @@
<if test="null != status and '' != status">status = #{status},</if> <if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if> <if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if> <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if> <if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if> <if test="null != remark and '' != remark">remark = #{remark}</if>
</set> </set>
WHERE internet_user_id = #{internetUserId} WHERE internet_user_id = #{internetUserId}

View File

@ -5,26 +5,78 @@
<mapper namespace="com.xhpc.user.mapper.XhpcOperatorInternetBlacklistMapper"> <mapper namespace="com.xhpc.user.mapper.XhpcOperatorInternetBlacklistMapper">
<resultMap type="com.xhpc.user.domain.XhpcOperatorInternetBlacklist" id="XhpcOperatorInternetBlacklistResult"> <resultMap type="com.xhpc.user.domain.XhpcOperatorInternetBlacklist" id="XhpcOperatorInternetBlacklistResult">
<result column="operator_id" property="operatorId"/> <result column="xhpc_operator_internet_blacklist_id" property="xhpcOperatorInternetBlacklistId" />
<result column="internet_user_id" property="internetUserId"/> <result column="operator_id" property="operatorId" />
<result column="internet_user_id" property="internetUserId" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="create_by" property="createBy" />
<result column="update_time" property="updateTime" />
<result column="update_by" property="updateBy" />
<result column="remark" property="remark" />
</resultMap> </resultMap>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser"> <insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser">
insert into xhpc_operator_internet_blacklist( insert into xhpc_operator_internet_blacklist
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != xhpcOperatorInternetBlacklistId and '' != xhpcOperatorInternetBlacklistId">
xhpc_operator_internet_blacklist_id,
</if>
<if test="null != operatorId and '' != operatorId"> <if test="null != operatorId and '' != operatorId">
operator_id, operator_id,
</if> </if>
<if test="null != internetUserId and '' != internetUserId"> <if test="null != internetUserId and '' != internetUserId">
internet_user_id internet_user_id,
</if> </if>
)values( <if test="null != status and '' != status">
<if test="null != operatorId and '' != operatorId"> status,
#{operatorId},
</if> </if>
<if test="null != internetUserId and '' != internetUserId"> <if test="null != createTime ">
#{internetUserId} create_time,
</if> </if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != xhpcOperatorInternetBlacklistId and '' != xhpcOperatorInternetBlacklistId">
#{xhpcOperatorInternetBlacklistId},
</if>
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != internetUserId and '' != internetUserId">
#{internetUserId},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert> </insert>
<delete id="deleteByIds" parameterType="java.lang.Long"> <delete id="deleteByIds" parameterType="java.lang.Long">

View File

@ -102,13 +102,13 @@
<if test="null != delFlag and '' != delFlag"> <if test="null != delFlag and '' != delFlag">
del_flag, del_flag,
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
create_time, create_time,
</if> </if>
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
create_by, create_by,
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
update_time, update_time,
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
@ -177,13 +177,13 @@
<if test="null != delFlag and '' != delFlag"> <if test="null != delFlag and '' != delFlag">
#{delFlag}, #{delFlag},
</if> </if>
<if test="null != createTime and '' != createTime"> <if test="null != createTime ">
#{createTime}, #{createTime},
</if> </if>
<if test="null != createBy and '' != createBy"> <if test="null != createBy and '' != createBy">
#{createBy}, #{createBy},
</if> </if>
<if test="null != updateTime and '' != updateTime"> <if test="null != updateTime ">
#{updateTime}, #{updateTime},
</if> </if>
<if test="null != updateBy and '' != updateBy"> <if test="null != updateBy and '' != updateBy">
@ -223,9 +223,9 @@
<if test="null != soc and '' != soc">soc = #{soc},</if> <if test="null != soc and '' != soc">soc = #{soc},</if>
<if test="null != status and '' != status">status = #{status},</if> <if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if> <if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if> <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if> <if test="null != updateTime a">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if> <if test="null != remark and '' != remark">remark = #{remark}</if>
</set> </set>
@ -301,4 +301,9 @@
where xo.del_flag = 0 where xo.del_flag = 0
ORDER BY xo.create_time DESC ORDER BY xo.create_time DESC
</select> </select>
<delete id="deleteRoleByName" parameterType="java.lang.String">
update sys_role set del_flag = '2' where roleName = #{roleId}
</delete>
</mapper> </mapper>

View File

@ -5,26 +5,78 @@
<mapper namespace="com.xhpc.user.mapper.XhpcStationInternetBlacklistMapper"> <mapper namespace="com.xhpc.user.mapper.XhpcStationInternetBlacklistMapper">
<resultMap type="com.xhpc.user.domain.XhpcStationInternetBlacklist" id="XhpcStationInternetBlacklistResult"> <resultMap type="com.xhpc.user.domain.XhpcStationInternetBlacklist" id="XhpcStationInternetBlacklistResult">
<result column="internet_user_id" property="internetUserId"/> <result column="xhpc_user_privilege_id" property="xhpcUserPrivilegeId" />
<result column="charging_station_id" property="chargingStationId"/> <result column="user_id" property="userId" />
<result column="charging_station_id" property="chargingStationId" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="create_by" property="createBy" />
<result column="update_time" property="updateTime" />
<result column="update_by" property="updateBy" />
<result column="remark" property="remark" />
</resultMap> </resultMap>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser"> <insert id="insert" parameterType="com.xhpc.user.domain.XhpcInternetUser">
insert into xhpc_operator_internet_blacklist( insert into xhpc_operator_internet_blacklist
<if test="null != internetUserId and '' != internetUserId"> <trim prefix="(" suffix=")" suffixOverrides=",">
internet_user_id, <if test="null != xhpcUserPrivilegeId and '' != xhpcUserPrivilegeId">
xhpc_user_privilege_id,
</if>
<if test="null != userId and '' != userId">
user_id,
</if> </if>
<if test="null != chargingStationId and '' != chargingStationId"> <if test="null != chargingStationId and '' != chargingStationId">
charging_station_id charging_station_id,
</if> </if>
)values( <if test="null != status and '' != status">
<if test="null != internetUserId and '' != internetUserId"> status,
#{internetUserId},
</if> </if>
<if test="null != chargingStationId and '' != chargingStationId"> <if test="null != createTime ">
#{chargingStationId} create_time,
</if> </if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != xhpcUserPrivilegeId and '' != xhpcUserPrivilegeId">
#{xhpcUserPrivilegeId},
</if>
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != chargingStationId and '' != chargingStationId">
#{chargingStationId},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
</insert> </insert>
<delete id="deleteByIds" parameterType="java.lang.Long"> <delete id="deleteByIds" parameterType="java.lang.Long">

View File

@ -48,9 +48,9 @@
<if test="null != loginIp and '' != loginIp">login_ip = #{loginIp},</if> <if test="null != loginIp and '' != loginIp">login_ip = #{loginIp},</if>
<if test="null != loginDate and '' != loginDate">login_date = #{loginDate},</if> <if test="null != loginDate and '' != loginDate">login_date = #{loginDate},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if> <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if> <if test="null != createTime ">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if> <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if> <if test="null != updateTime ">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if> <if test="null != remark and '' != remark">remark = #{remark}</if>
</set> </set>
WHERE user_id = #{userId} WHERE user_id = #{userId}