parent
e6be1497b2
commit
41626f6b09
@ -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,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,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…
Reference in new issue