意见反馈

pull/1/head
wqy 2 years ago
parent e6be1497b2
commit 41626f6b09

@ -3,16 +3,22 @@ package com.cyl.h5.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyl.manager.ums.domain.Address;
import com.cyl.manager.ums.domain.Feedback;
import com.cyl.manager.ums.mapper.AddressMapper;
import com.cyl.manager.ums.pojo.dto.AddressDTO;
import com.cyl.manager.ums.service.FeedbackService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisService;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.OssUtils;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
import java.util.stream.Collectors;
@ -27,6 +33,15 @@ public class H5CommonController {
private AddressMapper addressMapper;
@Autowired
private RedisService redisService;
@Autowired
private FeedbackService feedbackService;
@ApiOperation("新增意见反馈")
@Log(title = "意见反馈", businessType = BusinessType.INSERT)
@PostMapping("/feedback/create")
public ResponseEntity<Integer> add(@RequestBody Feedback feedback) {
return ResponseEntity.ok(feedbackService.insert(feedback));
}
@GetMapping("/area")
@ -74,4 +89,11 @@ public class H5CommonController {
redisService.setAddressList(JSON.toJSONString(result));
return AjaxResult.success(result);
}
@PostMapping("/file/upload")
public AjaxResult uploadFile(MultipartFile file) {
String url = ossUtils.uploadOneFile(file);
return AjaxResult.successData(url);
}
}

