修改用户自动注册
This commit is contained in:
parent
7dbe72e9a9
commit
430cc48f8d
@ -391,9 +391,14 @@ public class XhpcPileOrderController extends BaseController {
|
||||
}
|
||||
}else{
|
||||
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
|
||||
if(pushOrder !=null){
|
||||
if(pushOrder.get("internetSerialNumber") !=null){
|
||||
xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
|
||||
}
|
||||
if(pushOrder.get("operatorId3rdpty") !=null){
|
||||
xhpcHistoryOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
|
||||
xhpcChargeOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
|
||||
}
|
||||
}
|
||||
}
|
||||
xhpcHistoryOrder.setType(1);
|
||||
//结算
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
<if test="serialNumber != null">
|
||||
serial_number,
|
||||
</if>
|
||||
<if test="internetSerialNumber != null">
|
||||
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
|
||||
internet_serial_number,
|
||||
</if>
|
||||
<if test="powerPriceTotal != null">
|
||||
@ -188,7 +188,7 @@
|
||||
<if test="meterValueStartEvcs != null">
|
||||
meter_value_start_evcs,
|
||||
</if>
|
||||
<if test="operatorId3rdptyEvcs != null">
|
||||
<if test="operatorId3rdptyEvcs != null and ''!=operatorId3rdptyEvcs">
|
||||
operator_id3rdpty_evcs,
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
@ -238,7 +238,7 @@
|
||||
<if test="serialNumber != null">
|
||||
#{serialNumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="internetSerialNumber != null">
|
||||
<if test="internetSerialNumber != null and ''!=internetSerialNumber">
|
||||
#{internetSerialNumber,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="powerPriceTotal != null">
|
||||
@ -340,7 +340,7 @@
|
||||
<if test="meterValueStartEvcs != null">
|
||||
#{meterValueStartEvcs,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="operatorId3rdptyEvcs != null">
|
||||
<if test="operatorId3rdptyEvcs != null and ''!=operatorId3rdptyEvcs">
|
||||
#{operatorId3rdptyEvcs,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
|
||||
@ -64,7 +64,7 @@ public interface XhpcAppUserMapper {
|
||||
* @param phone 手机号
|
||||
* @return 结果
|
||||
*/
|
||||
public XhpcAppUser getAppUserByPhone(@Param("phone") String phone);
|
||||
public XhpcAppUser getAppUserByPhone(@Param("phone") String phone,@Param("tenantId") String tenantId);
|
||||
|
||||
/**
|
||||
* openid查询C端用户信息
|
||||
|
||||
@ -146,7 +146,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
if (!code.equalsIgnoreCase(captcha)) {
|
||||
R.fail(HttpStatus.ERROR_STATUS, "验证码错误");
|
||||
}
|
||||
XhpcAppUser info = xhpcAppUserMapper.getAppUserByPhone(phone);
|
||||
XhpcAppUser info = xhpcAppUserMapper.getAppUserByPhone(phone,tenantId);
|
||||
if (StringUtils.isNotNull(info)) {
|
||||
//判断openid是否存在,不存在重新补充
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
@ -225,11 +225,10 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户名不在指定范围");
|
||||
}
|
||||
|
||||
R lognUser = userTypeService.getUser(username, null, null, null,tenantId);
|
||||
if(lognUser !=null && lognUser.getData() !=null){
|
||||
String sub = username.substring(0, 2);
|
||||
if (UserTypeUtil.COMMUNIT.equals(sub) || UserTypeUtil.CUSTOMERS.equals(sub)){
|
||||
R lognUser = userTypeService.getUser(username, null, null, null,tenantId);
|
||||
if(lognUser !=null && lognUser.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)lognUser.getData();
|
||||
LoginUser userInfo = new LoginUser();
|
||||
SysUser sysUser = new SysUser();
|
||||
@ -271,9 +270,12 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
redisService.deleteObject("pvToken:" + username);
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}else{
|
||||
return R.fail(HttpStatus.DATA_ERROR, "无此账号,请重新输入账号登录");
|
||||
}
|
||||
// 查询用户信息
|
||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
}
|
||||
//C端用户自动注册
|
||||
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username,tenantId);
|
||||
if (StringUtils.isNull(user)) {
|
||||
//注册
|
||||
XhpcAppUser xhpcAppUser = new XhpcAppUser();
|
||||
@ -290,7 +292,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
}
|
||||
xhpcAppUser.setTenantId(tenantId);
|
||||
xhpcAppUserMapper.insert(xhpcAppUser);
|
||||
user = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
user = xhpcAppUserMapper.getAppUserByPhone(username,tenantId);
|
||||
// 获取登录token
|
||||
//return R.ok(tokenService.createToken(userInfo));
|
||||
//return R.fail(HttpStatus.DATA_ERROR, "登录用户:" + username + " 不存在");
|
||||
@ -325,14 +327,11 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
}
|
||||
xhpcAppUserMapper.update(user);
|
||||
redisService.deleteObject("pvToken:" + user.getPhone());
|
||||
|
||||
//添加最后一次登录数据
|
||||
xhpcAppUserMapper.addUserLoginTime(user.getAppUserId(),username,userInfo.getUserType(),openid,Integer.valueOf(type),UserConstants.LOGIN,tenantId,new Date());
|
||||
// 获取登录token
|
||||
return R.ok(tokenService.createToken(userInfo));
|
||||
}else{
|
||||
return R.fail(HttpStatus.DATA_ERROR, "服务器繁忙,请稍后再试");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -354,7 +353,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
R user = userTypeService.getUser(null, userid, userType, null,tenantId);
|
||||
if(user !=null && user.getData() !=null){
|
||||
if(UserTypeUtil.USER_TYPE==userType){
|
||||
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(username);
|
||||
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(username,tenantId);
|
||||
if (!StringUtils.isNull(appUser)) {
|
||||
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
|
||||
appUser.setWeixinLogin(UserConstants.NO_LOGIN);
|
||||
@ -496,7 +495,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
Integer userType = loginUser.getUserType();
|
||||
String tenantId = loginUser.getTenantId();
|
||||
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||
XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone);
|
||||
XhpcAppUser xhpcAppUser = xhpcAppUserMapper.getAppUserByPhone(phone,tenantId);
|
||||
if (StringUtils.isNull(xhpcAppUser)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "用户不存在");
|
||||
}
|
||||
@ -541,7 +540,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
|
||||
if(user !=null && user.getData() !=null){
|
||||
Map<String, Object> map = (Map<String, Object>)user.getData();
|
||||
if(UserTypeUtil.USER_TYPE.equals(userType)){
|
||||
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(map.get("phone").toString());
|
||||
XhpcAppUser appUser = xhpcAppUserMapper.getAppUserByPhone(map.get("phone").toString(),loginUser.getTenantId());
|
||||
appUser.setSocProtect(socProtect);
|
||||
appUser.setSoc(soc);
|
||||
xhpcAppUserMapper.update(appUser);
|
||||
|
||||
@ -224,7 +224,7 @@
|
||||
<select id="getAppUserByPhone" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
|
||||
select *
|
||||
from xhpc_app_user
|
||||
WHERE del_flag = 0 and phone = #{phone} LIMIT 1
|
||||
WHERE del_flag = 0 and phone = #{phone} and tenant_id=#{tenantId} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getAppUserByOpenid" parameterType="java.lang.String" resultMap="XhpcAppUserResult">
|
||||
|
||||
@ -253,9 +253,12 @@
|
||||
xiu.internet_user_id internetUserId, xiu.`name`, xiu.phone, xiu.contact_name contactName,
|
||||
xiu.contact_phone contactPhone,xiu.create_time createTime,
|
||||
xiu.commission_type commissionType, xiu.commission_rate commissionRate,
|
||||
xiu.cooperation_start_time startTime , xiu.cooperation_end_time endTime,
|
||||
xiu.operator_id_evcs operatorIdEvcs,
|
||||
xiu.commission_type commissioType,
|
||||
xiu.latitude, xiu.`status`,su.user_id userId,
|
||||
CASE WHEN xiu.`status` = 0 THEN '正常' else '禁用' end statusName,
|
||||
CASE WHEN xiu.commission_type = 0 THEN '总金额提成' else '服务费提成' end commissionTypeName
|
||||
CASE WHEN xiu.commission_type = 0 THEN '总金额提成' WHEN xiu.commission_type = 1 THEN '服务费提成' else '电量提成' end commissionTypeName
|
||||
from xhpc_internet_user xiu
|
||||
LEFT JOIN sys_user su on su.internet_user_id = xiu.internet_user_id
|
||||
WHERE xiu.del_flag = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user