diff --git a/ruoyi-mall/src/main/java/com/cyl/h5/controller/H5CommonController.java b/ruoyi-mall/src/main/java/com/cyl/h5/controller/H5CommonController.java index 24eb6e4..c07d08a 100644 --- a/ruoyi-mall/src/main/java/com/cyl/h5/controller/H5CommonController.java +++ b/ruoyi-mall/src/main/java/com/cyl/h5/controller/H5CommonController.java @@ -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 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); + } + } diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/controller/FeedbackController.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/controller/FeedbackController.java new file mode 100644 index 0000000..0bf9026 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/controller/FeedbackController.java @@ -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> list(@RequestBody FeedbackQuery query, Pageable page) { + List 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 editMark(@RequestBody Feedback feedback) { + return ResponseEntity.ok(service.updateMark(feedback)); + } + + @ApiOperation(("修改状态")) + @Log(title = "意见反馈", businessType = BusinessType.UPDATE) + @PostMapping("/handle/status/change") + public ResponseEntity 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 remove(@PathVariable Long id) { + return ResponseEntity.ok(service.deleteById(id)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/convert/FeedbackConvert.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/convert/FeedbackConvert.java new file mode 100644 index 0000000..1d6ea6b --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/convert/FeedbackConvert.java @@ -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 dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/domain/Feedback.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/domain/Feedback.java new file mode 100644 index 0000000..243e741 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/domain/Feedback.java @@ -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; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/mapper/FeedbackMapper.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/mapper/FeedbackMapper.java new file mode 100644 index 0000000..f158881 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/mapper/FeedbackMapper.java @@ -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 { + /** + * 查询意见反馈列表 + * + * @param feedback 意见反馈 + * @return 意见反馈集合 + */ + List selectByEntity(Feedback feedback); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/query/FeedbackQuery.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/query/FeedbackQuery.java new file mode 100644 index 0000000..e008435 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/query/FeedbackQuery.java @@ -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; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/vo/FeedbackVO.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/vo/FeedbackVO.java new file mode 100644 index 0000000..8572114 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/pojo/vo/FeedbackVO.java @@ -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; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/ums/service/FeedbackService.java b/ruoyi-mall/src/main/java/com/cyl/manager/ums/service/FeedbackService.java new file mode 100644 index 0000000..aee4c8c --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/ums/service/FeedbackService.java @@ -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 selectList(FeedbackQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper 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 updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("remark",feedback.getRemark()) + .eq("id",feedback.getId()); + return feedbackMapper.update(null,updateWrapper); + } + + public Integer changeStatus(Feedback dto) { + UpdateWrapper wrapper = new UpdateWrapper<>(); + wrapper.eq("id", dto.getId()); + wrapper.set("handle_status", dto.getHandleStatus()) + .set("handle_time",LocalDateTime.now()); + return feedbackMapper.update(null, wrapper); + } +} diff --git a/ruoyi-mall/src/main/resources/mapper/ums/FeedbackMapper.xml b/ruoyi-mall/src/main/resources/mapper/ums/FeedbackMapper.xml new file mode 100644 index 0000000..c83404f --- /dev/null +++ b/ruoyi-mall/src/main/resources/mapper/ums/FeedbackMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + select id, type, content, images, phone, create_by, create_time, handle_status, remark, handle_time from ums_feedback + + + +