- xcx修改密码
- 访客二维码展示问题
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.dromara.property.controller.xcx;
|
package org.dromara.property.controller.xcx;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -39,6 +40,7 @@ import java.util.List;
|
|||||||
public class XResidentPersonController extends BaseController {
|
public class XResidentPersonController extends BaseController {
|
||||||
|
|
||||||
private final IResidentPersonService residentPersonService;
|
private final IResidentPersonService residentPersonService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登录员工信息
|
* 获取登录员工信息
|
||||||
*/
|
*/
|
||||||
@@ -98,6 +100,18 @@ public class XResidentPersonController extends BaseController {
|
|||||||
return toAjax(residentPersonService.updateByBo(bo));
|
return toAjax(residentPersonService.updateByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改登录密码
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/editPW")
|
||||||
|
@SaCheckPermission("xcx:person:edit")
|
||||||
|
public R<Void> editPassword(@RequestBody JSONObject jsonBo) {
|
||||||
|
String oldPassword = jsonBo.getStr("oldPassword");
|
||||||
|
String newPassword = jsonBo.getStr("newPassword");
|
||||||
|
return toAjax(residentPersonService.editPasswordByXcx(oldPassword, newPassword));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除入驻员工
|
* 删除入驻员工
|
||||||
*
|
*
|
||||||
|
@@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
|
import org.dromara.property.api.model.LoginResidentPerson;
|
||||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||||
import org.dromara.property.service.residentService.IResidentUnitService;
|
import org.dromara.property.service.residentService.IResidentUnitService;
|
||||||
import org.dromara.sis.api.RemoteSisAuthService;
|
import org.dromara.sis.api.RemoteSisAuthService;
|
||||||
@@ -301,4 +303,29 @@ public class ResidentPersonServiceImpl implements IResidentPersonService {
|
|||||||
List<ResidentPersonVo> list = baseMapper.selectVoList(lqw);
|
List<ResidentPersonVo> list = baseMapper.selectVoList(lqw);
|
||||||
return list.isEmpty() ? null : list.get(0);
|
return list.isEmpty() ? null : list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序修改密码
|
||||||
|
*
|
||||||
|
* @param oldPassword 旧密码
|
||||||
|
* @param newPassword 新密码
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean editPasswordByXcx(String oldPassword, String newPassword) {
|
||||||
|
LoginResidentPerson person = LoginHelper.getLoginResident();
|
||||||
|
Assert.notNull(person, "用户信息不存在");
|
||||||
|
|
||||||
|
assert person != null;
|
||||||
|
ResidentPersonVo vo = baseMapper.selectVoById(person.getUserId());
|
||||||
|
boolean flag = BCrypt.checkpw(oldPassword, vo.getPassword());
|
||||||
|
Assert.isTrue(flag, "原密码错误!");
|
||||||
|
|
||||||
|
LambdaUpdateWrapper<ResidentPerson> luw = new LambdaUpdateWrapper<>();
|
||||||
|
luw.eq(ResidentPerson::getId, person.getUserId())
|
||||||
|
.set(ResidentPerson::getPassword, BCrypt.hashpw(newPassword));
|
||||||
|
boolean update = baseMapper.update(luw) > 0;
|
||||||
|
Assert.isTrue(update, "修改密码失败!");
|
||||||
|
return update;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -97,4 +97,13 @@ public interface IResidentPersonService {
|
|||||||
* @param name 姓名
|
* @param name 姓名
|
||||||
*/
|
*/
|
||||||
ResidentPersonVo queryByUnitIdAndName(Long unitId, String name);
|
ResidentPersonVo queryByUnitIdAndName(Long unitId, String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序修改密码
|
||||||
|
*
|
||||||
|
* @param oldPassword 旧密码
|
||||||
|
* @param newPassword 新密码
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Boolean editPasswordByXcx(String oldPassword, String newPassword);
|
||||||
}
|
}
|
||||||
|
@@ -83,11 +83,10 @@ public class RemoteVisitorServiceImpl implements RemoteVisitorService {
|
|||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getQrCode(Long id) {
|
public Map<String, Object> getQrCode(Long id) {
|
||||||
try {
|
try {
|
||||||
ApiResp res = e8PlatformApi.getVisitorQrCode(List.of(id));
|
ApiResp<VisitorAddRes> res = e8PlatformApi.getVisitorQrCode(List.of(id));
|
||||||
Assert.notNull(res, "e8平台获取访客二维码失败");
|
Assert.isTrue(res.getSuccess(), res.getMessage());
|
||||||
return res.getCode() == 0
|
return res.getSuccess()
|
||||||
? Map.of("code", 200, "data",
|
? Map.of("code", 200, "data,", res.getResult().getQrCodeStr())
|
||||||
JSONUtil.toList(JSONUtil.toJsonStr(res.getResult()), VisitorAddRes.class).get(0).getQrCodeStr())
|
|
||||||
: Map.of("code", 500, "data", res.getMessage());
|
: Map.of("code", 500, "data", res.getMessage());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@@ -82,11 +82,11 @@ public class E8PlatformApiService implements E8PlatformApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new ApiResp<>(
|
return new ApiResp<>(
|
||||||
apiResp.getStr("message"),
|
apiResp.getStr("message"),
|
||||||
apiResp.getLong("sessionId"),
|
apiResp.getLong("sessionId"),
|
||||||
data,
|
data,
|
||||||
apiResp.getBool("success"),
|
apiResp.getBool("success"),
|
||||||
apiResp.getInt("code")
|
apiResp.getInt("code")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public class E8PlatformApiService implements E8PlatformApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSONObject apiResp = JSONUtil.parseObj(result);
|
JSONObject apiResp = JSONUtil.parseObj(result);
|
||||||
Map<String, Object> resultMap = JSONUtil.toBean(apiResp.getStr("result"), new TypeReference<Map<String, Object>>() {
|
Map<String, Object> resultMap = JSONUtil.toBean(apiResp.getStr("result"), new TypeReference<>() {
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
TableDataInfo<T> tableDataInfo = new TableDataInfo<>();
|
TableDataInfo<T> tableDataInfo = new TableDataInfo<>();
|
||||||
@@ -114,11 +114,11 @@ public class E8PlatformApiService implements E8PlatformApi {
|
|||||||
tableDataInfo.setMsg("查询成功");
|
tableDataInfo.setMsg("查询成功");
|
||||||
|
|
||||||
return new ApiResp<>(
|
return new ApiResp<>(
|
||||||
apiResp.getStr("message"),
|
apiResp.getStr("message"),
|
||||||
apiResp.getLong("sessionId"),
|
apiResp.getLong("sessionId"),
|
||||||
tableDataInfo,
|
tableDataInfo,
|
||||||
apiResp.getBool("success"),
|
apiResp.getBool("success"),
|
||||||
apiResp.getInt("code")
|
apiResp.getInt("code")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,6 +636,12 @@ public class E8PlatformApiService implements E8PlatformApi {
|
|||||||
|
|
||||||
// 执行客户创建API调用,并获取API响应对象
|
// 执行客户创建API调用,并获取API响应对象
|
||||||
String result = e8ApiUtil.doPost(params, VISITOR_QRCODE);
|
String result = e8ApiUtil.doPost(params, VISITOR_QRCODE);
|
||||||
return handleApiResponse(result, VisitorAddRes.class);
|
if (result == null) {
|
||||||
|
return new ApiResp<>("E8服务器内部错误", null, null, false, 500);
|
||||||
|
}
|
||||||
|
JSONObject apiResp = JSONUtil.parseObj(result);
|
||||||
|
List<VisitorAddRes> info = JSONUtil.toList(apiResp.getJSONArray("result"), VisitorAddRes.class);
|
||||||
|
VisitorAddRes res = info.isEmpty() ? null : info.get(0);
|
||||||
|
return new ApiResp<>(apiResp.getStr("message"), apiResp.getLong("sessionId"), res, apiResp.getBool("success"), apiResp.getInt("code"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user