|
@@ -0,0 +1,485 @@
|
|
|
|
|
+package shop.alien.lawyer.service.impl;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import shop.alien.entity.store.*;
|
|
|
|
|
+import shop.alien.entity.store.dto.LawyerUserViolationDto;
|
|
|
|
|
+import shop.alien.entity.store.vo.LawyerUserViolationVo;
|
|
|
|
|
+import shop.alien.entity.store.vo.WebSocketVo;
|
|
|
|
|
+import shop.alien.mapper.*;
|
|
|
|
|
+import shop.alien.lawyer.config.WebSocketProcess;
|
|
|
|
|
+import shop.alien.lawyer.service.LawyerUserViolationService;
|
|
|
|
|
+import shop.alien.lawyer.service.LawyerUserService;
|
|
|
|
|
+import shop.alien.util.ali.AliOSSUtil;
|
|
|
|
|
+import shop.alien.util.common.EnumUtil;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * <p>
|
|
|
|
|
+ * 律师用户举报 服务实现类
|
|
|
|
|
+ * </p>
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author system
|
|
|
|
|
+ * @since 2025-01-XX
|
|
|
|
|
+ */
|
|
|
|
|
+@Slf4j
|
|
|
|
|
+@Service
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+public class LawyerUserViolationServiceImpl extends ServiceImpl<LawyerUserViolationMapper, LawyerUserViolation> implements LawyerUserViolationService {
|
|
|
|
|
+
|
|
|
|
|
+ private final LawyerUserViolationMapper lawyerUserViolationMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final LawyerUserMapper lawyerUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final StoreUserMapper storeUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final LifeUserMapper lifeUserMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final LawyerUserService lawyerUserService;
|
|
|
|
|
+
|
|
|
|
|
+ private final LifeNoticeMapper lifeNoticeMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final WebSocketProcess webSocketProcess;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${spring.web.resources.excel-path}")
|
|
|
|
|
+ private String excelPath;
|
|
|
|
|
+
|
|
|
|
|
+ @Value("${spring.web.resources.excel-generate-path}")
|
|
|
|
|
+ private String excelGeneratePath;
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public int reporting(LawyerUserViolation lawyerUserViolation) throws Exception {
|
|
|
|
|
+ try {
|
|
|
|
|
+ int result = lawyerUserViolationMapper.insert(lawyerUserViolation);
|
|
|
|
|
+ if (result > 0) {
|
|
|
|
|
+ // 举报人消息
|
|
|
|
|
+ LifeNotice lifeNotice = getLifeNotice(lawyerUserViolation);
|
|
|
|
|
+ lifeNoticeMapper.insert(lifeNotice);
|
|
|
|
|
+ WebSocketVo websocketVo = new WebSocketVo();
|
|
|
|
|
+ websocketVo.setSenderId("system");
|
|
|
|
|
+ websocketVo.setReceiverId(lifeNotice.getReceiverId());
|
|
|
|
|
+ websocketVo.setCategory("notice");
|
|
|
|
|
+ websocketVo.setNoticeType("1");
|
|
|
|
|
+ websocketVo.setIsRead(0);
|
|
|
|
|
+ websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
|
|
|
|
|
+ webSocketProcess.sendMessage(lifeNotice.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
|
|
+
|
|
|
|
|
+ // 被举报人消息
|
|
|
|
|
+ if(StringUtils.isNotEmpty(lawyerUserViolation.getReportContextType()) && "6".contains(lawyerUserViolation.getReportContextType())){
|
|
|
|
|
+ LifeNotice lifeNoticeReported = getLifeReportedNotice(lawyerUserViolation);
|
|
|
|
|
+ if (lifeNoticeReported != null) {
|
|
|
|
|
+ lifeNoticeMapper.insert(lifeNoticeReported);
|
|
|
|
|
+ WebSocketVo websocketVoReported = new WebSocketVo();
|
|
|
|
|
+ websocketVoReported.setSenderId("system");
|
|
|
|
|
+ websocketVoReported.setReceiverId(lifeNoticeReported.getReceiverId());
|
|
|
|
|
+ websocketVoReported.setCategory("notice");
|
|
|
|
|
+ websocketVoReported.setNoticeType("1");
|
|
|
|
|
+ websocketVoReported.setIsRead(0);
|
|
|
|
|
+ websocketVoReported.setText(com.alibaba.fastjson2.JSONObject.from(lifeNoticeReported).toJSONString());
|
|
|
|
|
+ webSocketProcess.sendMessage(lifeNoticeReported.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVoReported).toJSONString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("LawyerUserViolationServiceImpl_reporting Error Stack={}", e.getMessage());
|
|
|
|
|
+ throw new Exception(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private LifeNotice getLifeNotice(LawyerUserViolation lawyerUserViolation) {
|
|
|
|
|
+ String phoneId = null;
|
|
|
|
|
+
|
|
|
|
|
+ LifeNotice lifeNotice = new LifeNotice();
|
|
|
|
|
+ lifeNotice.setSenderId("system");
|
|
|
|
|
+ lifeNotice.setBusinessId(lawyerUserViolation.getId());
|
|
|
|
|
+ lifeNotice.setTitle("举报通知");
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ String message = "平台已受理,感谢您的反馈!";
|
|
|
|
|
+
|
|
|
|
|
+ String reportContextType = lawyerUserViolation.getReportContextType();
|
|
|
|
|
+ String reportUserId = lawyerUserViolation.getReportingUserId();
|
|
|
|
|
+
|
|
|
|
|
+ if ("3".equals(lawyerUserViolation.getReportingUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = "lawyer_"+lawyerUser.getPhone();
|
|
|
|
|
+ } else if ("1".equals(lawyerUserViolation.getReportingUserType())) {
|
|
|
|
|
+ StoreUser storeUsers = storeUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = "store_"+storeUsers.getPhone();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUsers = lifeUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = "user_"+lifeUsers.getUserPhone();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ lifeNotice.setReceiverId(phoneId);
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reportContextType) && "6".contains(reportContextType)){
|
|
|
|
|
+ String violationType = StringUtils.isNotEmpty(lawyerUserViolation.getViolationType())?lawyerUserViolation.getViolationType():"13";
|
|
|
|
|
+ String violationText = EnumUtil.getStatusValue(Integer.parseInt(violationType));
|
|
|
|
|
+
|
|
|
|
|
+ String reportedUserName = "";
|
|
|
|
|
+ // 查询被举报用户信息
|
|
|
|
|
+ String reportedUserId = lawyerUserViolation.getReportedUserId();
|
|
|
|
|
+ if ("3".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(reportedUserId);
|
|
|
|
|
+ reportedUserName = lawyerUser.getName();
|
|
|
|
|
+ } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(reportedUserId);
|
|
|
|
|
+ reportedUserName = storeUser.getNickName();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(reportedUserId);
|
|
|
|
|
+ reportedUserName = lifeUser.getUserName();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ String storeDate = simpleDateFormat.format(new Date());
|
|
|
|
|
+ message = "您在" + storeDate + "举报用户" + reportedUserName + ",涉嫌"+violationText+",已提交至平台审核,1-3个工作日会将审核结果发送到您应用内的消息-通知中,请注意查收。";
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ jsonObject.put("title", "平台已受理");
|
|
|
|
|
+ jsonObject.put("message", message);
|
|
|
|
|
+ lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
|
|
+ lifeNotice.setNoticeType(1);
|
|
|
|
|
+ return lifeNotice;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private LifeNotice getLifeReportedNotice(LawyerUserViolation lawyerUserViolation) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ // 查询被举报用户信息
|
|
|
|
|
+ String reportUserId = lawyerUserViolation.getReportedUserId();
|
|
|
|
|
+ String phoneId = "";
|
|
|
|
|
+ LifeNotice lifeNotice = new LifeNotice();
|
|
|
|
|
+
|
|
|
|
|
+ if ("3".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = lawyerUser.getPhone();
|
|
|
|
|
+ lifeNotice.setReceiverId("lawyer_" + phoneId);
|
|
|
|
|
+ } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = storeUser.getPhone();
|
|
|
|
|
+ lifeNotice.setReceiverId("store_" + phoneId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(reportUserId);
|
|
|
|
|
+ phoneId = lifeUser.getUserPhone();
|
|
|
|
|
+ lifeNotice.setReceiverId("user_" + phoneId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isEmpty(phoneId)){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String violationText = EnumUtil.getStatusValue(Integer.parseInt(lawyerUserViolation.getViolationType()));
|
|
|
|
|
+
|
|
|
|
|
+ lifeNotice.setSenderId("system");
|
|
|
|
|
+ lifeNotice.setBusinessId(lawyerUserViolation.getId());
|
|
|
|
|
+ lifeNotice.setTitle("举报通知");
|
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
|
+ String message = "";
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ String storeDate = simpleDateFormat.format(new Date());
|
|
|
|
|
+ String reportContextType = lawyerUserViolation.getReportContextType();
|
|
|
|
|
+
|
|
|
|
|
+ if(StringUtils.isNotEmpty(reportContextType) && reportContextType.equals("1")){
|
|
|
|
|
+ message = "您在" + storeDate + "被举报涉嫌"+violationText+",平台将会进行核实。如确实存在违规行为,平台将禁用您的账号**天,到期后账号可恢复使用,应用内的环境需要我们共同维护。";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ jsonObject.put("message", message);
|
|
|
|
|
+ lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
|
|
+ lifeNotice.setNoticeType(1);
|
|
|
|
|
+ return lifeNotice;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, Object> reportListByUserId(String userId) {
|
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
|
|
+ LambdaUpdateWrapper<LawyerUserViolation> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
+ wrapper.eq(LawyerUserViolation::getReportingUserId, userId).orderByDesc(LawyerUserViolation::getCreatedTime);
|
|
|
|
|
+ List<LawyerUserViolation> lawyerUserViolations = lawyerUserViolationMapper.selectList(wrapper);
|
|
|
|
|
+ List<LawyerUserViolation> filteredViolations = lawyerUserViolations.stream().filter(violation -> !"0".equals(violation.getProcessingStatus())).collect(Collectors.toList());
|
|
|
|
|
+ List<LawyerUserViolationVo> lawyerUserViolationsVo = new ArrayList<>();
|
|
|
|
|
+ for (LawyerUserViolation violation : filteredViolations) {
|
|
|
|
|
+ LawyerUserViolationVo vo = new LawyerUserViolationVo();
|
|
|
|
|
+ BeanUtils.copyProperties(violation, vo);
|
|
|
|
|
+ lawyerUserViolationsVo.add(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+ lawyerUserViolationsVo.forEach(lawyerUserViolationVo -> {
|
|
|
|
|
+ lawyerUserViolationVo.setReportResultNotification("举报结果通知");
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!lawyerUserViolations.isEmpty()) {
|
|
|
|
|
+ resultMap.put("createTime", lawyerUserViolations.get(0).getCreatedTime());
|
|
|
|
|
+ resultMap.put("data", lawyerUserViolationsVo);
|
|
|
|
|
+ }
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Map<String, Object> reportListById(String id) {
|
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
|
|
+ LawyerUserViolationVo lawyerUserViolationVo = new LawyerUserViolationVo();
|
|
|
|
|
+ LawyerUserViolation lawyerUserViolation = lawyerUserViolationMapper.selectById(id);
|
|
|
|
|
+ //商户或者用户名称
|
|
|
|
|
+ String reportedUserName;
|
|
|
|
|
+ if ("3".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(lawyerUserViolation.getReportedUserId());
|
|
|
|
|
+ reportedUserName = lawyerUser.getName();
|
|
|
|
|
+ } else if ("1".equals(lawyerUserViolation.getReportedUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(lawyerUserViolation.getReportedUserId());
|
|
|
|
|
+ reportedUserName = storeUser.getName();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(lawyerUserViolation.getReportedUserId());
|
|
|
|
|
+ reportedUserName = lifeUser.getUserName();
|
|
|
|
|
+ }
|
|
|
|
|
+ resultMap.put("message", lawyerUserViolation.getProcessingStatus() != null ? lawyerUserViolation.getProcessingStatus() : "");
|
|
|
|
|
+ lawyerUserViolationVo.setReportObject(reportedUserName);
|
|
|
|
|
+ lawyerUserViolationVo.setViolationType(lawyerUserViolation.getViolationType());
|
|
|
|
|
+ lawyerUserViolationVo.setReportEvidenceImg(lawyerUserViolation.getReportEvidenceImg());
|
|
|
|
|
+ lawyerUserViolationVo.setCreatedTime(lawyerUserViolation.getCreatedTime());
|
|
|
|
|
+ resultMap.put("reportDetail", lawyerUserViolationVo);
|
|
|
|
|
+ LawyerUserViolationVo lawyerUserViolationVo2 = new LawyerUserViolationVo();
|
|
|
|
|
+ lawyerUserViolationVo2.setProcessingStatus(lawyerUserViolation.getProcessingStatus());
|
|
|
|
|
+ lawyerUserViolationVo2.setProcessingTime(lawyerUserViolation.getProcessingTime());
|
|
|
|
|
+ resultMap.put("processStatus", lawyerUserViolationVo);
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public IPage<LawyerUserViolationDto> getViolationPage(int page, int size, String nickName, String phone, String processingStatus) {
|
|
|
|
|
+ IPage<LawyerUserViolationVo> pageRequest = new Page<>(page, size);
|
|
|
|
|
+ QueryWrapper<LawyerUserViolationVo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 基础查询条件
|
|
|
|
|
+ queryWrapper.eq("luv.delete_flag", 0)
|
|
|
|
|
+ .in("luv.report_context_type", Arrays.asList("1", "2", "3"));
|
|
|
|
|
+
|
|
|
|
|
+ // 动态查询条件
|
|
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty(nickName), "ui.nick_name", nickName)
|
|
|
|
|
+ .like(StringUtils.isNotEmpty(phone), "ui.phone", phone);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isNotEmpty(processingStatus)) {
|
|
|
|
|
+ queryWrapper.eq("luv.processing_status", processingStatus);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ queryWrapper.orderByDesc("luv.updated_time");
|
|
|
|
|
+
|
|
|
|
|
+ IPage<LawyerUserViolationVo> resultPage = lawyerUserViolationMapper.getViolationPage(pageRequest, queryWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ return resultPage.convert(e -> {
|
|
|
|
|
+ LawyerUserViolationDto dto = new LawyerUserViolationDto();
|
|
|
|
|
+ BeanUtils.copyProperties(e, dto);
|
|
|
|
|
+
|
|
|
|
|
+ // 处理举报凭证图片
|
|
|
|
|
+ if (Objects.nonNull(e.getReportEvidenceImg())) {
|
|
|
|
|
+ List<String> imageList = Arrays.stream(e.getReportEvidenceImg().split(","))
|
|
|
|
|
+ .map(String::trim)
|
|
|
|
|
+ .filter(StringUtils::isNotEmpty)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+
|
|
|
|
|
+ if (!imageList.isEmpty()) {
|
|
|
|
|
+ dto.setImage(imageList.get(0));
|
|
|
|
|
+ dto.setImageList(imageList);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ dto.setNickname(e.getNickName());
|
|
|
|
|
+ return dto;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void approve(int id, String processingStatus, String reportResult) {
|
|
|
|
|
+ if(id==0 || StringUtils.isBlank(processingStatus)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ LawyerUserViolation v = lawyerUserViolationMapper.selectById(id);
|
|
|
|
|
+ v.setProcessingStatus(processingStatus);
|
|
|
|
|
+ v.setProcessingTime(new Date());
|
|
|
|
|
+ v.setReportResult(reportResult);
|
|
|
|
|
+
|
|
|
|
|
+ // 举报时间
|
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
+ String violationTime = simpleDateFormat.format(v.getCreatedTime());
|
|
|
|
|
+ // 被举报人信息
|
|
|
|
|
+ String reportedUserName = "";
|
|
|
|
|
+ if(StringUtils.isNotEmpty(v.getReportedUserId())){
|
|
|
|
|
+ if ("3".equals(v.getReportedUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserMapper.selectById(v.getReportedUserId());
|
|
|
|
|
+ if(lawyerUser != null){
|
|
|
|
|
+ reportedUserName = lawyerUser.getName();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ("1".equals(v.getReportedUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(v.getReportedUserId());
|
|
|
|
|
+ if(storeUser != null){
|
|
|
|
|
+ reportedUserName = storeUser.getNickName();
|
|
|
|
|
+ }
|
|
|
|
|
+ } else{
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(v.getReportedUserId());
|
|
|
|
|
+ if(lifeUser != null) {
|
|
|
|
|
+ reportedUserName = lifeUser.getUserName();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 举报通知信息
|
|
|
|
|
+ String message = "";
|
|
|
|
|
+ String title = "";
|
|
|
|
|
+ if (processingStatus.equals("1")) {
|
|
|
|
|
+ // 通过
|
|
|
|
|
+ if (v.getReportContextType().equals("1")) {
|
|
|
|
|
+ // 用户
|
|
|
|
|
+ message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,确实存在违规行为,平台已将用户禁用,感谢您为此做出的贡献。";
|
|
|
|
|
+ title = "用户举报成功通知";
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 驳回
|
|
|
|
|
+ switch (v.getReportContextType()) {
|
|
|
|
|
+ case "1":
|
|
|
|
|
+ message = "您在"+violationTime+"举报用户"+reportedUserName+",涉嫌违法违规,经核实,不存在违规行为,感谢您为此做出的贡献。";
|
|
|
|
|
+ title = "用户举报失败通知";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ lawyerUserViolationMapper.updateById(v);
|
|
|
|
|
+ LifeNotice LifeMessage = new LifeNotice();
|
|
|
|
|
+ com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
|
|
+ jsonObject.put("message", message);
|
|
|
|
|
+ LifeMessage.setContext(jsonObject.toJSONString());
|
|
|
|
|
+ LifeMessage.setSenderId("system");
|
|
|
|
|
+ LifeMessage.setIsRead(0);
|
|
|
|
|
+ LifeMessage.setTitle(title);
|
|
|
|
|
+ LifeMessage.setNoticeType(1);
|
|
|
|
|
+ LifeMessage.setBusinessId(id);
|
|
|
|
|
+ if ("3".equals(v.getReportingUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserService.getById(v.getReportingUserId());
|
|
|
|
|
+ LifeMessage.setReceiverId("lawyer_" + lawyerUser.getPhone());
|
|
|
|
|
+ } else if ("1".equals(v.getReportingUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(v.getReportingUserId());
|
|
|
|
|
+ if (storeUser != null) {
|
|
|
|
|
+ LifeMessage.setReceiverId("store_" + storeUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(v.getReportingUserId());
|
|
|
|
|
+ if (lifeUser != null) {
|
|
|
|
|
+ LifeMessage.setReceiverId("user_" + lifeUser.getUserPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ lifeNoticeMapper.insert(LifeMessage);
|
|
|
|
|
+
|
|
|
|
|
+ WebSocketVo websocketVo = new WebSocketVo();
|
|
|
|
|
+ websocketVo.setSenderId("system");
|
|
|
|
|
+ websocketVo.setReceiverId(LifeMessage.getReceiverId());
|
|
|
|
|
+ websocketVo.setCategory("notice");
|
|
|
|
|
+ websocketVo.setNoticeType("1");
|
|
|
|
|
+ websocketVo.setIsRead(0);
|
|
|
|
|
+ websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(LifeMessage).toJSONString());
|
|
|
|
|
+ try {
|
|
|
|
|
+ webSocketProcess.sendMessage(LifeMessage.getReceiverId(), com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("LawyerUserViolationServiceImpl_approve Error Stack={}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public LawyerUserViolationDto byId(Integer id) {
|
|
|
|
|
+ LawyerUserViolation entity = lawyerUserViolationMapper.selectById(id);
|
|
|
|
|
+ if (entity == null) return null;
|
|
|
|
|
+ LawyerUserViolationDto dto = new LawyerUserViolationDto();
|
|
|
|
|
+ BeanUtils.copyProperties(entity, dto);
|
|
|
|
|
+ if (Objects.nonNull(entity.getReportEvidenceImg())) {
|
|
|
|
|
+ List<String> list = Arrays.stream(entity.getReportEvidenceImg().split(",")).map(String::trim).collect(Collectors.toList());
|
|
|
|
|
+ dto.setImageList(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 处理举报人信息
|
|
|
|
|
+ if ("3".equals(dto.getReportingUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserService.getById(dto.getReportingUserId());
|
|
|
|
|
+ if (lawyerUser != null) {
|
|
|
|
|
+ dto.setNickname(lawyerUser.getName());
|
|
|
|
|
+ dto.setPhone(lawyerUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ("1".equals(dto.getReportingUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(dto.getReportingUserId());
|
|
|
|
|
+ if (storeUser != null) {
|
|
|
|
|
+ dto.setNickname(storeUser.getNickName());
|
|
|
|
|
+ dto.setPhone(storeUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(dto.getReportingUserId());
|
|
|
|
|
+ if (lifeUser != null) {
|
|
|
|
|
+ dto.setNickname(lifeUser.getUserName());
|
|
|
|
|
+ dto.setPhone(lifeUser.getUserPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 处理被举报人信息
|
|
|
|
|
+ if ("lawyer".equals(dto.getReportedUserType())) {
|
|
|
|
|
+ LawyerUser lawyerUser = lawyerUserService.getById(dto.getReportedUserId());
|
|
|
|
|
+ if (lawyerUser != null) {
|
|
|
|
|
+ dto.setAccount(lawyerUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if ("1".equals(dto.getReportedUserType())) {
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectById(dto.getReportedUserId());
|
|
|
|
|
+ if (storeUser != null) {
|
|
|
|
|
+ dto.setAccount(storeUser.getPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LifeUser lifeUser = lifeUserMapper.selectById(dto.getReportedUserId());
|
|
|
|
|
+ if (lifeUser != null) {
|
|
|
|
|
+ dto.setAccount(lifeUser.getUserPhone());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return dto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public LawyerUserViolationDto byIdNotice(Integer id) {
|
|
|
|
|
+ LifeNotice lifeNotice = lifeNoticeMapper.selectById(id);
|
|
|
|
|
+ LawyerUserViolationDto dto = byId(lifeNotice.getBusinessId());
|
|
|
|
|
+ dto.setLifeNotice(lifeNotice.getContext());
|
|
|
|
|
+ return dto;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String exportExcel(String nickName, String phone, String processingStatus) throws IOException {
|
|
|
|
|
+ // Excel导出功能,可以根据需要实现
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String level(UserLoginInfo userLoginInfo) {
|
|
|
|
|
+ if (null == userLoginInfo) {
|
|
|
|
|
+ return "O";
|
|
|
|
|
+ }
|
|
|
|
|
+ String type = userLoginInfo.getType();
|
|
|
|
|
+ LambdaQueryWrapper<LawyerUserViolation> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(LawyerUserViolation::getReportContextType, "1").eq(LawyerUserViolation::getReportedUserId, userLoginInfo.getUserId());
|
|
|
|
|
+ if (Objects.equals(type, "lawyer")) {
|
|
|
|
|
+ wrapper.eq(LawyerUserViolation::getReportedUserType, "lawyer");
|
|
|
|
|
+ } else if (Objects.equals(type, "store")) {
|
|
|
|
|
+ wrapper.eq(LawyerUserViolation::getReportedUserType, "1");
|
|
|
|
|
+ } else if (Objects.equals(type, "user")) {
|
|
|
|
|
+ wrapper.eq(LawyerUserViolation::getReportedUserType, "2");
|
|
|
|
|
+ }
|
|
|
|
|
+ int count = Optional.ofNullable(lawyerUserViolationMapper.selectList(wrapper)).map(List::size).orElse(0);
|
|
|
|
|
+ if (count == 0) return "O";
|
|
|
|
|
+ if (count >= 15) return "E";
|
|
|
|
|
+ if (count >= 10) return "D";
|
|
|
|
|
+ if (count >= 6) return "C";
|
|
|
|
|
+ if (count >= 3) return "B";
|
|
|
|
|
+ return "A";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|