@ -0,0 +1,78 @@
package com.cyl.manager.ums.controller;
import java.util.List;
import com.cyl.manager.ums.domain.Member;
import com.cyl.manager.ums.pojo.dto.ChangeMemberStatusDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.cyl.manager.ums.convert.FeedbackConvert;
import com.cyl.manager.ums.domain.Feedback;
import com.cyl.manager.ums.pojo.query.FeedbackQuery;
import com.cyl.manager.ums.service.FeedbackService;
import com.cyl.manager.ums.pojo.vo.FeedbackVO;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* Controller
*
* @author zcc
* @date 2024-02-26
*/
@Api(description ="意见反馈接口列表")
@RestController
@RequestMapping("/ums/feedback")
public class FeedbackController extends BaseController {
@Autowired
private FeedbackService service;
@Autowired
private FeedbackConvert convert;
@ApiOperation("查询意见反馈列表")
@PreAuthorize("@ss.hasPermi('ums:feedback:list')")
@PostMapping("/list")
public ResponseEntity<Page<Feedback>> list(@RequestBody FeedbackQuery query, Pageable page) {
List<Feedback> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@ApiOperation("修改意见反馈备注信息")
@Log(title = "意见反馈", businessType = BusinessType.UPDATE)
@PostMapping("/mark/update")
public ResponseEntity<Integer> editMark(@RequestBody Feedback feedback) {
return ResponseEntity.ok(service.updateMark(feedback));
}
@ApiOperation(("修改状态"))
@Log(title = "意见反馈", businessType = BusinessType.UPDATE)
@PostMapping("/handle/status/change")
public ResponseEntity<Integer> changeStatus(@RequestBody Feedback dto){
return ResponseEntity.ok(service.changeStatus(dto));
}
@ApiOperation("删除意见反馈")
@PreAuthorize("@ss.hasPermi('ums:feedback:remove')")
@Log(title = "意见反馈", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public ResponseEntity<Integer> remove(@PathVariable Long id) {
return ResponseEntity.ok(service.deleteById(id));
}
}

@ -0,0 +1,16 @@
package com.cyl.manager.ums.convert;
import org.mapstruct.Mapper;
import com.cyl.manager.ums.domain.Feedback;
import com.cyl.manager.ums.pojo.vo.FeedbackVO;
import java.util.List;
/**
* DO <=> DTO <=> VO / BO / Query
*
* @author zcc
*/
@Mapper(componentModel = "spring")
public interface FeedbackConvert {
List<FeedbackVO> dos2vos(List<Feedback> list);
}

@ -0,0 +1,57 @@
package com.cyl.manager.ums.domain;
import java.time.LocalDateTime;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* ums_feedback
*
* @author zcc
*/
@ApiModel(description="意见反馈对象")
@Data
@TableName("ums_feedback")
public class Feedback {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("类型")
@Excel(name = "类型")
private String type;
@ApiModelProperty("具体说明")
@Excel(name = "具体说明")
private String content;
@ApiModelProperty("图片")
@Excel(name = "图片")
private String images;
@ApiModelProperty("联系电话")
@Excel(name = "联系电话")
private String phone;
@ApiModelProperty("创建人")
private Long createBy;
@ApiModelProperty("创建时间")
private LocalDateTime createTime;
@ApiModelProperty("处理状态 0未处理 1已处理")
@Excel(name = "处理状态 0未处理 1已处理")
private Integer handleStatus;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("处理时间")
@Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime handleTime;
}

@ -0,0 +1,21 @@
package com.cyl.manager.ums.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.cyl.manager.ums.domain.Feedback;
/**
* Mapper
*
* @author zcc
*/
public interface FeedbackMapper extends BaseMapper<Feedback> {
/**
*
*
* @param feedback
* @return
*/
List<Feedback> selectByEntity(Feedback feedback);
}

@ -0,0 +1,38 @@
package com.cyl.manager.ums.pojo.query;
import java.time.LocalDateTime;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*
* @author zcc
*/
@ApiModel(description="意见反馈 查询 对象")
@Data
public class FeedbackQuery {
@ApiModelProperty("类型 精确匹配")
private String type;
@ApiModelProperty("具体说明 精确匹配")
private String content;
@ApiModelProperty("图片 精确匹配")
private String images;
@ApiModelProperty("联系电话 精确匹配")
private String phone;
@ApiModelProperty("处理状态 0未处理 1已处理 精确匹配")
private Integer handleStatus;
@ApiModelProperty("处理时间 精确匹配")
private LocalDateTime handleTime;
private String beginTime;
private String endTime;
}

@ -0,0 +1,42 @@
package com.cyl.manager.ums.pojo.vo;
import java.time.LocalDateTime;
import com.ruoyi.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
*
*
* @author zcc
*/
@Data
public class FeedbackVO {
/** ID */
private Long id;
/** 类型 */
@Excel(name = "类型")
private String type;
/** 具体说明 */
@Excel(name = "具体说明")
private String content;
/** 图片 */
@Excel(name = "图片")
private String images;
/** 联系电话 */
@Excel(name = "联系电话")
private String phone;
/** 创建人 */
private Long createBy;
/** 创建时间 */
private LocalDateTime createTime;
/** 处理状态 0未处理 1已处理 */
@Excel(name = "处理状态 0未处理 1已处理")
private Integer handleStatus;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 处理时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime handleTime;
}

@ -0,0 +1,132 @@
package com.cyl.manager.ums.service;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.cyl.h5.config.SecurityUtil;
import com.cyl.manager.ums.domain.Member;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.AesCryptoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.cyl.manager.ums.mapper.FeedbackMapper;
import com.cyl.manager.ums.domain.Feedback;
import com.cyl.manager.ums.pojo.query.FeedbackQuery;
/**
* Service
*
*
* @author zcc
*/
@Service
public class FeedbackService {
@Autowired
private FeedbackMapper feedbackMapper;
/**
*
*
* @param id
* @return
*/
public Feedback selectById(Long id) {
return feedbackMapper.selectById(id);
}
/**
*
*
* @param query
* @param page
* @return
*/
public List<Feedback> selectList(FeedbackQuery query, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
QueryWrapper<Feedback> qw = new QueryWrapper<>();
String type = query.getType();
if (!StringUtils.isEmpty(type)) {
qw.eq("type", type);
}
String content = query.getContent();
if (!StringUtils.isEmpty(content)) {
qw.eq("content", content);
}
String images = query.getImages();
if (!StringUtils.isEmpty(images)) {
qw.eq("images", images);
}
String phone = query.getPhone();
if (!StringUtils.isEmpty(phone)) {
qw.eq("phone", phone);
}
Integer handleStatus = query.getHandleStatus();
if (handleStatus != null) {
qw.eq("handle_status", handleStatus);
}
LocalDateTime handleTime = query.getHandleTime();
if (handleTime != null) {
qw.eq("handle_time", handleTime);
}
if (!StringUtils.isEmpty(query.getBeginTime()) && !StringUtils.isEmpty(query.getEndTime())){
qw.ge("create_time", query.getBeginTime());
qw.lt("create_time", query.getEndTime());
}
return feedbackMapper.selectList(qw);
}
/**
*
*
* @param feedback
* @return
*/
public int insert(Feedback feedback) {
feedback.setCreateTime(LocalDateTime.now());
feedback.setCreateBy(SecurityUtil.getLocalMember().getId());
feedback.setHandleStatus(0);
return feedbackMapper.insert(feedback);
}
/**
*
*
* @param feedback
* @return
*/
public int update(Feedback feedback) {
return feedbackMapper.updateById(feedback);
}
/**
*
*
* @param id
* @return
*/
public int deleteById(Long id) {
return feedbackMapper.deleteById(id);
}
public Integer updateMark(Feedback feedback) {
UpdateWrapper<Feedback> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("remark",feedback.getRemark())
.eq("id",feedback.getId());
return feedbackMapper.update(null,updateWrapper);
}
public Integer changeStatus(Feedback dto) {
UpdateWrapper<Feedback> wrapper = new UpdateWrapper<>();
wrapper.eq("id", dto.getId());
wrapper.set("handle_status", dto.getHandleStatus())
.set("handle_time",LocalDateTime.now());
return feedbackMapper.update(null, wrapper);
}
}

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cyl.manager.ums.mapper.FeedbackMapper">
<resultMap type="Feedback" id="FeedbackResult">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="content" column="content"/>
<result property="images" column="images"/>
<result property="phone" column="phone"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="handleStatus" column="handle_status"/>
<result property="remark" column="remark"/>
<result property="handleTime" column="handle_time"/>
</resultMap>
<sql id="selectFeedbackVo">
select id, type, content, images, phone, create_by, create_time, handle_status, remark, handle_time from ums_feedback
</sql>
<select id="selectByEntity" parameterType="Feedback" resultMap="FeedbackResult">
<include refid="selectFeedbackVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="handleStatus != null "> and handle_status = #{handleStatus}</if>
<if test="handleTime != null "> and handle_time = #{handleTime}</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save