|
@@ -16,6 +16,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
import shop.alien.entity.result.R;
|
|
import shop.alien.entity.result.R;
|
|
|
import shop.alien.entity.store.*;
|
|
import shop.alien.entity.store.*;
|
|
|
|
|
+import shop.alien.entity.store.dto.LawyerLogoutRequestDto;
|
|
|
import shop.alien.entity.store.dto.LawyerUserDto;
|
|
import shop.alien.entity.store.dto.LawyerUserDto;
|
|
|
import shop.alien.entity.store.excelVo.LawyerUserExcelVo;
|
|
import shop.alien.entity.store.excelVo.LawyerUserExcelVo;
|
|
|
import shop.alien.entity.store.vo.LawyerUserVo;
|
|
import shop.alien.entity.store.vo.LawyerUserVo;
|
|
@@ -47,6 +48,9 @@ import java.util.stream.Collectors;
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerUser> implements LawyerUserService {
|
|
public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerUser> implements LawyerUserService {
|
|
|
|
|
|
|
|
|
|
+ private static final String LOGOUT_REASON_OTHER = "其他";
|
|
|
|
|
+ private static final int LOGOUT_CONTENT_MAX_LENGTH = 300;
|
|
|
|
|
+
|
|
|
private final LawyerUserMapper lawyerUserMapper;
|
|
private final LawyerUserMapper lawyerUserMapper;
|
|
|
private final LawyerServiceAreaService lawyerServiceAreaService;
|
|
private final LawyerServiceAreaService lawyerServiceAreaService;
|
|
|
private final LawyerServiceAreaMapper lawyerServiceAreaMapper;
|
|
private final LawyerServiceAreaMapper lawyerServiceAreaMapper;
|
|
@@ -491,21 +495,39 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
|
|
|
* 4. 设置注销相关字段:注销标记、注销时间、状态等
|
|
* 4. 设置注销相关字段:注销标记、注销时间、状态等
|
|
|
* </p>
|
|
* </p>
|
|
|
*
|
|
*
|
|
|
- * @param id 律师ID
|
|
|
|
|
|
|
+ * @param request 注销请求(含律师ID、注销原因、注销内容)
|
|
|
* @return 注销结果,包含注销信息
|
|
* @return 注销结果,包含注销信息
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public R<Map<String, Object>> logOutLawyerUser(Integer id) {
|
|
|
|
|
- log.info("开始注销律师用户,律师ID={}", id);
|
|
|
|
|
|
|
+ public R<Map<String, Object>> logOutLawyerUser(LawyerLogoutRequestDto request) {
|
|
|
|
|
+ log.info("开始注销律师用户,request={}", request);
|
|
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
|
|
|
- // 参数校验
|
|
|
|
|
- if (id == null) {
|
|
|
|
|
|
|
+ if (request == null || request.getId() == null) {
|
|
|
log.warn("注销律师用户失败:律师ID为空");
|
|
log.warn("注销律师用户失败:律师ID为空");
|
|
|
return R.fail("律师ID不能为空");
|
|
return R.fail("律师ID不能为空");
|
|
|
}
|
|
}
|
|
|
|
|
+ Integer id = request.getId();
|
|
|
|
|
+
|
|
|
|
|
+ String logoutReason = request.getLogoutReason() == null ? null : request.getLogoutReason().trim();
|
|
|
|
|
+ if (!StringUtils.hasText(logoutReason)) {
|
|
|
|
|
+ log.warn("注销律师用户失败:注销原因为空,律师ID={}", id);
|
|
|
|
|
+ return R.fail("请选择注销原因");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String logoutContent = request.getLogoutContent() == null ? null : request.getLogoutContent().trim();
|
|
|
|
|
+ if (LOGOUT_REASON_OTHER.equals(logoutReason)) {
|
|
|
|
|
+ if (!StringUtils.hasText(logoutContent)) {
|
|
|
|
|
+ log.warn("注销律师用户失败:原因为其他时注销内容为空,律师ID={}", id);
|
|
|
|
|
+ return R.fail("请填写注销内容");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (logoutContent.length() > LOGOUT_CONTENT_MAX_LENGTH) {
|
|
|
|
|
+ log.warn("注销律师用户失败:注销内容超过{}字,律师ID={}", LOGOUT_CONTENT_MAX_LENGTH, id);
|
|
|
|
|
+ return R.fail("注销内容不能超过300字");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 查询律师信息
|
|
// 查询律师信息
|
|
|
LawyerUser lawyerUser = this.getById(id);
|
|
LawyerUser lawyerUser = this.getById(id);
|
|
@@ -549,8 +571,10 @@ public class LawyerUserServiceImpl extends ServiceImpl<LawyerUserMapper, LawyerU
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list) && lawyerUser.getOrderReceivingStatus() == 0) {
|
|
if (CollectionUtils.isEmpty(list) && lawyerUser.getOrderReceivingStatus() == 0) {
|
|
|
// 设置注销相关字段
|
|
// 设置注销相关字段
|
|
|
- lawyerUser.setLogoutFlag(1); // 注销标记:1-已注销
|
|
|
|
|
|
|
+ lawyerUser.setLogoutFlag(2); // 注销标记:1-已注销
|
|
|
lawyerUser.setLogoutTime(new Date()); // 注销时间
|
|
lawyerUser.setLogoutTime(new Date()); // 注销时间
|
|
|
|
|
+ lawyerUser.setLogoutReason(logoutContent);
|
|
|
|
|
+ lawyerUser.setLogoutCode(logoutReason);
|
|
|
lawyerUser.setStatus(0); // 状态设置为禁用
|
|
lawyerUser.setStatus(0); // 状态设置为禁用
|
|
|
lawyerUser.setOrderReceivingStatus(0); // 接单状态设置为不接单
|
|
lawyerUser.setOrderReceivingStatus(0); // 接单状态设置为不接单
|
|
|
lawyerUser.setIsOnline(0); // 在线状态设置为离线
|
|
lawyerUser.setIsOnline(0); // 在线状态设置为离线
|