新增账号服务

This commit is contained in:
fengjundan 2021-07-19 18:38:42 +08:00
parent 4ec50920a1
commit b2d364ecd8
39 changed files with 2688 additions and 141 deletions

View File

@ -20,7 +20,7 @@
<spring-boot.version>2.5.1</spring-boot.version>
<spring-cloud.version>2020.0.3</spring-cloud.version>
<spring-cloud-alibaba.version>2021.1</spring-cloud-alibaba.version>
<alibaba.nacos.version>2.0.2</alibaba.nacos.version>
<alibaba.nacos.version>1.1.0</alibaba.nacos.version>
<spring-boot-admin.version>2.4.1</spring-boot-admin.version>
<spring-boot.mybatis>2.1.4</spring-boot.mybatis>
<swagger.fox.version>3.0.0</swagger.fox.version>

View File

@ -1,18 +1,19 @@
package com.ruoyi.system.api.domain;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excel.ColumnType;
import com.ruoyi.common.core.annotation.Excel.Type;
import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
/**
* 用户对象 sys_user
@ -35,6 +36,11 @@ public class SysUser extends BaseEntity
@Excel(name = "登录名称")
private String userName;
/**
* 用户类型00系统用户
*/
private String userType;
/** 用户昵称 */
@Excel(name = "用户名称")
private String nickName;
@ -51,6 +57,17 @@ public class SysUser extends BaseEntity
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/**
* 运营商id
*/
private Long operatorId;
/**
* 权限类型0所有 1 运营商所有 2子账号 3 流量账号
*/
@Excel(name = "权限类型", readConverterExp = "0=所有,1=运营商所有,2=子账号,3=流量账号")
private Integer dataPowerType;
/** 用户头像 */
private String avatar;
@ -306,10 +323,34 @@ public class SysUser extends BaseEntity
return roleId;
}
public void setRoleId(Long roleId)
{
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getOperatorId() {
return operatorId;
}
public void setOperatorId(Long operatorId) {
this.operatorId = operatorId;
}
public Integer getDataPowerType() {
return dataPowerType;
}
public void setDataPowerType(Integer dataPowerType) {
this.dataPowerType = dataPowerType;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -322,7 +363,9 @@ public class SysUser extends BaseEntity
.append("sex", getSex())
.append("avatar", getAvatar())
.append("password", getPassword())
.append("salt", getSalt())
.append("salt", getSalt())
.append("operatorId", getOperatorId())
.append("dataPowerType", getDataPowerType())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())

View File

@ -60,6 +60,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -1,10 +1,11 @@
package com.ruoyi.common.core.utils;
import com.ruoyi.common.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.springframework.util.AntPathMatcher;
import com.ruoyi.common.core.text.StrFormatter;
/**
* 字符串工具类
@ -466,4 +467,20 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
{
return (T) obj;
}
/**
* Object转String
*
* @param obj 源字符串
* @return
* @author fjd
* @date 2018/2/27
*/
public static String valueOf(Object obj) {
if (obj == null) {
return "";
} else {
return String.valueOf(obj);
}
}
}

View File

@ -90,6 +90,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -74,6 +74,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -86,6 +86,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -86,6 +86,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -86,6 +86,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id"/>
<result property="postCode" column="post_code"/>
<result property="postName" column="post_name"/>
<result property="postSort" column="post_sort"/>
<result property="status" column="status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null and postSort != ''">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null and postSort != ''">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@ -1,122 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" />
<result property="postCode" column="post_code" />
<result property="postName" column="post_name" />
<result property="postSort" column="post_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post
</sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/>
<where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
select p.post_id
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_id = #{userId}
</select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code
from sys_post p
left join sys_user_post up on up.post_id = p.post_id
left join sys_user u on u.user_id = up.user_id
where u.user_name = #{userName}
</select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_name=#{postName} limit 1
</select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_code=#{postCode} limit 1
</select>
<update id="updatePost" parameterType="SysPost">
update sys_post
<set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where post_id = #{postId}
</update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null and postSort != ''">post_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null and postSort != ''">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@ -14,6 +14,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="operatorId" column="operator_id"/>
<result property="dataPowerType" column="data_power_type"/>
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
@ -26,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
<id property="deptId" column="dept_id" />
<result property="parentId" column="parent_id" />
@ -35,8 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leader" column="leader" />
<result property="status" column="dept_status" />
</resultMap>
<resultMap id="RoleResult" type="SysRole">
<resultMap id="RoleResult" type="SysRole">
<id property="roleId" column="role_id" />
<result property="roleName" column="role_name" />
<result property="roleKey" column="role_key" />
@ -44,9 +46,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dataScope" column="data_scope" />
<result property="status" column="role_status" />
</resultMap>
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
<sql id="selectUserVo">
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
from sys_user u

View File

@ -61,6 +61,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

View File

@ -10,6 +10,7 @@
<modules>
<module>xhpc-power-pile</module>
<module>xhpc-user</module>
</modules>
<artifactId>xhpc-modules</artifactId>

