|
|
@@ -114,7 +114,79 @@ public class StoreCommentAppealServiceImpl extends ServiceImpl<StoreCommentAppea
|
|
|
* @return Integer(0 : 申诉成功, 1 : 申诉失败, 2 : 申诉已存在, 3 : 文本内容异常)
|
|
|
*/
|
|
|
@Override
|
|
|
- public StoreCommentAppealInfoVo addAppeal(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
|
|
|
+ public Integer addAppeal(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
|
|
|
+ try {
|
|
|
+ Map<String, String> checkText = TextCheckUtil.check(appealReason);
|
|
|
+ if (null == checkText || checkText.get("result").equals("1")) {
|
|
|
+ return 3;
|
|
|
+ }
|
|
|
+ List<String> fileNameSet = new ArrayList<>(multipartRequest.getMultiFileMap().keySet());
|
|
|
+ LambdaQueryWrapper<StoreCommentAppeal> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ //待审批, 已通过
|
|
|
+ List<Integer> list = new ArrayList<>();
|
|
|
+ list.add(0);
|
|
|
+ list.add(2);
|
|
|
+ wrapper.eq(StoreCommentAppeal::getStoreId, storeId)
|
|
|
+ .eq(StoreCommentAppeal::getCommentId, commentId)
|
|
|
+ .in(StoreCommentAppeal::getAppealStatus, list)
|
|
|
+ .orderByDesc(StoreCommentAppeal::getCreatedTime)
|
|
|
+ .last("limit 1");
|
|
|
+ if (this.getOne(wrapper) != null) {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ StoreCommentAppeal storeCommentAppeal = new StoreCommentAppeal();
|
|
|
+ StringBuilder imgId = new StringBuilder();
|
|
|
+ for (int i = 0; i < fileNameSet.size(); i++) {
|
|
|
+ MultipartFile multipartFile = multipartRequest.getFileMap().get(fileNameSet.get(i));
|
|
|
+ if (null != multipartFile) {
|
|
|
+ StoreImg storeImg = new StoreImg();
|
|
|
+ storeImg.setStoreId(storeId);
|
|
|
+ storeImg.setImgType(9);
|
|
|
+ storeImg.setImgSort(i + 1);
|
|
|
+ storeImg.setImgUrl(fileUploadUtil.uploadOneFile(multipartFile));
|
|
|
+ storeImgMapper.insert(storeImg);
|
|
|
+ imgId.append(storeImg.getId()).append(",");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!imgId.toString().isEmpty()) {
|
|
|
+ storeCommentAppeal.setImgId(imgId.substring(0, imgId.length() - 1));
|
|
|
+ }
|
|
|
+ storeCommentAppeal.setStoreId(storeId);
|
|
|
+ storeCommentAppeal.setCommentId(commentId);
|
|
|
+ storeCommentAppeal.setAppealReason(appealReason);
|
|
|
+ storeCommentAppeal.setAppealStatus(0);
|
|
|
+ boolean storeCommentAppealSave = this.save(storeCommentAppeal);
|
|
|
+ //商家申诉
|
|
|
+ StoreCommentAppealLog storeCommentAppealLog = new StoreCommentAppealLog();
|
|
|
+ storeCommentAppealLog.setAppealId(storeCommentAppeal.getId());
|
|
|
+ storeCommentAppealLog.setProcessType(0);
|
|
|
+ storeCommentAppealLog.setDeleteFlag(0);
|
|
|
+ storeCommentAppealLog.setCreatedTime(storeCommentAppeal.getCreatedTime());
|
|
|
+ boolean result = storeCommentAppealSave && storeCommentAppealLogMapper.insert(storeCommentAppealLog) > 0;
|
|
|
+ //系统审核
|
|
|
+ StoreCommentAppealLog storeCommentAppealLogSystem = new StoreCommentAppealLog();
|
|
|
+ storeCommentAppealLogSystem.setAppealId(storeCommentAppeal.getId());
|
|
|
+ storeCommentAppealLogSystem.setProcessType(1);
|
|
|
+ storeCommentAppealLogSystem.setDeleteFlag(0);
|
|
|
+ storeCommentAppealLogSystem.setCreatedTime(storeCommentAppeal.getCreatedTime());
|
|
|
+ boolean resultSystem = storeCommentAppealSave && storeCommentAppealLogMapper.insert(storeCommentAppealLogSystem) > 0;
|
|
|
+ return result && resultSystem ? 0 : 1;
|
|
|
+ } catch (Exception e) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增申诉
|
|
|
+ *
|
|
|
+ * @param multipartRequest 文件
|
|
|
+ * @param storeId 门店id
|
|
|
+ * @param commentId 评论id
|
|
|
+ * @param appealReason 申诉原因
|
|
|
+ * @return Integer(0 : 申诉成功, 1 : 申诉失败, 2 : 申诉已存在, 3 : 文本内容异常)
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public StoreCommentAppealInfoVo addAppealNew(MultipartRequest multipartRequest, Integer storeId, Integer commentId, String appealReason) {
|
|
|
StoreCommentAppealInfoVo storeCommentAppealInfoVo = new StoreCommentAppealInfoVo();
|
|
|
try {
|
|
|
Map<String, String> checkText = TextCheckUtil.check(appealReason);
|