Procházet zdrojové kódy

我的反馈接口

tags/V1.6.0
wanghaoran před 2 roky
rodič
revize
972c977f49
9 změnil soubory, kde provedl 236 přidání a 7 odebrání
  1. +1
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/controller/CityController.java
  2. +12
    -2
      tuoheng-api/src/main/java/com/tuoheng/api/controller/FeedbackController.java
  3. +7
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Feedback.java
  4. +10
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/request/FeedbackQuery.java
  5. +138
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/FeedbackInfoVo.java
  6. +2
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/service/ICityService.java
  7. +3
    -1
      tuoheng-api/src/main/java/com/tuoheng/api/service/IFeedbackService.java
  8. +2
    -2
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/CityServiceImpl.java
  9. +61
    -0
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java

+ 1
- 1
tuoheng-api/src/main/java/com/tuoheng/api/controller/CityController.java Zobrazit soubor

@@ -44,7 +44,7 @@ public class CityController extends BaseController {
* @return 行政区列表(树结构)
*/
@GetMapping("/queryCityList")
public List<City> queryCityList() {
public JsonResult queryCityList() {
return cityService.getCityList();
}


+ 12
- 2
tuoheng-api/src/main/java/com/tuoheng/api/controller/FeedbackController.java Zobrazit soubor

@@ -1,13 +1,12 @@
package com.tuoheng.api.controller;

import com.tuoheng.api.entity.domain.Feedback;
import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.api.service.IFeedbackService;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* 全名护河反馈表 前端控制器
@@ -32,4 +31,15 @@ public class FeedbackController {
return feedbackService.submit(feedback);
}

/**
* 我的反馈
*
* @param feedbackQuery 查询条件
* @return
*/
@GetMapping("/my")
public JsonResult my(FeedbackQuery feedbackQuery) {
return feedbackService.my(feedbackQuery);
}

}

+ 7
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/domain/Feedback.java Zobrazit soubor

@@ -1,5 +1,6 @@
package com.tuoheng.api.entity.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.common.BaseEntity;
@@ -114,5 +115,11 @@ public class Feedback extends BaseEntity {
*/
private Integer status;

/**
* 河道图片
*/
@TableField(exist = false)
private String streamImage;


}

+ 10
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/request/FeedbackQuery.java Zobrazit soubor

@@ -0,0 +1,10 @@
package com.tuoheng.api.entity.request;

import com.tuoheng.common.common.BaseQuery;
import lombok.Data;

@Data
public class FeedbackQuery extends BaseQuery {

private String openid;
}

+ 138
- 0
tuoheng-api/src/main/java/com/tuoheng/api/entity/vo/FeedbackInfoVo.java Zobrazit soubor

@@ -0,0 +1,138 @@
package com.tuoheng.api.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Data
public class FeedbackInfoVo {

/**
* 主键ID
*/
private Integer id;

/**
* 租户ID
*/
private Integer tenantId;

/**
* 提交人openid
*/
private String openid;

/**
* 河道ID
*/
private Integer streamId;

/**
* 河道名称
*/
private String streamName;

/**
* 责任河湖长ID
*/
private Integer streamAdminId;

/**
* 责任河湖长名称
*/
private String streamAdminName;

/**
* 经度
*/
private String longitude;

/**
* 纬度
*/
private String latitude;

/**
* 位置名称
*/
private String location;

/**
* 问题描述
*/
private String feedbackDesc;

/**
* 反馈人姓名
*/
private String feedbackName;

/**
* 反馈人手机号
*/
private String feedbackPhone;

/**
* 反馈图片地址 多张用,隔开
*/
private String feedbackUrl;

/**
* 处理图片地址 多张用,隔开
*/
private String handleUrl;

/**
* 处理意见
*/
private String handleRemark;

/**
* 处理时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date handleTime;

/**
* 审核意见
*/
private String examineRemark;

/**
* 状态:1待审核 2待处理 3已忽略 4已处理
*/
private Integer status;

/**
* 添加人
*/
private Integer createUser;

/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;

/**
* 更新人
*/
private Integer updateUser;

/**
* 更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;

/**
* 河道图片
*/
private String streamImage;

}

+ 2
- 1
tuoheng-api/src/main/java/com/tuoheng/api/service/ICityService.java Zobrazit soubor

@@ -3,6 +3,7 @@ package com.tuoheng.api.service;
import com.tuoheng.api.entity.domain.City;
import com.tuoheng.api.entity.vo.CityInfoVo;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.utils.JsonResult;

import java.util.List;

@@ -39,5 +40,5 @@ public interface ICityService extends IBaseService<City> {
*
* @return 行政区列表
*/
List<City> getCityList();
JsonResult getCityList();
}

+ 3
- 1
tuoheng-api/src/main/java/com/tuoheng/api/service/IFeedbackService.java Zobrazit soubor

@@ -1,8 +1,8 @@
package com.tuoheng.api.service;

import com.tuoheng.api.entity.domain.Feedback;
import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.common.common.IBaseService;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.utils.JsonResult;

/**
@@ -13,4 +13,6 @@ import com.tuoheng.common.utils.JsonResult;
*/
public interface IFeedbackService extends IBaseService<Feedback> {
JsonResult submit(Feedback feedback);

JsonResult my(FeedbackQuery feedbackQuery);
}

+ 2
- 2
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/CityServiceImpl.java Zobrazit soubor

@@ -35,7 +35,7 @@ public class CityServiceImpl extends BaseServiceImpl<CityMapper, City> implement
private CityMapper cityMapper;

@Override
public List<City> getCityList() {
public JsonResult getCityList() {
List<City> list = cityMapper.selectList(new LambdaQueryWrapper<City>()
.eq(City::getMark, 1));

@@ -45,7 +45,7 @@ public class CityServiceImpl extends BaseServiceImpl<CityMapper, City> implement
.peek(city -> city.setItemList(getChildren(city, list))).sorted(Comparator.comparingInt(city -> (city.getSort() == null ? 0 : city.getSort())))
.collect(Collectors.toList());

return result;
return JsonResult.success(result);
}

/**

+ 61
- 0
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/FeedbackServiceImpl.java Zobrazit soubor

@@ -1,17 +1,27 @@
package com.tuoheng.api.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.api.entity.domain.Feedback;
import com.tuoheng.api.entity.domain.Stream;
import com.tuoheng.api.entity.request.FeedbackQuery;
import com.tuoheng.api.mapper.FeedbackMapper;
import com.tuoheng.api.mapper.StreamMapper;
import com.tuoheng.api.service.IFeedbackService;
import com.tuoheng.common.common.BaseServiceImpl;
import com.tuoheng.common.common.OperationEnum;
import com.tuoheng.common.config.CommonConfig;
import com.tuoheng.common.utils.CommonUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.stream.Collectors;

/**
* 反馈表 服务实现类
*
@@ -45,4 +55,55 @@ public class FeedbackServiceImpl extends BaseServiceImpl<FeedbackMapper, Feedbac

return super.add(feedback);
}

@Override
public JsonResult my(FeedbackQuery query) {
if(null == query.getPage() || null == query.getLimit()){
return JsonResult.error("分页数据为空");
}
if(StringUtils.isEmpty(query.getOpenid())){
return JsonResult.error("openid为空");
}

// 获取分页数据
IPage<Feedback> page = new Page<>(query.getPage(), query.getLimit());
IPage<Feedback> pageData = feedbackMapper.selectPage(page, new LambdaQueryWrapper<Feedback>()
.eq(Feedback::getMark, 1)
.eq(Feedback::getOpenid, query.getOpenid())
.orderByDesc(Feedback::getCreateTime));
pageData.getRecords().stream().map(vo -> {
Stream stream = streamMapper.selectById(vo.getStreamId());
vo.setStreamImage(CommonUtils.getImageURL(stream.getImage()));

//反馈图片地址
if(StringUtils.isNotEmpty(vo.getFeedbackUrl())){
String[] feedbackUrls = vo.getFeedbackUrl().split(",");
if(StringUtils.isNotEmpty(feedbackUrls)){
for (int i = 0; i < feedbackUrls.length; i++) {
if(StringUtils.isNotEmpty(feedbackUrls[i])){
feedbackUrls[i] = CommonConfig.imageURL + feedbackUrls[i];
}
}
}
vo.setFeedbackUrl(StringUtils.join(feedbackUrls, ","));
}

//处理图片地址
if(StringUtils.isNotEmpty(vo.getHandleUrl())){
String[] handleUrls = vo.getHandleUrl().split(",");
if(StringUtils.isNotEmpty(handleUrls)){
for (int i = 0; i < handleUrls.length; i++) {
if(StringUtils.isNotEmpty(handleUrls[i])){
handleUrls[i] = CommonConfig.imageURL + handleUrls[i];
}
}
}
vo.setHandleUrl(StringUtils.join(handleUrls, ","));
}

return vo;
}
).collect(Collectors.toList());
return JsonResult.success(pageData);
}
}

Načítá se…
Zrušit
Uložit