View File

@ -89,6 +89,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>

33
xhpc-modules/xhpc-user/.gitignore vendored Normal file
View File

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@ -0,0 +1,118 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}

Binary file not shown.

View File

@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar

310
xhpc-modules/xhpc-user/mvnw vendored Normal file
View File

@ -0,0 +1,310 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

182
xhpc-modules/xhpc-user/mvnw.cmd vendored Normal file
View File

@ -0,0 +1,182 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

View File

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-modules</artifactId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-user</artifactId>
<description>
账号服务
</description>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<dependency>
<groupId>org.quickserver</groupId>
<artifactId>quickserver</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<artifactId>leaf-boot-starter</artifactId>
<groupId>com.sankuai.inf.leaf</groupId>
<version>1.0.1-RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,13 @@
package com.xhpc.user;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class, args);
}
}

View File

@ -0,0 +1,120 @@
package com.xhpc.user.controller;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.domain.XhpcOperator;
import com.xhpc.user.openfeign.RemoteSystemService;
import com.xhpc.user.service.IXhpcOperatorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 运营商
*
* @author ruoyi
*/
@RestController
@RequestMapping("/operator")
public class XhpcOperatorController extends BaseController {
@Autowired
private IXhpcOperatorService iXhpcOperatorService;
@Autowired
private RemoteSystemService remoteSystemService;
/**
* 新增运营商
*/
@ApiOperation("新增运营商")
@PreAuthorize(hasPermi = "user:operator:add")
@PostMapping("/add")
public AjaxResult add(@RequestBody XhpcOperator xhpcOperator) {
SysUser sysUser = new SysUser();
sysUser.setUserName(xhpcOperator.getPhone());
sysUser.setNickName(xhpcOperator.getName());
sysUser.setEmail(xhpcOperator.getEmail());
sysUser.setPhonenumber(xhpcOperator.getPhone());
sysUser.setDeptId(103l);
sysUser.setSex("0");
sysUser.setDataPowerType(1);
sysUser.setCreateBy(SecurityUtils.getUsername());
sysUser.setPassword(SecurityUtils.encryptPassword(xhpcOperator.getPhone()));
AjaxResult ajaxResult = remoteSystemService.addUser(sysUser);
if (null != ajaxResult && !"200".equals(ajaxResult.get("code"))) {
return ajaxResult;
}
if (UserConstants.NOT_UNIQUE.equals(iXhpcOperatorService.checkAccountUnique(xhpcOperator))) {
return AjaxResult.error("用户'" + xhpcOperator.getPhone() + "'失败,登录账号已存在");
}
return toAjax(iXhpcOperatorService.insert(xhpcOperator));
}
/**
* 修改运营商
*/
@ApiOperation("修改运营商")
@PreAuthorize(hasPermi = "user:operator:edit")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody XhpcOperator xhpcOperator) {
if (null == xhpcOperator.getOperatorId()) {
return AjaxResult.error("运营商id不能为空");
}
if (UserConstants.NOT_UNIQUE.equals(iXhpcOperatorService.checkAccountUnique(xhpcOperator))) {
return AjaxResult.error("用户'" + xhpcOperator.getPhone() + "'失败,登录账号已存在");
}
return toAjax(iXhpcOperatorService.update(xhpcOperator));
}
/**
* 删除运营商
*/
@ApiOperation("删除运营商")
@PreAuthorize(hasPermi = "user:operator:remove")
@PostMapping("/remove")
public AjaxResult remove(@RequestBody Long[] ids) {
iXhpcOperatorService.deleteByIds(ids);
return AjaxResult.success();
}
/**
* 运营商详情
*/
@ApiOperation("运营商详情")
@PreAuthorize(hasPermi = "user:operator:info")
@GetMapping("/info")
public AjaxResult info(@RequestBody Long operatorId) {
return AjaxResult.success(iXhpcOperatorService.info(operatorId));
}
/**
* 获取运营商列表
*/
@PreAuthorize(hasPermi = "system:operator:list")
@GetMapping("/list")
public TableDataInfo list(String name, String contactName, String contactPhone) {
startPage();
List<Map<String, Object>> list = iXhpcOperatorService.selectOperatorList(name, contactName, contactPhone);
return getDataTable(list);
}
/**
* 禁用/启用运营商
*/
@ApiOperation("禁用/启用运营商")
@PreAuthorize(hasPermi = "user:operator:status")
@PostMapping("/status")
public AjaxResult status(@RequestBody Long id) {
iXhpcOperatorService.status(id);
return AjaxResult.success();
}
}

View File

