zjy 3 сар өмнө
parent
commit
8e77189c18

+ 13 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeUserViolationServiceImpl.java

@@ -14,6 +14,7 @@ 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.second.SecondGoodsRecord;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.dto.LifeUserViolationDto;
 import shop.alien.entity.store.excelVo.LifeUserOrderExcelVo;
@@ -22,6 +23,7 @@ import shop.alien.entity.store.excelVo.util.ExcelGenerator;
 import shop.alien.entity.store.vo.LifeUserViolationVo;
 import shop.alien.entity.store.vo.WebSocketVo;
 import shop.alien.mapper.*;
+import shop.alien.mapper.second.SecondGoodsRecordMapper;
 import shop.alien.store.config.WebSocketProcess;
 import shop.alien.store.service.*;
 import shop.alien.store.util.FunctionMagic;
@@ -81,6 +83,8 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
 
     private final StoreCommentMapper storeCommentMapper;
 
+    private final SecondGoodsRecordMapper secondGoodsRecordMapper;
+
     @Value("${spring.web.resources.excel-path}")
     private String excelPath;
 
@@ -90,6 +94,15 @@ public class LifeUserViolationServiceImpl extends ServiceImpl<LifeUserViolationM
     @Override
     public int reporting(LifeUserViolation lifeuserViolation) throws Exception {
         try {
+            if ("4".equals(lifeuserViolation.getReportContextType())) {
+                LambdaQueryWrapper<SecondGoodsRecord> goodsWrapper = new LambdaQueryWrapper<>();
+                goodsWrapper.eq(SecondGoodsRecord::getGoodsId, lifeuserViolation.getBusinessId());
+                goodsWrapper.eq(SecondGoodsRecord::getGoodsStatus, "3");
+                goodsWrapper.orderByDesc(SecondGoodsRecord::getCreatedTime);
+                goodsWrapper.last(" limit 1 ");
+                SecondGoodsRecord goodsRecord = secondGoodsRecordMapper.selectOne(goodsWrapper);
+                if (null != goodsRecord) lifeuserViolation.setBusinessId(goodsRecord.getId());
+            }
             int result = lifeUserViolationMapper.insert(lifeuserViolation);
             if (result > 0) {
                     //String phoneId = Objects.requireNonNull(JwtUtil.getCurrentUserInfo()).getString("userType") + "_" + JwtUtil.getCurrentUserInfo().getString("phone");