Merge branch 'v1.2.0-mechanism'
This commit is contained in:
commit
ae7f95db44
@ -34,7 +34,9 @@ public class SysUser extends BaseEntity
|
|||||||
@Excel(name = "部门编号", type = Type.IMPORT)
|
@Excel(name = "部门编号", type = Type.IMPORT)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/** 用户账号 */
|
/**
|
||||||
|
* 用户账号
|
||||||
|
*/
|
||||||
@Excel(name = "登录名称")
|
@Excel(name = "登录名称")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ -43,15 +45,26 @@ public class SysUser extends BaseEntity
|
|||||||
*/
|
*/
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
/** 用户昵称 */
|
/**
|
||||||
|
* 租户id(000000平台)
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
@Excel(name = "用户名称")
|
@Excel(name = "用户名称")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
|
|
||||||
/** 用户邮箱 */
|
/**
|
||||||
|
* 用户邮箱
|
||||||
|
*/
|
||||||
@Excel(name = "用户邮箱")
|
@Excel(name = "用户邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
/** 手机号码 */
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
@Excel(name = "手机号码")
|
@Excel(name = "手机号码")
|
||||||
private String phonenumber;
|
private String phonenumber;
|
||||||
|
|
||||||
@ -353,22 +366,37 @@ public class SysUser extends BaseEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDataPowerType(Integer dataPowerType) {
|
public void setDataPowerType(Integer dataPowerType) {
|
||||||
|
|
||||||
this.dataPowerType = dataPowerType;
|
this.dataPowerType = dataPowerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUserType() {
|
public String getUserType() {
|
||||||
|
|
||||||
return userType;
|
return userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserType(String userType) {
|
public void setUserType(String userType) {
|
||||||
|
|
||||||
this.userType = userType;
|
this.userType = userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getInternetUserId() {
|
public Long getInternetUserId() {
|
||||||
|
|
||||||
return internetUserId;
|
return internetUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInternetUserId(Long internetUserId) {
|
public void setInternetUserId(Long internetUserId) {
|
||||||
|
|
||||||
this.internetUserId = internetUserId;
|
this.internetUserId = internetUserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,16 +426,17 @@ public class SysUser extends BaseEntity
|
|||||||
.append("salt", getSalt())
|
.append("salt", getSalt())
|
||||||
.append("operatorId", getOperatorId())
|
.append("operatorId", getOperatorId())
|
||||||
.append("dataPowerType", getDataPowerType())
|
.append("dataPowerType", getDataPowerType())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
.append("loginIp", getLoginIp())
|
.append("loginIp", getLoginIp())
|
||||||
.append("loginDate", getLoginDate())
|
.append("loginDate", getLoginDate())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("updateBy", getUpdateBy())
|
.append("updateBy", getUpdateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("dept", getDept())
|
.append("dept", getDept())
|
||||||
|
.append("tenantId", getTenantId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
package com.xhpc.system.api.model;
|
package com.xhpc.system.api.model;
|
||||||
|
|
||||||
|
import com.xhpc.system.api.domain.SysUser;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.xhpc.system.api.domain.SysUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户信息
|
* 用户信息
|
||||||
*
|
*
|
||||||
@ -34,6 +34,16 @@ public class LoginUser implements Serializable
|
|||||||
*/
|
*/
|
||||||
private Integer userType;
|
private Integer userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录用户的openID
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录时间
|
* 登录时间
|
||||||
*/
|
*/
|
||||||
@ -151,14 +161,39 @@ public class LoginUser implements Serializable
|
|||||||
|
|
||||||
public void setSysUser(SysUser sysUser)
|
public void setSysUser(SysUser sysUser)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.sysUser = sysUser;
|
this.sysUser = sysUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getUserType() {
|
public Integer getUserType() {
|
||||||
|
|
||||||
return userType;
|
return userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserType(Integer userType) {
|
public void setUserType(Integer userType) {
|
||||||
|
|
||||||
this.userType = userType;
|
this.userType = userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTenantId() {
|
||||||
|
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpenId() {
|
||||||
|
|
||||||
|
return openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpenId(String openId) {
|
||||||
|
|
||||||
|
this.openId = openId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -112,5 +112,8 @@ public class HttpStatus
|
|||||||
*/
|
*/
|
||||||
public static final Integer ERROR_STATUS = 1010;
|
public static final Integer ERROR_STATUS = 1010;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 该账号已被绑定
|
||||||
|
*/
|
||||||
|
public static final Integer ACCOUNT_BINDING = 1999;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,20 +34,31 @@ public class BaseEntity implements Serializable
|
|||||||
/** 更新者 */
|
/** 更新者 */
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
|
|
||||||
/** 更新时间 */
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/** 备注 */
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/** 请求参数 */
|
/**
|
||||||
|
* 租户id
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求参数
|
||||||
|
*/
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> params;
|
private Map<String, Object> params;
|
||||||
|
|
||||||
public String getSearchValue()
|
public String getSearchValue() {
|
||||||
{
|
|
||||||
return searchValue;
|
return searchValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,25 +102,34 @@ public class BaseEntity implements Serializable
|
|||||||
return updateTime;
|
return updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUpdateTime(Date updateTime)
|
public void setUpdateTime(Date updateTime) {
|
||||||
{
|
|
||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemark()
|
public String getRemark() {
|
||||||
{
|
|
||||||
return remark;
|
return remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemark(String remark)
|
public void setRemark(String remark) {
|
||||||
{
|
|
||||||
this.remark = remark;
|
this.remark = remark;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getParams()
|
public String getTenantId() {
|
||||||
{
|
|
||||||
if (params == null)
|
return tenantId;
|
||||||
{
|
}
|
||||||
|
|
||||||
|
public void setTenantId(String tenantId) {
|
||||||
|
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> getParams() {
|
||||||
|
|
||||||
|
if (params == null) {
|
||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
|
|||||||
@ -43,6 +43,9 @@ public class TokenService {
|
|||||||
loginUser.setUserid(loginUser.getSysUser().getUserId());
|
loginUser.setUserid(loginUser.getSysUser().getUserId());
|
||||||
loginUser.setUsername(loginUser.getSysUser().getUserName());
|
loginUser.setUsername(loginUser.getSysUser().getUserName());
|
||||||
loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
loginUser.setIpaddr(IpUtils.getIpAddr(ServletUtils.getRequest()));
|
||||||
|
loginUser.setTenantId(loginUser.getTenantId());
|
||||||
|
loginUser.setUserType(loginUser.getUserType());
|
||||||
|
loginUser.setOpenId(loginUser.getOpenId());
|
||||||
refreshToken(loginUser);
|
refreshToken(loginUser);
|
||||||
|
|
||||||
// 保存或更新用户token
|
// 保存或更新用户token
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import com.xhpc.system.api.domain.SysRole;
|
|||||||
import com.xhpc.system.api.domain.SysUser;
|
import com.xhpc.system.api.domain.SysUser;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import com.xhpc.system.service.*;
|
import com.xhpc.system.service.*;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -24,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -106,6 +104,7 @@ public class SysUserController extends BaseController {
|
|||||||
Set<String> permissions = permissionService.getMenuPermission(sysUser.getUserId());
|
Set<String> permissions = permissionService.getMenuPermission(sysUser.getUserId());
|
||||||
LoginUser sysUserVo = new LoginUser();
|
LoginUser sysUserVo = new LoginUser();
|
||||||
sysUserVo.setSysUser(sysUser);
|
sysUserVo.setSysUser(sysUser);
|
||||||
|
sysUserVo.setTenantId(sysUser.getTenantId());
|
||||||
sysUserVo.setRoles(roles);
|
sysUserVo.setRoles(roles);
|
||||||
sysUserVo.setPermissions(permissions);
|
sysUserVo.setPermissions(permissions);
|
||||||
return R.ok(sysUserVo);
|
return R.ok(sysUserVo);
|
||||||
|
|||||||
@ -51,18 +51,48 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectUserVo">
|
<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,
|
select u.user_id,
|
||||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,u.data_power_type ,
|
u.dept_id,
|
||||||
r.role_id, r.role_name, r.role_key , r.role_sort, r.data_scope, r.status as role_status,u.user_type,u.operator_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,
|
||||||
|
u.data_power_type,
|
||||||
|
r.role_id,
|
||||||
|
r.role_name,
|
||||||
|
r.role_key,
|
||||||
|
r.role_sort,
|
||||||
|
r.data_scope,
|
||||||
|
r.status as role_status,
|
||||||
|
u.user_type,
|
||||||
|
u.tenant_id,
|
||||||
|
u.operator_id
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role ur on u.user_id = ur.user_id
|
left join sys_user_role ur on u.user_id = ur.user_id
|
||||||
left join sys_role r on r.role_id = ur.role_id
|
left join sys_role r on r.role_id = ur.role_id
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUserList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
|
<select id="selectUserList" parameterType="com.xhpc.system.api.domain.SysUser" resultMap="SysUserResult">
|
||||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex,
|
select u.user_id, u.dept_id, u.nick_name, u.user_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_name, d.leader from
|
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader,
|
||||||
|
u.tenant_id from
|
||||||
sys_user u
|
sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
where u.del_flag = '0'
|
where u.del_flag = '0'
|
||||||
|
|||||||
233
sql/v2.1.sql
233
sql/v2.1.sql
@ -45,3 +45,236 @@ CREATE TABLE `xhpc_tradebill_internet_check_record`
|
|||||||
ROW_FORMAT = DYNAMIC
|
ROW_FORMAT = DYNAMIC
|
||||||
AUTO_INCREMENT = 34670
|
AUTO_INCREMENT = 34670
|
||||||
;
|
;
|
||||||
|
|
||||||
|
ALTER TABLE `xhpc_app_user` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `is_refund`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||||
|
ALTER TABLE `xhpc_community_personnel` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `is_refund_application` int(10) NULL DEFAULT 0 COMMENT '是否有退款订单审核(0无 1有)' AFTER `remark`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `soc` int(10) NULL DEFAULT NULL COMMENT '用户设置的SOC' AFTER `is_refund_application`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像地址' AFTER `soc`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `weixin_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `avatar`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_open_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL AFTER `weixin_open_id`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `weixin_login` int(10) NULL DEFAULT 0 COMMENT '微信是否登录(0未登录 1已登录)' AFTER `alipay_open_id`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `alipay_login` int(10) NULL DEFAULT 0 COMMENT '支付宝是否登录(0未登录 1已登录)' AFTER `weixin_login`;
|
||||||
|
ALTER TABLE `xhpc_customers_personnel` ADD COLUMN `is_refund` int(4) NULL DEFAULT 0 COMMENT '是否退款 0 不退款 1 退款' AFTER `soc`;
|
||||||
|
|
||||||
|
CREATE TABLE `xhpc_user_login` (
|
||||||
|
`user_login_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`app_user_id` bigint(20) DEFAULT NULL COMMENT '用户id',
|
||||||
|
`account` varchar(50) DEFAULT NULL COMMENT '账号',
|
||||||
|
`user_type` int(4) NOT NULL COMMENT '用户类型 0 C端用户 1 流量方用户 2社区用户 3B端用户)',
|
||||||
|
`open_id` varchar(50) DEFAULT NULL COMMENT 'openid',
|
||||||
|
`type` int(4) DEFAULT '0' COMMENT '1 微信 2支付宝',
|
||||||
|
`status` int(4) DEFAULT '1' COMMENT '0退出 1登录',
|
||||||
|
`del_flag` int(1) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||||
|
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_by` varchar(64) DEFAULT '' COMMENT '更新者',
|
||||||
|
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||||
|
PRIMARY KEY (`user_login_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='小程序用户最后一次登录记录';
|
||||||
|
|
||||||
|
CREATE TABLE `xhpc_tenant`
|
||||||
|
(
|
||||||
|
`tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户ID',
|
||||||
|
`tenant_name` VARCHAR(50) NOT NULL COMMENT '租户名称',
|
||||||
|
`domain` VARCHAR(255) NULL DEFAULT NULL COMMENT '域名地址',
|
||||||
|
`background_url` VARCHAR(1000) NULL DEFAULT NULL COMMENT '系统背景',
|
||||||
|
`linkman` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系人',
|
||||||
|
`contact_number` VARCHAR(20) NULL DEFAULT NULL COMMENT '联系电话',
|
||||||
|
`address` VARCHAR(255) NULL DEFAULT NULL COMMENT '联系地址',
|
||||||
|
`station_quote` INT(11) NULL DEFAULT '-1' COMMENT '场站限额',
|
||||||
|
`station_pile_quote` INT(11) NULL DEFAULT '-1' COMMENT '每站桩限额',
|
||||||
|
`expire_time` DATETIME NULL DEFAULT NULL COMMENT '过期时间',
|
||||||
|
`create_user` BIGINT(64) NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
`create_dept` BIGINT(64) NULL DEFAULT NULL COMMENT '创建部门',
|
||||||
|
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人',
|
||||||
|
`update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
|
`status` INT(2) NULL DEFAULT NULL COMMENT '状态',
|
||||||
|
`is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除',
|
||||||
|
PRIMARY KEY (`tenant_id`) USING BTREE
|
||||||
|
)
|
||||||
|
COMMENT ='租户表'
|
||||||
|
COLLATE = 'utf8mb4_general_ci'
|
||||||
|
ENGINE = InnoDB
|
||||||
|
;
|
||||||
|
|
||||||
|
ALTER TABLE `et_auth_sec_token`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_charge_order_info`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_common_operator_info`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_common_station_info`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_connector_status_info`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_dispute_orders`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_equip_charge_status_info`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `et_order_mapping`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `gen_table`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `gen_table_column`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `hibernate_sequence`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `oder_test`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `service_field`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_config`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_dept`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_dict_data`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_dict_type`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_job`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_job_log`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_logininfor`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_menu`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_notice`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_oper_log`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_post`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_role`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_role_dept`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_role_menu`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_user`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_user_post`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `sys_user_role`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_agreement`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_app_user`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_area`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charge_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charge_order_current`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charge_order_soc`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charge_order_status`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charge_order_voltage`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charging_pile`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charging_station`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_charging_station_push_status`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_community`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_community_personnel`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_customers`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_customers_personnel`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_data_dimension`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_device_message`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_dict_biz`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_help`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_history_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_history_order_reconciliation_status`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_history_order_sorting_status`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_img`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_internet_user`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_invoice`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_invoice_map_history_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_mechanism`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_message`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_notice_read`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_operator`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_operator_internet_blacklist`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_order_redis_record`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_promotion`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_promotion_coupon`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_promotion_platform`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_promotion_station`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_rate`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_rate_model`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_rate_time`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_real_time_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_recharge_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_refund_audit`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_refund_order`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_sms`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_station_internet_blacklist`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_statistics_station`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_statistics_time_interval`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_terminal`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_tradebill_internet_check_record`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_tradebill_payment_check_record`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_tradebill_upload_record`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_user_account_statement`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_user_login`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_user_privilege`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
ALTER TABLE `xhpc_vin_blacklist`
|
||||||
|
ADD COLUMN `tenant_id` VARCHAR(12) NULL DEFAULT '000000' COMMENT '租户id';
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.xhpc.common.api;
|
||||||
|
|
||||||
|
import com.xhpc.common.api.factory.UserTypeFallbackFactory;
|
||||||
|
import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 10:23
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId ="userTypeService",value = ServiceNameConstants.XHPC_USER, fallbackFactory = UserTypeFallbackFactory.class)
|
||||||
|
public interface UserTypeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据手机号(账号),用户id和类型 获取用户信息
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/common/getUser")
|
||||||
|
R getUser(@RequestParam(value = "phone")String phone,@RequestParam(value = "userId")Long userId,@RequestParam(value = "userType")Integer userType,@RequestParam(value = "serialNumber")String serialNumber);
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.xhpc.common.api.factory;
|
||||||
|
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 10:27
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService> {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UserTypeFallbackFactory.class);
|
||||||
|
@Override
|
||||||
|
public UserTypeService create(Throwable cause) {
|
||||||
|
logger.error("用户服务调用失败:{} //fallback", cause.getMessage());
|
||||||
|
return new UserTypeService() {
|
||||||
|
@Override
|
||||||
|
public R getUser(String phone, Long userId, Integer userType,String serialNumber) {
|
||||||
|
return R.fail("用户信息获取失败:" + cause.getMessage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.xhpc.common.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 16:48
|
||||||
|
*/
|
||||||
|
public class UserTypeUtil {
|
||||||
|
//c端用户
|
||||||
|
public static final String USER = "C";
|
||||||
|
//流量端用户
|
||||||
|
public static final String INTERNET = "L";
|
||||||
|
//社区端用户
|
||||||
|
public static final String COMMUNIT = "ST";
|
||||||
|
//B端大客户
|
||||||
|
public static final String CUSTOMERS = "BE";
|
||||||
|
|
||||||
|
//c端用户
|
||||||
|
public static final Integer USER_TYPE = 0;
|
||||||
|
//流量端用户
|
||||||
|
public static final Integer INTERNET_TYPE = 1;
|
||||||
|
//社区端用户
|
||||||
|
public static final Integer COMMUNIT_TYPE = 2;
|
||||||
|
//B端大客户
|
||||||
|
public static final Integer CUSTOMERS_TYPE = 3;
|
||||||
|
|
||||||
|
//重新登录
|
||||||
|
public static final Integer LOGIN_TYPE = 1999;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.xhpc.general;
|
package com.xhpc;
|
||||||
|
|
||||||
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
||||||
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
||||||
@ -6,12 +6,14 @@ import com.xhpc.common.swagger.annotation.EnableCustomSwagger2;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
@EnableCustomConfig
|
@EnableCustomConfig
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@MapperScan("com.xhpc.general.mapper")
|
@MapperScan("com.xhpc.general.mapper")
|
||||||
|
@EnableScheduling
|
||||||
public class XhpcGeneralApplication {
|
public class XhpcGeneralApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -1,8 +1,11 @@
|
|||||||
package com.xhpc.general.controller;
|
package com.xhpc.general.controller;
|
||||||
|
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.general.service.IXhpcSmsService;
|
import com.xhpc.general.service.IXhpcSmsService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -20,7 +23,8 @@ public class XhpcSmsController extends BaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IXhpcSmsService xhpcSmsService;
|
private IXhpcSmsService xhpcSmsService;
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
/**
|
/**
|
||||||
* 注册获取手机号验证码
|
* 注册获取手机号验证码
|
||||||
*/
|
*/
|
||||||
@ -33,7 +37,20 @@ public class XhpcSmsController extends BaseController {
|
|||||||
signatureName = "小华充电";
|
signatureName = "小华充电";
|
||||||
templateId = "SMS_226786362";
|
templateId = "SMS_226786362";
|
||||||
|
|
||||||
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId);
|
if(phone !=null || "".equals(phone)){
|
||||||
|
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||||
|
//C端用户
|
||||||
|
return xhpcSmsService.getLogonPhoneCode(phone, signatureName, templateId,null);
|
||||||
|
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) || UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||||
|
R user = userTypeService.getUser(phone, null, null, null);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||||
|
return xhpcSmsService.getLogonPhoneCode(map.get("phone").toString(), signatureName, templateId,map.get("account").toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AjaxResult.error("1003", "请输入正确的手机号或账号");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/getList")
|
@GetMapping(value = "/getList")
|
||||||
@ -83,4 +100,9 @@ public class XhpcSmsController extends BaseController {
|
|||||||
Object messageInfo = xhpcSmsService.getAliyunShortMessageInfo();
|
Object messageInfo = xhpcSmsService.getAliyunShortMessageInfo();
|
||||||
return AjaxResult.success(messageInfo);
|
return AjaxResult.success(messageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String phone="ST18123374";
|
||||||
|
System.out.println(phone.substring(0,2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public interface IXhpcSmsService {
|
|||||||
* @param phone
|
* @param phone
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId);
|
AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId,String account);
|
||||||
|
|
||||||
List<Map<String, Object>> getList(Integer status,String phone);
|
List<Map<String, Object>> getList(Integer status,String phone);
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public interface IXhpcSmsService {
|
|||||||
* @param paramMap 模板中的参数
|
* @param paramMap 模板中的参数
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap);
|
AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap,String account);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送通知短信方法
|
* 发送通知短信方法
|
||||||
|
|||||||
@ -48,13 +48,13 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId) {
|
public AjaxResult getLogonPhoneCode(String phone, String signatureName, String templateId,String account) {
|
||||||
|
|
||||||
String random = getRandom();
|
String random = getRandom();
|
||||||
HashMap<String, String> paramMap = new HashMap<>();
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
paramMap.put("code", random);
|
paramMap.put("code", random);
|
||||||
String content = null;
|
String content = null;
|
||||||
return send(phone, content, random, signatureName, templateId, paramMap);
|
return send(phone, content, random, signatureName, templateId, paramMap,account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,7 +64,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap) {
|
public AjaxResult send(String phone, String content, String random, String signatureName, String templateId, Map<String, String> paramMap,String account) {
|
||||||
//调用接口
|
//调用接口
|
||||||
String pattern = "^([1][0-9]{10})";
|
String pattern = "^([1][0-9]{10})";
|
||||||
Pattern compile = Pattern.compile(pattern);
|
Pattern compile = Pattern.compile(pattern);
|
||||||
@ -76,14 +76,26 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
|
|||||||
//添加短信记录
|
//添加短信记录
|
||||||
XhpcSms xhpcSms =new XhpcSms();
|
XhpcSms xhpcSms =new XhpcSms();
|
||||||
try {
|
try {
|
||||||
//用户使用的Key
|
String pvToken ="";
|
||||||
String pvToken = "pvToken:" + phone;
|
String token ="";
|
||||||
//用户频繁调用的判断的Key
|
if(account !=null){
|
||||||
String token = "token:" + phone;
|
//用户使用的Key
|
||||||
String cacheObject = REDIS.getCacheObject(token);
|
pvToken = "pvToken:" + account;
|
||||||
System.out.println("过了redis");
|
//用户频繁调用的判断的Key
|
||||||
if (cacheObject != null) {
|
token = "token:" + account;
|
||||||
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
String cacheObject = REDIS.getCacheObject(token);
|
||||||
|
if (cacheObject != null) {
|
||||||
|
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//用户使用的Key
|
||||||
|
pvToken = "pvToken:" + phone;
|
||||||
|
//用户频繁调用的判断的Key
|
||||||
|
token = "token:" + phone;
|
||||||
|
String cacheObject = REDIS.getCacheObject(token);
|
||||||
|
if (cacheObject != null) {
|
||||||
|
return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//使用阿里云发送通知短信
|
//使用阿里云发送通知短信
|
||||||
Map<String, String> neededParam = null;
|
Map<String, String> neededParam = null;
|
||||||
|
|||||||
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -71,10 +72,10 @@ public class XhpcChargeOrderController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/startUp")
|
@GetMapping("/startUp")
|
||||||
public AjaxResult startUp(@RequestParam Long userId,@RequestParam String serialNumber,@RequestParam Integer type){
|
public AjaxResult startUp(HttpServletRequest request, @RequestParam Long userId, @RequestParam String serialNumber, @RequestParam Integer type){
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<启动充电>>>>>>>>>>>>>>>>>");
|
||||||
return iXhpcChargeOrderService.startUp(userId, serialNumber, type);
|
return iXhpcChargeOrderService.startUp(request,userId, serialNumber, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.xhpc.order.domain.XhpcChargeOrder;
|
|||||||
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -47,7 +48,7 @@ public interface IXhpcChargeOrderService {
|
|||||||
* @param serialNumber 终端编码
|
* @param serialNumber 终端编码
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult startUp(Long userId,String serialNumber,Integer type);
|
AjaxResult startUp(HttpServletRequest request, Long userId, String serialNumber, Integer type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 停止充电
|
* 停止充电
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package com.xhpc.order.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.xhpc.common.api.PowerPileService;
|
import com.xhpc.common.api.PowerPileService;
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.data.down.StartChargingData;
|
import com.xhpc.common.data.down.StartChargingData;
|
||||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||||
@ -10,11 +12,14 @@ import com.xhpc.common.data.redis.StaticBeanUtil;
|
|||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.domain.XhpcTerminal;
|
import com.xhpc.common.domain.XhpcTerminal;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
|
import com.xhpc.common.security.service.TokenService;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.XhpcChargeOrder;
|
import com.xhpc.order.domain.XhpcChargeOrder;
|
||||||
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
import com.xhpc.order.domain.XhpcOrderRedisRecord;
|
||||||
import com.xhpc.order.mapper.XhpcChargeOrderMapper;
|
import com.xhpc.order.mapper.XhpcChargeOrderMapper;
|
||||||
import com.xhpc.order.mapper.XhpcInternetUserMapper;
|
import com.xhpc.order.mapper.XhpcInternetUserMapper;
|
||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -22,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -46,6 +52,10 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private XhpcInternetUserMapper xhpcInternetUserMapper;
|
private XhpcInternetUserMapper xhpcInternetUserMapper;
|
||||||
|
@Autowired
|
||||||
|
private TokenService tokenService;
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(XhpcChargeOrderServiceImpl.class);
|
||||||
//队列名称
|
//队列名称
|
||||||
@ -80,159 +90,181 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public AjaxResult startUp(Long userId, String terminalSerialNumber, Integer type) {
|
public AjaxResult startUp(HttpServletRequest request, Long userId, String terminalSerialNumber, Integer type) {
|
||||||
|
|
||||||
String pattern = "^([0-9]{16})";
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
Pattern compile = Pattern.compile(pattern);
|
if (StringUtils.isNotNull(loginUser)) {
|
||||||
Matcher m = compile.matcher(terminalSerialNumber);
|
String username = loginUser.getUsername();
|
||||||
if (terminalSerialNumber.length() != 16 || !m.matches()) {
|
Integer userType = loginUser.getUserType();
|
||||||
return AjaxResult.error(1104, "无效的终端编号");
|
Long userid = loginUser.getUserid();
|
||||||
}
|
String openId = loginUser.getOpenId();
|
||||||
//查看充电用户金额是否大于5元
|
R user = userTypeService.getUser(null, userid, userType, terminalSerialNumber);
|
||||||
Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId);
|
if(userId !=userid || user ==null || user.getData() ==null){
|
||||||
BigDecimal a = new BigDecimal(5);
|
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
|
||||||
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
|
}
|
||||||
return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电");
|
Map<String, Object> userMessage = (Map<String, Object>)user.getData();
|
||||||
}
|
if(UserTypeUtil.USER_TYPE !=userType){
|
||||||
//充电用户是否存在异常的订单
|
if(Integer.valueOf(userMessage.get("number").toString())==0){
|
||||||
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId);
|
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "此账号不能在该场站充电,请使用手机号登录");
|
||||||
if (j > 0) {
|
|
||||||
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
|
|
||||||
}
|
|
||||||
//查看充电用户是否有申请退款的订单,还未处理
|
|
||||||
if (Integer.parseInt(userMessage.get("isRefundApplication").toString()) != 0) {
|
|
||||||
return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款");
|
|
||||||
}
|
|
||||||
//充电用户是否在充电中
|
|
||||||
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId);
|
|
||||||
if (!"".equals(i) && i!=null) {
|
|
||||||
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
|
|
||||||
}
|
|
||||||
//终端状态是否空闲
|
|
||||||
//是否插枪
|
|
||||||
Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + terminalSerialNumber);
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + terminalSerialNumber);
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + cacheMap.toString());
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
|
||||||
|
|
||||||
if(cacheMap==null){
|
|
||||||
return AjaxResult.error(1105, "未注册的终端,请选择其他终端充电");
|
|
||||||
}else{
|
|
||||||
if(cacheMap.get("status") ==null){
|
|
||||||
return AjaxResult.error(1106, "未知的终端状态,请选择其他终端充电");
|
|
||||||
}else{
|
|
||||||
String status = cacheMap.get("status").toString();
|
|
||||||
//不同的状态
|
|
||||||
if("离线".equals(status)||"故障".equals(status) ||"充电".equals(status)){
|
|
||||||
return AjaxResult.error(1107, "此终端"+status+"中,请选择其他终端充电");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cacheMap.get("vehicleGunStatus") ==null){
|
|
||||||
return AjaxResult.error(1108, "未知的枪状态,请选择其他终端充电");
|
|
||||||
|
String pattern = "^([0-9]{16})";
|
||||||
|
Pattern compile = Pattern.compile(pattern);
|
||||||
|
Matcher m = compile.matcher(terminalSerialNumber);
|
||||||
|
if (terminalSerialNumber.length() != 16 || !m.matches()) {
|
||||||
|
return AjaxResult.error(1104, "无效的终端编号");
|
||||||
|
}
|
||||||
|
//查看充电用户金额是否大于5元
|
||||||
|
//Map<String, Object> userMessage = xhpcChargeOrderMapper.getUserMessage(userId);
|
||||||
|
BigDecimal a = new BigDecimal(5);
|
||||||
|
if (userMessage == null || userMessage.get("balance") == null || a.compareTo(new BigDecimal(userMessage.get("balance").toString())) == 1) {
|
||||||
|
return AjaxResult.error(1100, "金额小于5元,不能充电,请充值后再进行充电");
|
||||||
|
}
|
||||||
|
//充电用户是否存在异常的订单
|
||||||
|
int j = xhpcChargeOrderMapper.countXhpcChargeOrder(userId);
|
||||||
|
if (j > 0) {
|
||||||
|
return AjaxResult.error(1103, "你有异常订单未解决,请拨打客服电话进行解决");
|
||||||
|
}
|
||||||
|
//查看充电用户是否有申请退款的订单,还未处理
|
||||||
|
if (Integer.parseInt(userMessage.get("isRefundApplication").toString()) != 0) {
|
||||||
|
return AjaxResult.error(1101, "你有申请退款订单在审核中,需要充电请取消申请退款");
|
||||||
|
}
|
||||||
|
//充电用户是否在充电中
|
||||||
|
String i = xhpcChargeOrderMapper.countXhpcRealTimeOrder(userId);
|
||||||
|
if (!"".equals(i) && i!=null) {
|
||||||
|
return AjaxResult.error(1102, "车辆正在充电,请查询车辆充电信息");
|
||||||
|
}
|
||||||
|
//终端状态是否空闲
|
||||||
|
//是否插枪
|
||||||
|
Map<String, Object> cacheMap = REDIS.getCacheMap("gun:" + terminalSerialNumber);
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + terminalSerialNumber);
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>" + cacheMap.toString());
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<cacheMap>>>>>>>>>>>>>>>>>");
|
||||||
|
|
||||||
|
if(cacheMap==null){
|
||||||
|
return AjaxResult.error(1105, "未注册的终端,请选择其他终端充电");
|
||||||
}else{
|
}else{
|
||||||
String vehicleGunStatus = cacheMap.get("vehicleGunStatus").toString();
|
if(cacheMap.get("status") ==null){
|
||||||
if(!"是".equals(vehicleGunStatus)){
|
return AjaxResult.error(1106, "未知的终端状态,请选择其他终端充电");
|
||||||
return AjaxResult.error(1109, "请插好充电枪");
|
}else{
|
||||||
|
String status = cacheMap.get("status").toString();
|
||||||
|
//不同的状态
|
||||||
|
if("离线".equals(status)||"故障".equals(status) ||"充电".equals(status)){
|
||||||
|
return AjaxResult.error(1107, "此终端"+status+"中,请选择其他终端充电");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(cacheMap.get("vehicleGunStatus") ==null){
|
||||||
|
return AjaxResult.error(1108, "未知的枪状态,请选择其他终端充电");
|
||||||
|
}else{
|
||||||
|
String vehicleGunStatus = cacheMap.get("vehicleGunStatus").toString();
|
||||||
|
if(!"是".equals(vehicleGunStatus)){
|
||||||
|
return AjaxResult.error(1109, "请插好充电枪");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//终端信息
|
//终端信息
|
||||||
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber);
|
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber);
|
||||||
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
|
||||||
return AjaxResult.error(1104, "无效的终端编号");
|
return AjaxResult.error(1104, "无效的终端编号");
|
||||||
}
|
}
|
||||||
//余额
|
//余额
|
||||||
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
|
String balance = new BigDecimal(userMessage.get("balance").toString()).multiply(new BigDecimal(100)).toString();
|
||||||
|
|
||||||
//获取桩信息
|
//获取桩信息
|
||||||
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
|
Map<String, Object> xhpcChargingPileById =xhpcChargeOrderMapper.getXhpcChargingPileById(xhpcTerminal.getChargingPileId());
|
||||||
|
|
||||||
//启动充电
|
//启动充电
|
||||||
StartChargingData startChargingData = new StartChargingData();
|
StartChargingData startChargingData = new StartChargingData();
|
||||||
//订单流水号 终端号+年月日时分秒+自增4位 共32位
|
//订单流水号 终端号+年月日时分秒+自增4位 共32位
|
||||||
String orderNo = genOrder(terminalSerialNumber);
|
String orderNo = genOrder(terminalSerialNumber);
|
||||||
|
|
||||||
startChargingData.setOrderNo(orderNo);
|
startChargingData.setOrderNo(orderNo);
|
||||||
if(userMessage.get("phone") !=null){
|
if(userMessage.get("phone") !=null){
|
||||||
startChargingData.setTel(userMessage.get("phone").toString());
|
startChargingData.setTel(userMessage.get("phone").toString());
|
||||||
}
|
}
|
||||||
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
|
startChargingData.setPileNo(xhpcTerminal.getPileSerialNumber());
|
||||||
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
|
startChargingData.setGunId(xhpcTerminal.getSerialNumber().substring(14));
|
||||||
startChargingData.setBalance(Double.valueOf(balance).intValue());
|
startChargingData.setBalance(Double.valueOf(balance).intValue());
|
||||||
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
|
if(xhpcChargingPileById.get("communicationProtocolVersion")!=null && !"".equals(xhpcChargingPileById.get("communicationProtocolVersion").toString())){
|
||||||
startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString());
|
startChargingData.setVersion(xhpcChargingPileById.get("communicationProtocolVersion").toString());
|
||||||
}else{
|
}else{
|
||||||
startChargingData.setVersion("0A");
|
startChargingData.setVersion("0A");
|
||||||
}
|
}
|
||||||
|
|
||||||
//用户、桩、平台(最小的)
|
//用户、桩、平台(最小的)
|
||||||
int number =0;
|
int number =0;
|
||||||
if(!"".equals(userMessage.get("soc")) && userMessage.get("soc") !=null && !"".equals(userMessage.get("soc"))){
|
if(!"".equals(userMessage.get("soc")) && userMessage.get("soc") !=null && !"".equals(userMessage.get("soc"))){
|
||||||
number =Integer.parseInt(userMessage.get("soc").toString());
|
number =Integer.parseInt(userMessage.get("soc").toString());
|
||||||
}
|
}
|
||||||
//平台
|
//平台
|
||||||
String soc = redisService.getCacheObject("global:SOC");
|
String soc = redisService.getCacheObject("global:SOC");
|
||||||
if(!"".equals(soc) && soc!=null){
|
if(!"".equals(soc) && soc!=null){
|
||||||
if(number!=0){
|
if(number!=0){
|
||||||
if(Integer.parseInt(soc)-number<0){
|
if(Integer.parseInt(soc)-number<0){
|
||||||
|
number=Integer.parseInt(soc);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
number=Integer.parseInt(soc);
|
number=Integer.parseInt(soc);
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
number=Integer.parseInt(soc);
|
|
||||||
}
|
}
|
||||||
}
|
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(xhpcTerminal.getChargingStationId());
|
||||||
Map<String, Object> operatorMessage = xhpcChargeOrderMapper.getOperatorMessage(xhpcTerminal.getChargingStationId());
|
if(operatorMessage !=null && operatorMessage.get("soc") !=null && !"".equals(operatorMessage.get("soc"))){
|
||||||
if(operatorMessage !=null && operatorMessage.get("soc") !=null && !"".equals(operatorMessage.get("soc"))){
|
if(number!=0){
|
||||||
if(number!=0){
|
if(Integer.parseInt(operatorMessage.get("soc").toString())-number<0){
|
||||||
if(Integer.parseInt(operatorMessage.get("soc").toString())-number<0){
|
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||||
|
}
|
||||||
|
}else{
|
||||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
number=Integer.parseInt(operatorMessage.get("soc").toString());
|
}
|
||||||
|
if(number !=0){
|
||||||
|
startChargingData.setSoc(number);
|
||||||
|
}
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<number>>>>>>>>>>>>>>>>>:"+number);
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:"+startChargingData.getSoc());
|
||||||
|
|
||||||
|
R r1 = powerPileService.startCharging(startChargingData);
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
|
||||||
|
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
|
||||||
|
if (r1.getCode() != 200) {
|
||||||
|
return AjaxResult.error(r1.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
if(number !=0){
|
|
||||||
startChargingData.setSoc(number);
|
|
||||||
}
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<number>>>>>>>>>>>>>>>>>:"+number);
|
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:"+startChargingData.getSoc());
|
|
||||||
|
|
||||||
R r1 = powerPileService.startCharging(startChargingData);
|
//创建充电订单(充电启动soc初始值,结束是获取,并修改状态)
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
|
XhpcChargeOrder xhpcChargeOrder = new XhpcChargeOrder();
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
|
xhpcChargeOrder.setChargingStationId(xhpcTerminal.getChargingStationId());
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
|
xhpcChargeOrder.setUserId(userId);
|
||||||
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
|
xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId());
|
||||||
if (r1.getCode() != 200) {
|
xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber());
|
||||||
return AjaxResult.error(r1.getMsg());
|
xhpcChargeOrder.setSerialNumber(orderNo);
|
||||||
}
|
xhpcChargeOrder.setSource(0);
|
||||||
|
xhpcChargeOrder.setStatus(-1);
|
||||||
|
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
|
||||||
|
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
|
||||||
|
}
|
||||||
|
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
|
||||||
|
if (type == 1) {
|
||||||
|
xhpcChargeOrder.setChargingMode("微信");
|
||||||
|
} else {
|
||||||
|
xhpcChargeOrder.setChargingMode("支付宝");
|
||||||
|
}
|
||||||
|
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
|
||||||
|
xhpcChargeOrder.setType(40);
|
||||||
|
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
|
||||||
|
|
||||||
|
return AjaxResult.success();
|
||||||
|
|
||||||
//创建充电订单(充电启动soc初始值,结束是获取,并修改状态)
|
}else{
|
||||||
XhpcChargeOrder xhpcChargeOrder = new XhpcChargeOrder();
|
return AjaxResult.error(UserTypeUtil.LOGIN_TYPE, "请重新登录");
|
||||||
xhpcChargeOrder.setChargingStationId(xhpcTerminal.getChargingStationId());
|
|
||||||
xhpcChargeOrder.setUserId(userId);
|
|
||||||
xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId());
|
|
||||||
xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber());
|
|
||||||
xhpcChargeOrder.setSerialNumber(orderNo);
|
|
||||||
xhpcChargeOrder.setSource(0);
|
|
||||||
xhpcChargeOrder.setStatus(-1);
|
|
||||||
if (xhpcChargingPileById != null && xhpcChargingPileById.get("power") != null) {
|
|
||||||
xhpcChargeOrder.setPower(xhpcChargingPileById.get("power").toString());
|
|
||||||
}
|
}
|
||||||
xhpcChargeOrder.setRateModelId(Long.valueOf(r1.getData().toString()));
|
|
||||||
if (type == 1) {
|
|
||||||
xhpcChargeOrder.setChargingMode("微信");
|
|
||||||
} else {
|
|
||||||
xhpcChargeOrder.setChargingMode("支付宝");
|
|
||||||
}
|
|
||||||
xhpcChargeOrder.setCreateTime(Calendar.getInstance().getTime());
|
|
||||||
xhpcChargeOrder.setType(40);
|
|
||||||
xhpcChargeOrderMapper.addXhpcChargeOrder(xhpcChargeOrder);
|
|
||||||
|
|
||||||
return AjaxResult.success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -30,6 +30,7 @@ public class UserDaoAspect {
|
|||||||
private static final String CREATE_TIME = "createTime";
|
private static final String CREATE_TIME = "createTime";
|
||||||
private static final String UPDATE_BY = "updateBy";
|
private static final String UPDATE_BY = "updateBy";
|
||||||
private static final String UPDATE_TIME = "updateTime";
|
private static final String UPDATE_TIME = "updateTime";
|
||||||
|
private static final String TENANT_ID = "tenantId";
|
||||||
|
|
||||||
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
@Pointcut("execution(* com.xhpc..*.update*(..))")
|
||||||
public void daoUpdate() {
|
public void daoUpdate() {
|
||||||
@ -118,6 +119,10 @@ public class UserDaoAspect {
|
|||||||
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
if (isProperty(arg, UPDATE_TIME) && StringUtils.isEmpty(BeanUtils.getProperty(arg, UPDATE_TIME))) {
|
||||||
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
BeanUtils.setProperty(arg, UPDATE_TIME, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isProperty(arg, TENANT_ID) && StringUtils.isEmpty(BeanUtils.getProperty(arg, TENANT_ID))) {
|
||||||
|
BeanUtils.setProperty(arg, TENANT_ID, date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.xhpc.user.controller;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
|
import com.xhpc.user.dto.MechanismDto;
|
||||||
|
import com.xhpc.user.service.IXhpcCommonService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公共的内
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 10:34
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/common")
|
||||||
|
public class XhpcCommonController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IXhpcCommonService xhpcCommonService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据手机号(账号),用户id和类型 获取用户信息
|
||||||
|
* @param phone
|
||||||
|
* @param userId
|
||||||
|
* @param userType
|
||||||
|
* @param SerialNumber 桩号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/getUser")
|
||||||
|
public AjaxResult getMechanism(String phone,Long userId,Integer userType,String serialNumber) {
|
||||||
|
|
||||||
|
if(phone !=null || "".equals(phone)){
|
||||||
|
if(!UserTypeUtil.COMMUNIT.equals(phone.substring(0,2)) && !UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||||
|
//C端用户
|
||||||
|
return AjaxResult.success(xhpcCommonService.getLandUser(phone,null,0,serialNumber));
|
||||||
|
}else if (UserTypeUtil.COMMUNIT.equals(phone.substring(0,2))){
|
||||||
|
//社区用户
|
||||||
|
return AjaxResult.success(xhpcCommonService.getLandUser(phone,null,2,serialNumber));
|
||||||
|
}else if (UserTypeUtil.CUSTOMERS.equals(phone.substring(0,2))){
|
||||||
|
//大客户用户
|
||||||
|
return AjaxResult.success(xhpcCommonService.getLandUser(phone,null,3,serialNumber));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return AjaxResult.success(xhpcCommonService.getLandUser(null,userId,userType,serialNumber));
|
||||||
|
}
|
||||||
|
return AjaxResult.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户信息
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.xhpc.user.domain;
|
|||||||
|
|
||||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@ -35,4 +36,37 @@ public class XhpcCommunityPersonnel extends BaseEntity {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有退款订单审核(0无 1有)
|
||||||
|
*/
|
||||||
|
private Integer isRefundApplication;
|
||||||
|
|
||||||
|
private Integer soc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
/**
|
||||||
|
* weixin_open_id
|
||||||
|
*/
|
||||||
|
@Length(max = 50, message = "openId不能超过50位")
|
||||||
|
private String weixinOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* alipay_open_id
|
||||||
|
*/
|
||||||
|
@Length(max = 50, message = "openId不能超过50位")
|
||||||
|
private String alipayOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信是否登录(0未登录 1已登录)
|
||||||
|
*/
|
||||||
|
private Integer weixinLogin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝是否登录(0未登录 1已登录)
|
||||||
|
*/
|
||||||
|
private Integer alipayLogin;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xhpc.user.domain;
|
|||||||
|
|
||||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@ -36,4 +37,36 @@ public class XhpcCustomersPersonnel extends BaseEntity {
|
|||||||
|
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有退款订单审核(0无 1有)
|
||||||
|
*/
|
||||||
|
private Integer isRefundApplication;
|
||||||
|
|
||||||
|
private Integer soc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像地址
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
/**
|
||||||
|
* weixin_open_id
|
||||||
|
*/
|
||||||
|
@Length(max = 50, message = "openId不能超过50位")
|
||||||
|
private String weixinOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* alipay_open_id
|
||||||
|
*/
|
||||||
|
@Length(max = 50, message = "openId不能超过50位")
|
||||||
|
private String alipayOpenId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信是否登录(0未登录 1已登录)
|
||||||
|
*/
|
||||||
|
private Integer weixinLogin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝是否登录(0未登录 1已登录)
|
||||||
|
*/
|
||||||
|
private Integer alipayLogin;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,4 +76,26 @@ public interface XhpcAppUserMapper {
|
|||||||
int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
int updateUserIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
||||||
|
|
||||||
int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
int updateCommunityIsRefund(@Param("userId")Long userId, @Param("isRefund")Integer isRefund);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录登录用户的最后一次数据
|
||||||
|
*/
|
||||||
|
int addUserLoginTime(@Param("appUserId")Long appUserId, @Param("account")String account, @Param("userType")Integer userType, @Param("openId")String openId,@Param("type")Integer type,@Param("status")Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改社区用户信息
|
||||||
|
*/
|
||||||
|
int updateCommunityPersonnel(@Param("appUserId")Long appUserId,@Param("weixinOpenId")String weixinOpenId, @Param("alipayOpenId")String alipayOpenId,@Param("weixinLogin")Integer weixinLogin, @Param("alipayLogin")Integer alipayLogin);
|
||||||
|
/**
|
||||||
|
* 修改B端大客户信息
|
||||||
|
*/
|
||||||
|
int updateCustomersPersonnel(@Param("appUserId")Long appUserId,@Param("weixinOpenId")String weixinOpenId, @Param("alipayOpenId")String alipayOpenId,@Param("weixinLogin")Integer weixinLogin, @Param("alipayLogin")Integer alipayLogin);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户最后一次登录信息
|
||||||
|
* @param type
|
||||||
|
* @param openid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Object> getUserLoginTime(@Param("type")Integer type,@Param("openid")String openid);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.xhpc.user.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 11:12
|
||||||
|
*/
|
||||||
|
public interface XhpcCommonMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getAppUser(@Param("phone") String phone,@Param("userId")Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社区端用户信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCommunityUser(@Param("phone") String phone,@Param("userId")Long userId,@Param("serialNumber")String serialNumber);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B端用户信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getCustomersUser(@Param("phone") String phone,@Param("userId")Long userId,@Param("serialNumber")String serialNumber);
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xhpc.user.service;
|
package com.xhpc.user.service;
|
||||||
|
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.user.domain.XhpcAppUser;
|
import com.xhpc.user.domain.XhpcAppUser;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -88,7 +89,7 @@ public interface IXhpcAppUserUserService {
|
|||||||
* @param
|
* @param
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public Map<String, Object> appInfo(HttpServletRequest request);
|
public AjaxResult appInfo(HttpServletRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注销账号
|
* 注销账号
|
||||||
|
|||||||
@ -0,0 +1,15 @@
|
|||||||
|
package com.xhpc.user.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 11:10
|
||||||
|
*/
|
||||||
|
public interface IXhpcCommonService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户手机号获取用户信息
|
||||||
|
*/
|
||||||
|
Map<String, Object> getLandUser(String phone,Long userId,Integer type,String serialNumber);
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.xhpc.user.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateField;
|
import cn.hutool.core.date.DateField;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.common.api.UserTypeService;
|
||||||
import com.xhpc.common.core.constant.HttpStatus;
|
import com.xhpc.common.core.constant.HttpStatus;
|
||||||
import com.xhpc.common.core.constant.StatusConstants;
|
import com.xhpc.common.core.constant.StatusConstants;
|
||||||
import com.xhpc.common.core.constant.UserConstants;
|
import com.xhpc.common.core.constant.UserConstants;
|
||||||
@ -9,8 +10,10 @@ import com.xhpc.common.core.domain.R;
|
|||||||
import com.xhpc.common.core.enums.UserStatus;
|
import com.xhpc.common.core.enums.UserStatus;
|
||||||
import com.xhpc.common.core.utils.SecurityUtils;
|
import com.xhpc.common.core.utils.SecurityUtils;
|
||||||
import com.xhpc.common.core.utils.StringUtils;
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.redis.service.RedisService;
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.common.security.service.TokenService;
|
import com.xhpc.common.security.service.TokenService;
|
||||||
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.system.api.domain.SysUser;
|
import com.xhpc.system.api.domain.SysUser;
|
||||||
import com.xhpc.system.api.model.LoginUser;
|
import com.xhpc.system.api.model.LoginUser;
|
||||||
import com.xhpc.user.aspect.LogUserUtils;
|
import com.xhpc.user.aspect.LogUserUtils;
|
||||||
@ -48,6 +51,9 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LogUserUtils logUserUtils;
|
private LogUserUtils logUserUtils;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserTypeService userTypeService;
|
||||||
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(XhpcAppUserServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(XhpcAppUserServiceImpl.class);
|
||||||
/**
|
/**
|
||||||
@ -123,6 +129,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
String phone = StringUtils.valueOf(map.get("phone"));
|
String phone = StringUtils.valueOf(map.get("phone"));
|
||||||
String type = StringUtils.valueOf(map.get("type"));
|
String type = StringUtils.valueOf(map.get("type"));
|
||||||
String openid = StringUtils.valueOf(map.get("openid"));
|
String openid = StringUtils.valueOf(map.get("openid"));
|
||||||
|
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||||
if (StringUtils.isEmpty(openid)) {
|
if (StringUtils.isEmpty(openid)) {
|
||||||
return R.fail(HttpStatus.NOT_NULL, "openid不能为空");
|
return R.fail(HttpStatus.NOT_NULL, "openid不能为空");
|
||||||
}
|
}
|
||||||
@ -161,7 +168,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
xhpcAppUser.setCreateTime(new Date());
|
xhpcAppUser.setCreateTime(new Date());
|
||||||
xhpcAppUserMapper.insert(xhpcAppUser);
|
xhpcAppUserMapper.insert(xhpcAppUser);
|
||||||
redisService.deleteObject("pvToken:"+phone);
|
redisService.deleteObject("pvToken:"+phone);
|
||||||
return appLogin(phone, type, openid);
|
return appLogin(phone, type, openid, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,11 +182,12 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
String code = StringUtils.valueOf(map.get("code"));
|
String code = StringUtils.valueOf(map.get("code"));
|
||||||
String phone = StringUtils.valueOf(map.get("phone"));
|
String phone = StringUtils.valueOf(map.get("phone"));
|
||||||
String type = StringUtils.valueOf(map.get("type"));
|
String type = StringUtils.valueOf(map.get("type"));
|
||||||
|
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||||
if("18123374652".equals(phone) && "123456".equals(code)){
|
if("18123374652".equals(phone) && "123456".equals(code)){
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
return appLogin(phone, "1", "ot6ul4nlSC5ZZOC4rTLS5hedFTGk");
|
return appLogin(phone, "1", "ot6ul4nlSC5ZZOC4rTLS5hedFTGk", tenantId);
|
||||||
}
|
}
|
||||||
return appLogin(phone, "2", "2088912814256712");
|
return appLogin(phone, "2", "2088912814256712", tenantId);
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(code)) {
|
if (StringUtils.isEmpty(code)) {
|
||||||
return R.fail(HttpStatus.NOT_NULL, "验证码不能为空");
|
return R.fail(HttpStatus.NOT_NULL, "验证码不能为空");
|
||||||
@ -192,14 +200,14 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
if (!code.equalsIgnoreCase(captcha)) {
|
if (!code.equalsIgnoreCase(captcha)) {
|
||||||
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
return R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||||
}
|
}
|
||||||
return appLogin(phone, type, openid);
|
return appLogin(phone, type, openid, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
public R<?> appLogin(String username, String type, String openid) {
|
public R<?> appLogin(String username, String type, String openid, String tenantId) {
|
||||||
// 用户名或密码为空 错误
|
// 用户名或密码为空 错误
|
||||||
if (StringUtils.isAnyBlank(username)) {
|
if (StringUtils.isAnyBlank(username)) {
|
||||||
return R.fail(HttpStatus.NOT_NULL, "用户必须填写");
|
return R.fail(HttpStatus.NOT_NULL, "用户必须填写");
|
||||||
@ -209,6 +217,50 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||||
return R.fail(HttpStatus.ERROR_STATUS, "用户名不在指定范围");
|
return R.fail(HttpStatus.ERROR_STATUS, "用户名不在指定范围");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//判断账号
|
||||||
|
String sub = username.substring(0, 2);
|
||||||
|
if (UserTypeUtil.COMMUNIT.equals(sub) || UserTypeUtil.CUSTOMERS.equals(sub)){
|
||||||
|
R user = userTypeService.getUser(username, null, null, null);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||||
|
LoginUser userInfo = new LoginUser();
|
||||||
|
SysUser sysUser = new SysUser();
|
||||||
|
sysUser.setUserName(username);
|
||||||
|
long appUserId = Long.parseLong(map.get("appUserId").toString());
|
||||||
|
sysUser.setUserId(appUserId);
|
||||||
|
userInfo.setSysUser(sysUser);
|
||||||
|
userInfo.setUsername(username);
|
||||||
|
userInfo.setOpenId(openid);
|
||||||
|
userInfo.setTenantId(map.get("tenantId").toString());
|
||||||
|
if(UserTypeUtil.COMMUNIT.equals(username.substring(0,2))){
|
||||||
|
userInfo.setUserType(UserTypeUtil.COMMUNIT_TYPE);
|
||||||
|
}else{
|
||||||
|
userInfo.setUserType(UserTypeUtil.CUSTOMERS_TYPE);
|
||||||
|
}
|
||||||
|
if(UserTypeUtil.COMMUNIT.equals(sub)){
|
||||||
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
|
xhpcAppUserMapper.updateCommunityPersonnel(appUserId,openid,null,UserConstants.LOGIN,null);
|
||||||
|
} else {
|
||||||
|
xhpcAppUserMapper.updateCommunityPersonnel(appUserId,null,openid,null,UserConstants.LOGIN);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
|
xhpcAppUserMapper.updateCustomersPersonnel(appUserId,openid,null,UserConstants.LOGIN,null);
|
||||||
|
} else {
|
||||||
|
xhpcAppUserMapper.updateCustomersPersonnel(appUserId,null,openid,null,UserConstants.LOGIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//添加最后一次登录数据
|
||||||
|
xhpcAppUserMapper.addUserLoginTime(appUserId,username,userInfo.getUserType(),openid,Integer.valueOf(type),null);
|
||||||
|
|
||||||
|
redisService.deleteObject("pvToken:" + username);
|
||||||
|
// 获取登录token
|
||||||
|
return R.ok(tokenService.createToken(userInfo));
|
||||||
|
}else{
|
||||||
|
return R.fail(HttpStatus.DATA_ERROR, "账号不正确,请重新输入");
|
||||||
|
}
|
||||||
|
}
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||||
if (StringUtils.isNull(user)) {
|
if (StringUtils.isNull(user)) {
|
||||||
@ -225,6 +277,7 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
xhpcAppUser.setAlipayOpenId(openid);
|
xhpcAppUser.setAlipayOpenId(openid);
|
||||||
xhpcAppUser.setAlipayLogin(1);
|
xhpcAppUser.setAlipayLogin(1);
|
||||||
}
|
}
|
||||||
|
xhpcAppUser.setTenantId(tenantId);
|
||||||
xhpcAppUserMapper.insert(xhpcAppUser);
|
xhpcAppUserMapper.insert(xhpcAppUser);
|
||||||
user = xhpcAppUserMapper.getAppUserByPhone(username);
|
user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
@ -236,6 +289,11 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
sysUser.setUserName(user.getPhone());
|
sysUser.setUserName(user.getPhone());
|
||||||
sysUser.setUserId(user.getAppUserId());
|
sysUser.setUserId(user.getAppUserId());
|
||||||
userInfo.setSysUser(sysUser);
|
userInfo.setSysUser(sysUser);
|
||||||
|
userInfo.setUserType(UserTypeUtil.USER_TYPE);
|
||||||
|
userInfo.setUsername(username);
|
||||||
|
userInfo.setOpenId(openid);
|
||||||
|
userInfo.setUserid(user.getAppUserId());
|
||||||
|
userInfo.setTenantId(tenantId);
|
||||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
|
||||||
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
|
return R.fail(HttpStatus.DATA_ERROR, "对不起,您的账号:" + username + " 已被删除");
|
||||||
}
|
}
|
||||||
@ -255,6 +313,9 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
}
|
}
|
||||||
xhpcAppUserMapper.update(user);
|
xhpcAppUserMapper.update(user);
|
||||||
redisService.deleteObject("pvToken:" + user.getPhone());
|
redisService.deleteObject("pvToken:" + user.getPhone());
|
||||||
|
|
||||||
|
//添加最后一次登录数据
|
||||||
|
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN);
|
||||||
// 获取登录token
|
// 获取登录token
|
||||||
return R.ok(tokenService.createToken(userInfo));
|
return R.ok(tokenService.createToken(userInfo));
|
||||||
}
|
}
|
||||||
@ -271,17 +332,43 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||||
if (StringUtils.isNotNull(loginUser)) {
|
if (StringUtils.isNotNull(loginUser)) {
|
||||||
String username = loginUser.getUsername();
|
String username = loginUser.getUsername();
|
||||||
|
Integer userType = loginUser.getUserType();
|
||||||
|
Long userid = loginUser.getUserid();
|
||||||
|
String openId = loginUser.getOpenId();
|
||||||
|
R user = userTypeService.getUser(null, userid, userType, null);
|
||||||
|
if(user !=null && user.getData() !=null){
|
||||||
|
if(UserTypeUtil.USER_TYPE==userType){
|
||||||
|
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||||
|
if (!StringUtils.isNull(appUser)) {
|
||||||
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
|
appUser.setWeixinLogin(UserConstants.NO_LOGIN);
|
||||||
|
} else {
|
||||||
|
appUser.setAlipayLogin(UserConstants.NO_LOGIN);
|
||||||
|
}
|
||||||
|
xhpcAppUserMapper.update(appUser);
|
||||||
|
//添加最后一次登录数据
|
||||||
|
xhpcAppUserMapper.addUserLoginTime(appUser.getAppUserId(),username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||||
|
}
|
||||||
|
}else if(UserTypeUtil.COMMUNIT_TYPE==userType){
|
||||||
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
|
xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,UserConstants.NO_LOGIN,null);
|
||||||
|
} else {
|
||||||
|
xhpcAppUserMapper.updateCommunityPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||||
|
}
|
||||||
|
//添加最后一次登录数据
|
||||||
|
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||||
|
}else if(UserTypeUtil.CUSTOMERS_TYPE==userType){
|
||||||
|
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||||
|
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,UserConstants.NO_LOGIN,null);
|
||||||
|
} else {
|
||||||
|
xhpcAppUserMapper.updateCustomersPersonnel(userid,null,null,null,UserConstants.NO_LOGIN);
|
||||||
|
}
|
||||||
|
//添加最后一次登录数据
|
||||||
|
xhpcAppUserMapper.addUserLoginTime(userid,username,userType,openId,Integer.valueOf(type),UserConstants.NO_LOGIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除用户缓存记录
|
// 删除用户缓存记录
|
||||||
tokenService.delLoginUser(loginUser.getToken());
|
tokenService.delLoginUser(loginUser.getToken());
|
||||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
|
||||||
if (!StringUtils.isNull(user)) {
|
|
||||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
|
||||||
user.setWeixinLogin(UserConstants.NO_LOGIN);
|
|
||||||
} else {
|
|
||||||
user.setAlipayLogin(UserConstants.NO_LOGIN);
|
|
||||||
}
|
|
||||||
xhpcAppUserMapper.update(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
@ -296,39 +383,56 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
|
|||||||
public R<?> voluntaryLogin(Map<String, Object> map) {
|
public R<?> voluntaryLogin(Map<String, Object> map) {
|
||||||
String type = StringUtils.valueOf(map.get("type"));
|
String type = StringUtils.valueOf(map.get("type"));
|
||||||
String openid = StringUtils.valueOf(map.get("openid"));
|
String openid = StringUtils.valueOf(map.get("openid"));
|
||||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByOpenid(openid);
|
String tenantId = StringUtils.valueOf(map.get("tenantId"));
|
||||||
if (StringUtils.isNull(user)) {
|
Map<String, Object> userLoginTime = xhpcAppUserMapper.getUserLoginTime(Integer.valueOf(type), openid);
|
||||||
return R.fail(HttpStatus.DATA_ERROR, "用户不存在");
|
if(userLoginTime ==null){
|
||||||
|
return R.fail(HttpStatus.USER_LOGIN, "请重新登录");
|
||||||
}
|
}
|
||||||
if (StatusConstants.OPERATION_ALI_PAY_TYPE.equals(type)) {
|
if(UserConstants.NO_LOGIN.equals(userLoginTime.get("status").toString())){
|
||||||
if (UserConstants.NO_LOGIN == user.getAlipayLogin()) {
|
return R.fail(HttpStatus.USER_LOGIN, "请重新登录");
|
||||||
return R.fail(HttpStatus.USER_LOGIN, "用户未登录");
|
|
||||||
}
|
|
||||||
} else if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
|
||||||
if (UserConstants.NO_LOGIN == user.getWeixinLogin()) {
|
|
||||||
return R.fail(HttpStatus.USER_LOGIN, "用户未登录");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return appLogin(user.getPhone(), type, openid);
|
return appLogin(userLoginTime.get("account").toString(), type, openid, tenantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序用户详情
|
* 小程序用户详情
|
||||||
*
|
|
||||||
* @param
|
* @param
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> appInfo(HttpServletRequest request) {
|
public AjaxResult appInfo(HttpServletRequest request) {
|
||||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||||
String userId = StringUtils.valueOf(loginUser.getUserid());
|
|
||||||
Object version = redisService.getCacheObject("global:version");
|
Object version = redisService.getCacheObject("global:version");
|
||||||
Object servicePhone = redisService.getCacheObject("global:phone");
|
Object servicePhone = redisService.getCacheObject("global:phone");
|
||||||
//根据不同的用户类型查询不同的信息
|
//根据不同的用户类型查询不同的信息
|
||||||
Map<String,Object> result = xhpcAppUserMapper.info(Long.parseLong(userId));
|
Long userid = loginUser.getUserid();
|
||||||
result.put("version",version);
|
Integer userType = loginUser.getUserType();
|
||||||
result.put("servicePhone",servicePhone);
|
R user = userTypeService.getUser(null, loginUser.getUserid(), loginUser.getUserType(), null);
|
||||||
return result;
|
if(user !=null && user.getData() !=null){
|
||||||
|
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||||
|
//发票、留言板、版本、客服电话
|
||||||
|
Object invoice =null;
|
||||||
|
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||||
|
invoice = redisService.getCacheObject("global:invoice:" + UserTypeUtil.USER + userid);
|
||||||
|
}else if(UserTypeUtil.INTERNET_TYPE.equals(userType)){
|
||||||
|
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.INTERNET+userid);
|
||||||
|
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
||||||
|
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.COMMUNIT+userid);
|
||||||
|
}else{
|
||||||
|
invoice = redisService.getCacheObject("global:invoice:"+UserTypeUtil.CUSTOMERS+userid);
|
||||||
|
}
|
||||||
|
if(invoice==null){
|
||||||
|
map.put("invoiceNumber","0");
|
||||||
|
}else{
|
||||||
|
map.put("invoiceNumber",invoice);
|
||||||
|
}
|
||||||
|
map.put("guestbook","0");
|
||||||
|
map.put("version",version);
|
||||||
|
map.put("servicePhone",servicePhone);
|
||||||
|
return AjaxResult.success(map);
|
||||||
|
}else{
|
||||||
|
return AjaxResult.error("请重新登录");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.xhpc.user.service.impl;
|
||||||
|
|
||||||
|
import com.xhpc.user.mapper.XhpcCommonMapper;
|
||||||
|
import com.xhpc.user.service.IXhpcCommonService;
|
||||||
|
import org.checkerframework.checker.units.qual.A;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/12/29 11:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class XhpcCommonServiceImpl implements IXhpcCommonService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private XhpcCommonMapper xhpcCommonMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getLandUser(String phone,Long userId, Integer type,String serialNumber) {
|
||||||
|
if(type==0){
|
||||||
|
return xhpcCommonMapper.getAppUser(phone,userId);
|
||||||
|
}else if(type==2){
|
||||||
|
return xhpcCommonMapper.getCommunityUser(phone,userId,serialNumber);
|
||||||
|
}else if(type==3){
|
||||||
|
return xhpcCommonMapper.getCustomersUser(phone,userId,serialNumber);
|
||||||
|
}
|
||||||
|
return new HashMap<>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -228,4 +228,79 @@
|
|||||||
<update id="updateCommunityIsRefund">
|
<update id="updateCommunityIsRefund">
|
||||||
update xhpc_community_personnel set is_refund=#{isRefund} where community_personnel_id=#{userId}
|
update xhpc_community_personnel set is_refund=#{isRefund} where community_personnel_id=#{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<insert id="addUserLoginTime">
|
||||||
|
INSERT INTO xhpc_user_login
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != appUserId">
|
||||||
|
app_user_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != account and '' != account">
|
||||||
|
account,
|
||||||
|
</if>
|
||||||
|
<if test="null != userType ">
|
||||||
|
user_type,
|
||||||
|
</if>
|
||||||
|
<if test="null != openId and '' != openId">
|
||||||
|
open_id,
|
||||||
|
</if>
|
||||||
|
<if test="null != type">
|
||||||
|
type,
|
||||||
|
</if>
|
||||||
|
<if test="null != status">
|
||||||
|
status,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="null != appUserId">
|
||||||
|
#{appUserId},
|
||||||
|
</if>
|
||||||
|
<if test="null != account and '' != account">
|
||||||
|
#{account},
|
||||||
|
</if>
|
||||||
|
<if test="null != userType">
|
||||||
|
#{userType},
|
||||||
|
</if>
|
||||||
|
<if test="null != openId">
|
||||||
|
#{openId},
|
||||||
|
</if>
|
||||||
|
<if test="null != type">
|
||||||
|
#{type},
|
||||||
|
</if>
|
||||||
|
<if test="null != status">
|
||||||
|
#{status},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateCommunityPersonnel">
|
||||||
|
UPDATE xhpc_community_personnel
|
||||||
|
<set>
|
||||||
|
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
|
||||||
|
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
|
||||||
|
<if test="null != weixinLogin ">weixin_login = #{weixinLogin},</if>
|
||||||
|
<if test="null != alipayLogin ">alipay_login = #{alipayLogin},</if>
|
||||||
|
</set>
|
||||||
|
WHERE community_personnel_id = #{appUserId}
|
||||||
|
</update>
|
||||||
|
<update id="updateCustomersPersonnel">
|
||||||
|
UPDATE xhpc_customers_personnel
|
||||||
|
<set>
|
||||||
|
<if test="null != weixinOpenId and '' != weixinOpenId">weixin_open_id = #{weixinOpenId},</if>
|
||||||
|
<if test="null != alipayOpenId and '' != alipayOpenId">alipay_open_id = #{alipayOpenId},</if>
|
||||||
|
<if test="null != weixinLogin ">weixin_login = #{weixinLogin},</if>
|
||||||
|
<if test="null != alipayLogin ">alipay_login = #{alipayLogin},</if>
|
||||||
|
</set>
|
||||||
|
WHERE customers_personnel_id = #{appUserId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getUserLoginTime" resultType="map">
|
||||||
|
select
|
||||||
|
app_user_id as appUserId,
|
||||||
|
account as account,
|
||||||
|
user_type as userType,
|
||||||
|
open_id as openId,
|
||||||
|
status as status
|
||||||
|
from xhpc_user_login type=#{type} and open_id=#{openid}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -0,0 +1,100 @@
|
|||||||
|
<?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">
|
||||||
|
<!--suppress ALL -->
|
||||||
|
<mapper namespace="com.xhpc.user.mapper.XhpcCommonMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getAppUser" resultType="map">
|
||||||
|
select
|
||||||
|
app_user_id as appUserId,
|
||||||
|
phone as phone,
|
||||||
|
is_refund_application as isRefundApplication,
|
||||||
|
is_refund as isRefund,
|
||||||
|
soc as soc,
|
||||||
|
balance as balance,
|
||||||
|
avatar as avatar,
|
||||||
|
status,
|
||||||
|
weixin_open_id as weixinlogin,
|
||||||
|
alipay_open_id as alipayLogin,
|
||||||
|
weixin_login as weixinOpenId,
|
||||||
|
alipay_login as alipayLogin,
|
||||||
|
del_flag delFlag,
|
||||||
|
concat(0) as userType,
|
||||||
|
tenant_id tenantId,
|
||||||
|
create_time as createTime
|
||||||
|
from xhpc_app_user
|
||||||
|
where del_flag=0
|
||||||
|
<if test="phone !=null and phone !=''">
|
||||||
|
and phone =#{phone}
|
||||||
|
</if>
|
||||||
|
<if test="userId !=null">
|
||||||
|
and app_user_id =#{userId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCommunityUser" resultType="map">
|
||||||
|
select
|
||||||
|
community_personnel_id as appUserId,
|
||||||
|
account as account,
|
||||||
|
phone as phone,
|
||||||
|
is_refund_application as isRefundApplication,
|
||||||
|
is_refund as isRefund,
|
||||||
|
soc as soc,
|
||||||
|
surplus_money as balance,
|
||||||
|
avatar as avatar,
|
||||||
|
status,
|
||||||
|
weixin_open_id as weixinlogin,
|
||||||
|
alipay_open_id as alipayLogin,
|
||||||
|
weixin_login as weixinOpenId,
|
||||||
|
alipay_login as alipayLogin,
|
||||||
|
tenant_id tenantId,
|
||||||
|
del_flag delFlag,
|
||||||
|
concat(2) as userType,
|
||||||
|
<if test="serialNumber !=null and serialNumber !=''">
|
||||||
|
(select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||||
|
</if>
|
||||||
|
create_time as createTime
|
||||||
|
from xhpc_community_personnel
|
||||||
|
where del_flag=0
|
||||||
|
<if test="phone !=null and phone !=''">
|
||||||
|
and account =#{phone}
|
||||||
|
</if>
|
||||||
|
<if test="userId !=null">
|
||||||
|
and community_personnel_id =#{userId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCustomersUser" resultType="map">
|
||||||
|
select
|
||||||
|
customers_personnel_id as appUserId,
|
||||||
|
account as account,
|
||||||
|
phone as phone,
|
||||||
|
is_refund_application as isRefundApplication,
|
||||||
|
is_refund as isRefund,
|
||||||
|
soc as soc,
|
||||||
|
surplus_money as balance,
|
||||||
|
avatar as avatar,
|
||||||
|
status,
|
||||||
|
weixin_open_id as weixinlogin,
|
||||||
|
alipay_open_id as alipayLogin,
|
||||||
|
weixin_login as weixinOpenId,
|
||||||
|
alipay_login as alipayLogin,
|
||||||
|
del_flag delFlag,
|
||||||
|
tenant_id tenantId,
|
||||||
|
concat(3) as userType,
|
||||||
|
<if test="serialNumber !=null and serialNumber !=''">
|
||||||
|
(select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
|
||||||
|
</if>
|
||||||
|
create_time as createTime
|
||||||
|
from xhpc_customers_personnel
|
||||||
|
where del_flag=0
|
||||||
|
<if test="phone !=null and phone !=''">
|
||||||
|
and account =#{phone}
|
||||||
|
</if>
|
||||||
|
<if test="userId !=null">
|
||||||
|
and customers_personnel_id =#{userId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user