|
|
@@ -6,6 +6,7 @@ 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 org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
@@ -18,6 +19,7 @@ import shop.alien.entity.store.StoreCommentAppealLog;
|
|
|
import shop.alien.entity.store.StoreDictionary;
|
|
|
import shop.alien.entity.store.StoreImg;
|
|
|
import shop.alien.entity.store.excelVo.util.ExcelExporter;
|
|
|
+import shop.alien.entity.store.vo.StoreCommentAppealInfoVo;
|
|
|
import shop.alien.entity.store.vo.StoreCommentAppealVo;
|
|
|
import shop.alien.mapper.*;
|
|
|
import shop.alien.store.service.StoreCommentAppealService;
|
|
|
@@ -97,12 +99,15 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
* @return Integer(0 : 申诉成功, 1 : 申诉失败, 2 : 申诉已存在, 3 : 文本内容异常)
|
|
|
*/
|
|
|
@Override
|
|
|
- public Integer addAppeal(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
|
|
|
+ public StoreCommentAppealInfoVo addAppeal(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
|
|
|
+ StoreCommentAppealInfoVo storeCommentAppealInfoVo = new StoreCommentAppealInfoVo();
|
|
|
try {
|
|
|
Map<String, String> checkText = TextCheckUtil.check(appealReason);
|
|
|
- if (null == checkText || checkText.get("result").equals("1")) {
|
|
|
- return 3;
|
|
|
- }
|
|
|
+ // todo 暂时去掉校验,防止校验不通过
|
|
|
+// if (null == checkText || checkText.get("result").equals("1")) {
|
|
|
+// storeCommentAppealInfoVo.setResult(3);
|
|
|
+// return storeCommentAppealInfoVo;
|
|
|
+// }
|
|
|
List<String> fileNameSet = new ArrayList<>(multipartRequest.getMultiFileMap().keySet());
|
|
|
LambdaQueryWrapper<StoreCommentAppeal> wrapper = new LambdaQueryWrapper<>();
|
|
|
//待审批, 已通过
|
|
|
@@ -115,9 +120,9 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
.orderByDesc(StoreCommentAppeal::getCreatedTime)
|
|
|
.last("limit 1");
|
|
|
if (this.getOne(wrapper) != null) {
|
|
|
- return 2;
|
|
|
+ storeCommentAppealInfoVo.setResult(2);
|
|
|
+ return storeCommentAppealInfoVo;
|
|
|
}
|
|
|
- StoreCommentAppeal storeCommentAppeal = new StoreCommentAppeal();
|
|
|
StringBuilder imgId = new StringBuilder();
|
|
|
for (int i = 0; i < fileNameSet.size(); i++) {
|
|
|
MultipartFile multipartFile = multipartRequest.getFileMap().get(fileNameSet.get(i));
|
|
|
@@ -131,6 +136,7 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
imgId.append(storeImg.getId()).append(",");
|
|
|
}
|
|
|
}
|
|
|
+ StoreCommentAppeal storeCommentAppeal = new StoreCommentAppeal();
|
|
|
if (!imgId.toString().isEmpty()) {
|
|
|
storeCommentAppeal.setImgId(imgId.substring(0, imgId.length() - 1));
|
|
|
}
|
|
|
@@ -138,7 +144,11 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
storeCommentAppeal.setCommentId(commentId);
|
|
|
storeCommentAppeal.setAppealReason(appealReason);
|
|
|
storeCommentAppeal.setAppealStatus(0);
|
|
|
- boolean storeCommentAppealSave = this.save(storeCommentAppeal);
|
|
|
+
|
|
|
+ int insertResult = storeCommentAppealMapper.insert(storeCommentAppeal);
|
|
|
+ boolean storeCommentAppealSave = insertResult > 0;
|
|
|
+
|
|
|
+ BeanUtils.copyProperties(storeCommentAppeal, storeCommentAppealInfoVo);
|
|
|
//商家申诉
|
|
|
StoreCommentAppealLog storeCommentAppealLog = new StoreCommentAppealLog();
|
|
|
storeCommentAppealLog.setAppealId(storeCommentAppeal.getId());
|
|
|
@@ -153,10 +163,12 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
storeCommentAppealLogSystem.setDeleteFlag(0);
|
|
|
storeCommentAppealLogSystem.setCreatedTime(storeCommentAppeal.getCreatedTime());
|
|
|
boolean resultSystem = storeCommentAppealSave && storeCommentAppealLogMapper.insert(storeCommentAppealLogSystem) > 0;
|
|
|
- return result && resultSystem ? 0 : 1;
|
|
|
+ storeCommentAppealInfoVo.setResult(result && resultSystem ? 0 : 1);
|
|
|
} catch (Exception e) {
|
|
|
- return 1;
|
|
|
+ storeCommentAppealInfoVo.setResult(1);
|
|
|
+ return storeCommentAppealInfoVo;
|
|
|
}
|
|
|
+ return storeCommentAppealInfoVo;
|
|
|
}
|
|
|
|
|
|
/**
|