@ -0,0 +1,152 @@
package com.xhpc.user.controller;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.openfeign.RemoteSystemService;
import com.xhpc.user.service.IXhpcUserService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
* 运营商
*
* @author ruoyi
*/
@RestController
@RequestMapping("/xhpc/user")
public class XhpcUserController extends BaseController {
@Autowired
private IXhpcUserService iXhpcUserService;
@Autowired
private RemoteSystemService remoteSystemService;
/**
* 获取平台用户列表
*/
@PreAuthorize(hasPermi = "user:pc:list")
@GetMapping("/pc/list")
public TableDataInfo pcList(String userName, String nickName) {
startPage();
List<Map<String, Object>> list = iXhpcUserService.selectPcUserList(userName, nickName);
return getDataTable(list);
}
/**
* 新增平台用户
*/
@ApiOperation("新增平台用户")
@PreAuthorize(hasPermi = "user:pc:add")
@PostMapping("/pc/add")
public AjaxResult pcAdd(@RequestBody SysUser sysUser) {
sysUser.setPhonenumber(sysUser.getUserName());
sysUser.setDeptId(103l);
sysUser.setDataPowerType(1);
sysUser.setCreateBy(SecurityUtils.getUsername());
AjaxResult ajaxResult = remoteSystemService.addUser(sysUser);
if (null != ajaxResult && !"200".equals(ajaxResult.get("code"))) {
return ajaxResult;
}
return AjaxResult.success();
}
/**
* 修改平台用户
*/
@ApiOperation("修改平台用户")
@PreAuthorize(hasPermi = "user:pc:edit")
@PostMapping("/pc/edit")
public AjaxResult pcEdit(@RequestBody SysUser sysUser) {
if (null == sysUser.getUserId()) {
return AjaxResult.error("用户id不能为空");
}
AjaxResult ajaxResult = remoteSystemService.editUser(sysUser);
if (null != ajaxResult && !"200".equals(ajaxResult.get("code"))) {
return ajaxResult;
}
return AjaxResult.success();
}
/**
* 平台用户详情
*/
@ApiOperation("平台用户详情")
@PreAuthorize(hasPermi = "user:pc:info")
@GetMapping("/pc/info")
public AjaxResult pcInfo(@RequestBody Long userId) {
return AjaxResult.success(iXhpcUserService.pcInfo(userId));
}
/**
* 获取运营上用户列表
*/
@PreAuthorize(hasPermi = "user:operator:list")
@GetMapping("/operator/list")
public TableDataInfo operatorList(String userName, String nickName, Long operatorId) {
startPage();
List<Map<String, Object>> list = iXhpcUserService.selectOperatorUserList(userName, nickName, operatorId);
return getDataTable(list);
}
/**
* 新增运营商用户
*/
@ApiOperation("新增运营商用户")
@PreAuthorize(hasPermi = "user:operator:add")
@PostMapping("/operator/add")
public AjaxResult operatorAdd(@RequestBody SysUser sysUser) {
if (null == sysUser.getOperatorId()) {
return AjaxResult.error("所属运营上不能为空");
}
sysUser.setPhonenumber(sysUser.getUserName());
sysUser.setDeptId(103l);
sysUser.setDataPowerType(1);
sysUser.setUserType("01");
sysUser.setCreateBy(SecurityUtils.getUsername());
AjaxResult ajaxResult = remoteSystemService.addUser(sysUser);
if (null != ajaxResult && !"200".equals(ajaxResult.get("code"))) {
return ajaxResult;
}
return AjaxResult.success();
}
/**
* 修改运营商用户
*/
@ApiOperation("修改运营商用户")
@PreAuthorize(hasPermi = "user:operator:edit")
@PostMapping("/operator/edit")
public AjaxResult operatorEdit(@RequestBody SysUser sysUser) {
if (null == sysUser.getUserId()) {
return AjaxResult.error("用户id不能为空");
}
if (null == sysUser.getOperatorId()) {
return AjaxResult.error("所属运营上不能为空");
}
AjaxResult ajaxResult = remoteSystemService.editUser(sysUser);
if (null != ajaxResult && !"200".equals(ajaxResult.get("code"))) {
return ajaxResult;
}
return AjaxResult.success();
}
/**
* 运营商用户详情
*/
@ApiOperation("运营商用户详情")
@PreAuthorize(hasPermi = "user:operator:info")
@GetMapping("/operator/info")
public AjaxResult operatorInfo(@RequestBody Long userId) {
return AjaxResult.success(iXhpcUserService.operatorInfo(userId));
}
}

View File

