|
@@ -7,9 +7,9 @@ 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 com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.google.common.collect.Lists;
|
|
|
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;
|
|
@@ -45,6 +45,7 @@ import static shop.alien.util.common.constant.Constant.*;
|
|
|
* @author ssk
|
|
|
* @since 2025-04-29
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationMapper, LifeUserViolation> implements LifeUserViolationService {
|
|
@@ -81,24 +82,31 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
|
|
|
|
|
|
@Override
|
|
|
public int reporting(LifeUserViolation lifeuserViolation) throws Exception {
|
|
|
- int result = lifeUserViolationMapper.insert(lifeuserViolation);
|
|
|
- if (result > 0) {
|
|
|
- if (lifeuserViolation.getReportContextType().equals("4") || lifeuserViolation.getReportContextType().equals("5")) {
|
|
|
- String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");
|
|
|
-
|
|
|
- LifeNotice lifeNotice = getLifeNotice(lifeuserViolation);
|
|
|
- lifeNoticeMapper.insert(lifeNotice);
|
|
|
-
|
|
|
- WebsocketVo websocketVo = new WebsocketVo();
|
|
|
- websocketVo.setSenderId("system");
|
|
|
- websocketVo.setReceiverId(phoneId);
|
|
|
- websocketVo.setCategory("notice");
|
|
|
- websocketVo.setNoticeType("1");
|
|
|
- websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
|
|
|
- webSocketProcess.sendMessage(phoneId, com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
|
|
|
+ try {
|
|
|
+ int result = lifeUserViolationMapper.insert(lifeuserViolation);
|
|
|
+ if (result > 0) {
|
|
|
+ if (lifeuserViolation.getReportContextType().equals("4") || lifeuserViolation.getReportContextType().equals("5")) {
|
|
|
+ String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");
|
|
|
+
|
|
|
+ LifeNotice lifeNotice = getLifeNotice(lifeuserViolation);
|
|
|
+ lifeNoticeMapper.insert(lifeNotice);
|
|
|
+
|
|
|
+ WebsocketVo websocketVo = new WebsocketVo();
|
|
|
+ websocketVo.setSenderId("system");
|
|
|
+ websocketVo.setReceiverId(phoneId);
|
|
|
+ websocketVo.setCategory("notice");
|
|
|
+ websocketVo.setNoticeType("1");
|
|
|
+ websocketVo.setIsRead(0);
|
|
|
+ websocketVo.setText(com.alibaba.fastjson2.JSONObject.from(lifeNotice).toJSONString());
|
|
|
+ webSocketProcess.sendMessage(phoneId, com.alibaba.fastjson2.JSONObject.from(websocketVo).toJSONString());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("LifeUserViolationServiceImpl_reporting Error Stack={}", e.getMessage());
|
|
|
+ throw new Exception(e);
|
|
|
}
|
|
|
- return result;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
private static LifeNotice getLifeNotice(LifeUserViolation lifeuserViolation) {
|