@ -0,0 +1,156 @@
package com.xhpc.user.domain;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.util.Date;
/**
* 运营商表 xhpc_operator
*
* @author ruoyi
*/
@Data
public class XhpcOperator {
private static final long serialVersionUID = 1L;
/**
* 运营商id
*/
private Long operatorId;
/**
* 名称
*/
@NotBlank(message = "运营商名称不能为空")
@Length(max = 12, message = "运营商名称不能超过12位")
private String name;
/**
* 联系人
*/
@NotBlank(message = "联系人不能为空")
@Length(max = 12, message = "联系人不能超过12位")
private String contactName;
/**
* 联系人电话
*/
@NotBlank(message = "联系人电话不能为空")
private String contactPhone;
/**
* 手机号(账号)
*/
@NotBlank(message = "手机号不能为空")
@Length(max = 11, message = "手机号不能超过11位")
private String phone;
/**
* 运营商属性
*/
@NotBlank(message = "运营商属性不能为空")
private Integer attribute;
/**
* 地址code
*/
@NotBlank(message = "地址不能为空")
private String areaCode;
/**
* 地址
*/
@NotBlank(message = "地址不能为空")
private String address;
/**
* 经度
*/
@NotBlank(message = "经度不能为空")
private String longitude;
/**
* 纬度
*/
@NotBlank(message = "纬度不能为空")
private String latitude;
/**
* 邮箱
*/
@NotBlank(message = "邮箱不能为空")
private String email;
/**
* 提成类型0总金额提成 1服务费提成
*/
@NotBlank(message = "提成类型不能为空")
private Integer commissionType;
/**
* 平台提成
*/
@NotBlank(message = "平台提成不能为空")
private Double platformCommissionRate;
/**
* 运维提成
*/
@NotBlank(message = "运维提成不能为空")
private Double maintenanceCommissionRate;
/**
* 营业执照id
*/
@NotBlank(message = "营业执照不能为空")
private String businessLicenseId;
/**
* 提现时间tn
*/
@NotBlank(message = "提现时间不能为空")
private Integer withdrawalTime;
/**
* 设置充电终止的soc
*/
@NotBlank(message = "充电终止的soc不能为空")
private String soc;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新者
*/
private String updateBy;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,97 @@
package com.xhpc.user.mapper;
import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.domain.XhpcOperator;
import java.util.List;
import java.util.Map;
/**
* 运营商信息 数据层
*
* @author ruoyi
*/
public interface XhpcOperatorMapper {
/**
* 修改运营商信息
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int update(XhpcOperator xhpcOperator);
/**
* 新增运营商信息
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int insert(XhpcOperator xhpcOperator);
/**
* 批量删除运营商信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByIds(Long[] ids);
/**
* 校验账号是否唯一
*
* @param phone 用户手机号
* @return 结果
*/
public XhpcOperator checkAccountUnique(String phone);
/**
* 查询运营商详情
*
* @param operatorId 运营商id
* @return 结果
*/
public Map<String, Object> info(Long operatorId);
/**
* 获取运营商列表
*
* @param name 运营商名称
* @param contactName 联系人
* @param contactPhone 联系人电话
* @return 结果
*/
public List<Map<String, Object>> selectOperatorList(String name, String contactName, String contactPhone);
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserRoleByUserId(Long userId);
/**
* 通过用户ID删除用户和岗位关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserPostByUserId(Long userId);
/**
* 通过用户ID删除用户
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserById(Long userId, String delFlag);
/**
* 通过运营商ID查询用户
*
* @param operatorId 运营商ID
* @return 结果
*/
public SysUser getUserByOperatorId(Long operatorId);
}

View File

@ -0,0 +1,80 @@
package com.xhpc.user.mapper;
import com.ruoyi.system.api.domain.SysUser;
import java.util.List;
import java.util.Map;
/**
* 用户信息 数据层
*
* @author ruoyi
*/
public interface XhpcUserMapper {
/**
* 修改用户信息
*
* @param sysUser 用户信息
* @return 结果
*/
public int update(SysUser sysUser);
/**
* 新增用户信息
*
* @param sysUser 用户信息
* @return 结果
*/
public int insert(SysUser sysUser);
/**
* 批量删除用户信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteByIds(Long[] ids);
/**
* 查询用户信息
*
* @param userId 用户id
* @return 结果
*/
public SysUser selectUserByUserId(Long userId);
/**
* 获取平台用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @return 结果
*/
public List<Map<String, Object>> selectPcUserList(String userName, String nickName);
/**
* 平台用户详情
*
* @param userId 用户id
* @return 结果
*/
public Map<String, Object> pcInfo(Long userId);
/**
* 获取运营商用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @return 结果
*/
public List<Map<String, Object>> selectOperatorUserList(String userName, String nickName, Long operatorId, String createBy);
/**
* 运营商用户详情
*
* @param userId 用户id
* @return 结果
*/
public Map<String, Object> operatorInfo(Long userId);
}

View File

@ -0,0 +1,37 @@
package com.xhpc.user.openfeign;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.factory.RemoteFileFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 系统服务
*
* @author ruoyi
*/
@FeignClient(contextId = "remoteSystemService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
public interface RemoteSystemService {
/**
* 新增用户
*
* @param sysUser 用户信息
* @return 结果
*/
@PostMapping(value = "/user/add")
public AjaxResult addUser(@RequestBody SysUser sysUser);
/**
* 新增用户
*
* @param sysUser 用户信息
* @return 结果
*/
@PutMapping(value = "/user/edit")
public AjaxResult editUser(@RequestBody SysUser sysUser);
}

View File

@ -0,0 +1,81 @@
package com.xhpc.user.service;
import com.xhpc.user.domain.XhpcOperator;
import java.util.List;
import java.util.Map;
/**
* 运营商信息 服务层
*
* @author ruoyi
*/
public interface IXhpcOperatorService {
/**
* 新增任务
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int insert(XhpcOperator xhpcOperator);
/**
* 更新任务
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public int update(XhpcOperator xhpcOperator);
/**
* 批量删除运营商信息
*
* @param ids 需要删除的运营商ID
* @return 结果
*/
public void deleteByIds(Long[] ids);
/**
* 校验账号是否唯一
*
* @param xhpcOperator 运营商信息
* @return 结果
*/
public String checkAccountUnique(XhpcOperator xhpcOperator);
/**
* 查询运营商详情
*
* @param operatorId 运营商id
* @return 结果
*/
public Map<String, Object> info(Long operatorId);
/**
* 获取运营商列表
*
* @param name 运营商名称
* @param contactName 联系人
* @param contactPhone 联系人电话
* @return 结果
*/
public List<Map<String, Object>> selectOperatorList(String name, String contactName, String contactPhone);
/**
* 删除用户
*
* @param userId 用户id
* @return 结果
*/
public int removeUser(Long userId);
/**
* 禁用/启用运营商
*
* @param operatorId 运营商id
* @return 结果
*/
public void status(Long operatorId);
}

View File

@ -0,0 +1,75 @@
package com.xhpc.user.service;
import com.ruoyi.system.api.domain.SysUser;
import java.util.List;
import java.util.Map;
/**
* 用户信息 服务层
*
* @author ruoyi
*/
public interface IXhpcUserService {
/**
* 新增用户信息
*
* @param sysUser 用户信息
* @return 结果
*/
public int insert(SysUser sysUser);
/**
* 更新用户信息
*
* @param sysUser 用户信息
* @return 结果
*/
public int update(SysUser sysUser);
/**
* 批量删除用户信息
*
* @param ids 需要删除的用户ID
* @return 结果
*/
public void deleteByIds(Long[] ids);
/**
* 获取平台用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @return 结果
*/
public List<Map<String, Object>> selectPcUserList(String userName, String nickName);
/**
* 平台用户详情
*
* @param userId 用户id
* @return 结果
*/
public Map<String, Object> pcInfo(Long userId);
/**
* 获取运营商用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @param operatorId 运营上id
* @return 结果
*/
public List<Map<String, Object>> selectOperatorUserList(String userName, String nickName, Long operatorId);
/**
* 运营商用户详情
*
* @param userId 用户id
* @return 结果
*/
public Map<String, Object> operatorInfo(Long userId);
}

View File

@ -0,0 +1,133 @@
package com.xhpc.user.service;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.domain.XhpcOperator;
import com.xhpc.user.mapper.XhpcOperatorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 运营商信息 服务层
*
* @author ruoyi
*/
@Service
public class XhpcOperatorServiceImpl implements IXhpcOperatorService {
@Autowired
private XhpcOperatorMapper xhpcOperatorMapper;
/**
* 新增任务
*
* @param xhpcOperator 运营商信息
*/
@Override
public int insert(XhpcOperator xhpcOperator) {
return xhpcOperatorMapper.insert(xhpcOperator);
}
/**
* 更新运营商
*
* @param xhpcOperator 运营商信息
*/
@Override
public int update(XhpcOperator xhpcOperator) {
return xhpcOperatorMapper.update(xhpcOperator);
}
/**
* 批量删除运营商信息
*
* @param ids 需要删除的运营商ID
* @return 结果
*/
@Override
public void deleteByIds(Long[] ids) {
for (Long id : ids) {
SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(id);
removeUser(sysUser.getUserId());
}
xhpcOperatorMapper.deleteByIds(ids);
}
/**
* 校验账号是否唯一
*
* @param xhpcOperator 运营商信息
* @return
*/
@Override
public String checkAccountUnique(XhpcOperator xhpcOperator) {
Long operatorId = StringUtils.isNull(xhpcOperator.getOperatorId()) ? -1L : xhpcOperator.getOperatorId();
XhpcOperator info = xhpcOperatorMapper.checkAccountUnique(xhpcOperator.getPhone());
if (StringUtils.isNotNull(info) && info.getOperatorId().longValue() != operatorId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 查询运营商详情
*
* @param operatorId 运营商id
* @return 结果
*/
@Override
public Map<String, Object> info(Long operatorId) {
return xhpcOperatorMapper.info(operatorId);
}
/**
* 获取运营商列表
*
* @param name 运营商名称
* @param contactName 联系人
* @param contactPhone 联系人电话
* @return 结果
*/
@Override
public List<Map<String, Object>> selectOperatorList(String name, String contactName, String contactPhone) {
return xhpcOperatorMapper.selectOperatorList(name, contactName, contactPhone);
}
/**
* 删除用户
*
* @param userId 用户id
* @return 结果
*/
@Override
public int removeUser(Long userId) {
// 删除用户与角色关联
xhpcOperatorMapper.deleteUserRoleByUserId(userId);
// 删除用户与岗位表
xhpcOperatorMapper.deleteUserPostByUserId(userId);
return xhpcOperatorMapper.deleteUserById(userId, "2");
}
/**
* 禁用/启用运营商
*
* @param operatorId 运营商id
* @return 结果
*/
@Override
public void status(Long operatorId) {
SysUser sysUser = xhpcOperatorMapper.getUserByOperatorId(operatorId);
xhpcOperatorMapper.deleteUserById(sysUser.getUserId(), "2".equals(sysUser.getStatus()) ? "0" : "2");
Map<String, Object> map = xhpcOperatorMapper.info(operatorId);
String status = StringUtils.valueOf(map.get("status"));
XhpcOperator xhpcOperator = new XhpcOperator();
xhpcOperator.setOperatorId(operatorId);
xhpcOperator.setStatus("0".equals(sysUser.getStatus()) ? 1 : 0);
update(xhpcOperator);
}
}

View File

@ -0,0 +1,105 @@
package com.xhpc.user.service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
import com.xhpc.user.mapper.XhpcUserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 用户信息 服务层
*
* @author ruoyi
*/
@Service
public class XhpcUserServiceImpl implements IXhpcUserService {
@Resource
private XhpcUserMapper xhpcUserMapper;
/**
* 新增用户信息
*
* @param sysUser 用户信息
*/
@Override
public int insert(SysUser sysUser) {
return xhpcUserMapper.insert(sysUser);
}
/**
* 更新用户信息
*
* @param sysUser 用户信息
*/
@Override
public int update(SysUser sysUser) {
return xhpcUserMapper.update(sysUser);
}
/**
* 批量删除用户信息
*
* @param ids 需要删除的用户ID
* @return 结果
*/
@Override
public void deleteByIds(Long[] ids) {
xhpcUserMapper.deleteByIds(ids);
}
/**
* 获取平台用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @return 结果
*/
public List<Map<String, Object>> selectPcUserList(String userName, String nickName) {
return xhpcUserMapper.selectPcUserList(userName, nickName);
}
/**
* 平台用户详情
*
* @param userId 用户id
* @return 结果
*/
@Override
public Map<String, Object> pcInfo(Long userId) {
return xhpcUserMapper.pcInfo(userId);
}
/**
* 获取运营商用户列表
*
* @param userName 用户账号
* @param nickName 用户昵称
* @param operatorId 运营上id
* @return 结果
*/
@Override
public List<Map<String, Object>> selectOperatorUserList(String userName, String nickName, Long operatorId) {
Long userId = SecurityUtils.getUserId();
SysUser sysUser = xhpcUserMapper.selectUserByUserId(userId);
if ("00".equals(sysUser.getDataPowerType())) {
return xhpcUserMapper.selectOperatorUserList(userName, nickName, operatorId, null);
} else {
return xhpcUserMapper.selectOperatorUserList(userName, nickName, operatorId, sysUser.getUserName());
}
}
/**
* 运营商用户详情
*
* @param userId 用户id
* @return 结果
*/
@Override
public Map<String, Object> operatorInfo(Long userId) {
return xhpcUserMapper.operatorInfo(userId);
}
}

View File

@ -0,0 +1,10 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ __ _ _
(_) / _|(_)| |
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
| | | |_| || (_) || |_| || | | | | || || __/
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
__/ |
|___/

View File

@ -0,0 +1,29 @@
ppsvc:
server: 0.0.0.0
port: 8887
# Tomcat
server:
port: ${random.int(1300,1400)}
# Spring
spring:
application:
# 应用名称
name: xhpc-user
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/xphc-power-pile"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xhpc" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,281 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.user.mapper.XhpcOperatorMapper">
<resultMap type="com.xhpc.user.domain.XhpcOperator" id="XhpcOperatorResult">
<result column="operator_id" property="operatorId"/>
<result column="name" property="name"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="phone" property="phone"/>
<result column="attribute" property="attribute"/>
<result column="area_code" property="areaCode"/>
<result column="address" property="address"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="email" property="email"/>
<result column="commission_type" property="commissionType"/>
<result column="platform_commission_rate" property="platformCommissionRate"/>
<result column="maintenance_commission_rate" property="maintenanceCommissionRate"/>
<result column="business_license_id" property="businessLicenseId"/>
<result column="withdrawal_time" property="withdrawalTime"/>
<result column="soc" property="soc"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<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>
<sql id="Base_Column_List">
xo.operator_id, xo.name, xo.contact_name contactName, xo.contact_phone contactPhone,
xo.phone, xo.attribute, xo.area_code areaCode, xo.address,
xo.longitude, xo.latitude, xo.email, xo.commission_type commissionType,
xo.platform_commission_rate platformCommissionRate,
xo.maintenance_commission_rate maintenanceCommissionRate,
xo.business_license_id businessLicenseId, xo.withdrawal_time withdrawalTime, xo.soc,
xo.status, xo.del_flag delFlag, xo.create_time createTime,
xo.create_by createBy, xo.update_time updateTime, xo.update_by updateBy, xo.remark
</sql>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcOperator">
insert into xhpc_operator(
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != phone and '' != phone">
phone,
</if>
<if test="null != attribute and '' != attribute">
attribute,
</if>
<if test="null != areaCode and '' != areaCode">
area_code,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != longitude and '' != longitude">
longitude,
</if>
<if test="null != latitude and '' != latitude">
latitude,
</if>
<if test="null != email and '' != email">
email,
</if>
<if test="null != commissionType and '' != commissionType">
commission_type,
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
platform_commission_rate,
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
maintenance_commission_rate,
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
business_license_id,
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
withdrawal_time,
</if>
<if test="null != soc and '' != soc">
soc,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
)values(
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != phone and '' != phone">
#{phone},
</if>
<if test="null != attribute and '' != attribute">
#{attribute},
</if>
<if test="null != areaCode and '' != areaCode">
#{areaCode},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != longitude and '' != longitude">
#{longitude},
</if>
<if test="null != latitude and '' != latitude">
#{latitude},
</if>
<if test="null != email and '' != email">
#{email},
</if>
<if test="null != commissionType and '' != commissionType">
#{commissionType},
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
#{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
#{withdrawalTime},
</if>
<if test="null != soc and '' != soc">
#{soc},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
)
</insert>
<update id="update" parameterType="com.xhpc.user.domain.XhpcOperator">
UPDATE xhpc_operator
<set>
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
<if test="null != name and '' != name">name = #{name},</if>
<if test="null != contactName and '' != contactName">contact_name = #{contactName},</if>
<if test="null != contactPhone and '' != contactPhone">contact_phone = #{contactPhone},</if>
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != attribute and '' != attribute">attribute = #{attribute},</if>
<if test="null != areaCode and '' != areaCode">area_code = #{areaCode},</if>
<if test="null != address and '' != address">address = #{address},</if>
<if test="null != longitude and '' != longitude">longitude = #{longitude},</if>
<if test="null != latitude and '' != latitude">latitude = #{latitude},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != commissionType and '' != commissionType">commission_type = #{commissionType},</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">platform_commission_rate =
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">maintenance_commission_rate
= #{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">business_license_id =
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">withdrawal_time = #{withdrawalTime},</if>
<if test="null != soc and '' != soc">soc = #{soc},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE operator_id = #{operatorId}
</update>
<delete id="deleteByIds" parameterType="java.lang.Long">
delete from xhpc_operator where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="checkAccountUnique" parameterType="java.lang.String" resultMap="XhpcOperatorResult">
select * from xhpc_operator where phone = #{phone} limit 1
</select>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select
<include refid="Base_Column_List"/>
xdb.dict_value attributenName,`xa`.merger_name mergerName,
GROUP_CONCAT(DISTINCT xi.`url` ORDER BY xi.create_time DESC separator ',') businessLicenseUrl
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xo.area_code
LEFT JOIN xhpc_img xi on FIND_IN_SET(xi.img_id,xo.business_license_id )
where xo.del_flag = 0 and xo.operator_id = #{operatorId}
</select>
<select id="selectOperatorList" parameterType="java.lang.Long" resultType="java.util.Map">
select xo.operator_id, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
where xo.del_flag = 0 and xo.operator_id = #{operatorId}
</select>
<delete id="deleteUserRoleByUserId" parameterType="java.lang.Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<delete id="deleteUserPostByUserId" parameterType="java.lang.Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<update id="deleteUserById" parameterType="java.lang.Long">
update sys_user set del_flag = #{delFlag} where user_id = #{userId}
</update>
<select id="getUserByOperatorId" parameterType="java.lang.Long" resultType="com.ruoyi.system.api.domain.SysUser">
select *
from sys_user
where del_flag = 0 and operator_id = #{operatorId}
</select>
</mapper>

View File

@ -0,0 +1,263 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.user.mapper.XhpcUserMapper">
<resultMap type="com.ruoyi.system.api.domain.SysUser" id="XhpcUserResult">
<result column="user_id" property="userId"/>
<result column="dept_id" property="deptId"/>
<result column="user_name" property="userName"/>
<result column="nick_name" property="nickName"/>
<result column="email" property="email"/>
<result column="phonenumber" property="phonenumber"/>
<result column="operator_id" property="operatorId"/>
<result column="sex" property="sex"/>
<result column="avatar" property="avatar"/>
<result column="password" property="password"/>
<result column="data_power_type" property="dataPowerType"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="login_ip" property="loginIp"/>
<result column="login_date" property="loginDate"/>
<result column="create_by" property="createBy"/>
<result column="create_time" property="createTime"/>
<result column="update_by" property="updateBy"/>
<result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/>
</resultMap>
<insert id="insert" parameterType="com.ruoyi.system.api.domain.SysUser">
insert into sys_user(
<if test="null != userId and '' != userId">
user_id,
</if>
<if test="null != deptId and '' != deptId">
dept_id,
</if>
<if test="null != userName and '' != userName">
user_name,
</if>
<if test="null != nickName and '' != nickName">
nick_name,
</if>
<if test="null != userType and '' != userType">
user_type,
</if>
<if test="null != email and '' != email">
email,
</if>
<if test="null != phonenumber and '' != phonenumber">
phonenumber,
</if>
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != sex and '' != sex">
sex,
</if>
<if test="null != avatar and '' != avatar">
avatar,
</if>
<if test="null != password and '' != password">
password,
</if>
<if test="null != dataPowerType and '' != dataPowerType">
data_power_type,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != loginIp and '' != loginIp">
login_ip,
</if>
<if test="null != loginDate and '' != loginDate">
login_date,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != createTime and '' != createTime">
create_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != updateTime and '' != updateTime">
update_time,
</if>
<if test="null != remark and '' != remark">
remark
</if>
)values(
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != deptId and '' != deptId">
#{deptId},
</if>
<if test="null != userName and '' != userName">
#{userName},
</if>
<if test="null != nickName and '' != nickName">
#{nickName},
</if>
<if test="null != userType and '' != userType">
#{userType},
</if>
<if test="null != email and '' != email">
#{email},
</if>
<if test="null != phonenumber and '' != phonenumber">
#{phonenumber},
</if>
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != sex and '' != sex">
#{sex},
</if>
<if test="null != avatar and '' != avatar">
#{avatar},
</if>
<if test="null != password and '' != password">
#{password},
</if>
<if test="null != dataPowerType and '' != dataPowerType">
#{dataPowerType},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != loginIp and '' != loginIp">
#{loginIp},
</if>
<if test="null != loginDate and '' != loginDate">
#{loginDate},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != createTime and '' != createTime">
#{createTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != updateTime and '' != updateTime">
#{updateTime},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</insert>
<update id="update" parameterType="com.ruoyi.system.api.domain.SysUser">
UPDATE sys_user
<set>
<if test="null != deptId and '' != deptId">dept_id = #{deptId},</if>
<if test="null != userName and '' != userName">user_name = #{userName},</if>
<if test="null != nickName and '' != nickName">nick_name = #{nickName},</if>
<if test="null != userType and '' != userType">user_type = #{userType},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != phonenumber and '' != phonenumber">phonenumber = #{phonenumber},</if>
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
<if test="null != sex and '' != sex">sex = #{sex},</if>
<if test="null != avatar and '' != avatar">avatar = #{avatar},</if>
<if test="null != password and '' != password">password = #{password},</if>
<if test="null != dataPowerType and '' != dataPowerType">data_power_type = #{dataPowerType},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != loginIp and '' != loginIp">login_ip = #{loginIp},</if>
<if test="null != loginDate and '' != loginDate">login_date = #{loginDate},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE user_id = #{userId}
</update>
<delete id="deleteByIds" parameterType="java.lang.Long">
delete from sys_user where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="selectUserByUserId" parameterType="java.lang.Long" resultType="com.ruoyi.system.api.domain.SysUser">
select *
from sys_user
where user_id = #{userId}
</select>
<select id="selectPcUserList" parameterType="java.lang.String" resultType="java.util.Map">
select user_id userId,user_name userName,
nick_name nickName, email,
create_by createBy ,create_time createTime
from sys_user
WHERE del_flag = 0
<if test="userName != null and userName != ''">
and user_name like concat(concat('%', #{userName}), '%')
</if>
<if test="nickName != null and nickName != ''">
and nick_name like concat(concat('%', #{nickName}), '%')
</if>
</select>
<select id="pcInfo" parameterType="java.lang.Long" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName
from sys_user su
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex
WHERE su.del_flag = 0 and user_id = #{userId}
</select>
<select id="selectOperatorUserList" parameterType="java.lang.String" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,
xo.`name` operatorName,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName
from sys_user su
LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id
WHERE del_flag = 0
<if test="userName != null and userName != ''">
and user_name like concat(concat('%', #{userName}), '%')
</if>
<if test="nickName != null and nickName != ''">
and nick_name like concat(concat('%', #{nickName}), '%')
</if>
<if test="operatorId != null and operatorId != ''">
and operator_id = #{operatorId}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
</select>
<select id="operatorInfo" parameterType="java.lang.Long" resultType="java.util.Map">
select su.user_id userId,su.user_name userName,
su.nick_name nickName, su.email,
su.create_by createBy ,su.create_time createTime,
xo.`name` operatorName,su.`status` ,
CASE WHEN su.`status` = 0 THEN '正常' else '禁用' end statusName,
sdd.dict_label sexName
from sys_user su
LEFT JOIN xhpc_operator xo on xo.operator_id = su.operator_id
LEFT JOIN sys_dict_data sdd on sdd.`dict_type` = "sys_user_sex" and sdd.dict_code = su.sex
WHERE su.del_flag = 0 and user_id = #{userId}
</select>
</mapper>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<util:map id="serviceLogics">
<entry key="01" value-ref="RegisterLogic"/>
<entry key="03" value-ref="HBLogic"/>
<entry key="05" value-ref="RateModelValidateLogic"/>
<entry key="09" value-ref="RateModelRequestLogic"/>
</util:map>
</beans>