商品常见问题
This commit is contained in:
parent
3f6faedb48
commit
d54741be7f
@ -0,0 +1,85 @@
|
|||||||
|
package com.zbkj.admin.controller;
|
||||||
|
|
||||||
|
import com.zbkj.common.model.product.StoreProductProblem;
|
||||||
|
import com.zbkj.common.page.CommonPage;
|
||||||
|
import com.zbkj.common.request.PageParamRequest;
|
||||||
|
import com.zbkj.common.request.StoreProductProblemRequest;
|
||||||
|
import com.zbkj.common.response.CommonResult;
|
||||||
|
import com.zbkj.common.vo.StoreProductProblemVo;
|
||||||
|
import com.zbkj.service.service.StoreProductProblemService;
|
||||||
|
import com.zbkj.service.service.SystemAttachmentService;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("api/admin/problem/")
|
||||||
|
public class StoreProductProblemController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SystemAttachmentService systemAttachmentService;
|
||||||
|
@Autowired
|
||||||
|
private StoreProductProblemService storeProductProblemService;
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('admin:problem:list')")
|
||||||
|
@ApiOperation(value = "分页列表")
|
||||||
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
|
public CommonResult<CommonPage<StoreProductProblemVo>> getList(@Validated StoreProductProblemRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||||
|
return CommonResult.success(CommonPage.restPage(storeProductProblemService.getAdminList(request, pageParamRequest)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('admin:problem:save')")
|
||||||
|
@ApiOperation(value = "新增")
|
||||||
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||||
|
public CommonResult<String> save(@RequestBody @Validated StoreProductProblemRequest request) {
|
||||||
|
StoreProductProblem spp = new StoreProductProblem();
|
||||||
|
BeanUtils.copyProperties(request, spp);
|
||||||
|
spp.setContent(systemAttachmentService.clearPrefix(spp.getContent()));
|
||||||
|
if (storeProductProblemService.save(spp)) {
|
||||||
|
return CommonResult.success();
|
||||||
|
} else {
|
||||||
|
return CommonResult.failed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('admin:problem:delete')")
|
||||||
|
@ApiOperation(value = "删除")
|
||||||
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||||
|
public CommonResult<String> delete(@RequestParam(value = "ids") String ids) {
|
||||||
|
List<Integer> idList = Arrays.stream(ids.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
|
storeProductProblemService.removeByIds(idList);
|
||||||
|
return CommonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('admin:problem:update')")
|
||||||
|
@ApiOperation(value = "修改")
|
||||||
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||||
|
public CommonResult<String> update(@RequestBody StoreProductProblemRequest request) {
|
||||||
|
StoreProductProblem upd = new StoreProductProblem();
|
||||||
|
BeanUtils.copyProperties(request, upd);
|
||||||
|
upd.setContent(systemAttachmentService.clearPrefix(upd.getContent()));
|
||||||
|
if (storeProductProblemService.updateById(upd)) {
|
||||||
|
return CommonResult.success();
|
||||||
|
} else {
|
||||||
|
return CommonResult.failed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("hasAuthority('admin:problem:info')")
|
||||||
|
@ApiOperation(value = "详情")
|
||||||
|
@RequestMapping(value = "/info/{id}", method = RequestMethod.GET)
|
||||||
|
public CommonResult<StoreProductProblemVo> info(@PathVariable Integer id) {
|
||||||
|
StoreProductProblem spp = storeProductProblemService.getById(id);
|
||||||
|
StoreProductProblemVo vo = new StoreProductProblemVo();
|
||||||
|
BeanUtils.copyProperties(spp, vo);
|
||||||
|
return CommonResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.zbkj.common.request;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="StoreProductProblemRequest对象", description="StoreProductProblemRequest对象")
|
||||||
|
public class StoreProductProblemRequest implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 业务外键id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "商品id")
|
||||||
|
private String businessId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "问题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.zbkj.common.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="StoreProductProblemVo", description="StoreProductProblemVo")
|
||||||
|
public class StoreProductProblemVo implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 业务外键id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "商品id")
|
||||||
|
private String businessId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "问题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
}
|
@ -6,7 +6,9 @@ import com.zbkj.common.model.product.StoreProductProblem;
|
|||||||
import com.zbkj.common.page.CommonPage;
|
import com.zbkj.common.page.CommonPage;
|
||||||
import com.zbkj.common.request.CommitProblemRequest;
|
import com.zbkj.common.request.CommitProblemRequest;
|
||||||
import com.zbkj.common.request.PageParamRequest;
|
import com.zbkj.common.request.PageParamRequest;
|
||||||
|
import com.zbkj.common.request.StoreProductProblemRequest;
|
||||||
import com.zbkj.common.response.ProductProblemResponse;
|
import com.zbkj.common.response.ProductProblemResponse;
|
||||||
|
import com.zbkj.common.vo.StoreProductProblemVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -22,5 +24,7 @@ public interface StoreProductProblemService extends IService<StoreProductProblem
|
|||||||
|
|
||||||
Integer praiseProblem(Integer majorId);
|
Integer praiseProblem(Integer majorId);
|
||||||
|
|
||||||
|
List<StoreProductProblemVo> getAdminList(StoreProductProblemRequest request, PageParamRequest pageParamRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
package com.zbkj.service.service.impl;
|
package com.zbkj.service.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.util.StringUtil;
|
import com.github.pagehelper.util.StringUtil;
|
||||||
import com.zbkj.common.exception.CrmebException;
|
import com.zbkj.common.exception.CrmebException;
|
||||||
|
import com.zbkj.common.model.home.Home;
|
||||||
import com.zbkj.common.model.product.StoreProductProblem;
|
import com.zbkj.common.model.product.StoreProductProblem;
|
||||||
import com.zbkj.common.model.user.User;
|
import com.zbkj.common.model.user.User;
|
||||||
import com.zbkj.common.page.CommonPage;
|
import com.zbkj.common.page.CommonPage;
|
||||||
import com.zbkj.common.request.CommitProblemRequest;
|
import com.zbkj.common.request.CommitProblemRequest;
|
||||||
import com.zbkj.common.request.PageParamRequest;
|
import com.zbkj.common.request.PageParamRequest;
|
||||||
|
import com.zbkj.common.request.StoreProductProblemRequest;
|
||||||
import com.zbkj.common.response.ProductProblemResponse;
|
import com.zbkj.common.response.ProductProblemResponse;
|
||||||
import com.zbkj.common.utils.RedisUtil;
|
import com.zbkj.common.utils.RedisUtil;
|
||||||
|
import com.zbkj.common.vo.StoreProductProblemVo;
|
||||||
import com.zbkj.service.dao.StoreProductProblemDao;
|
import com.zbkj.service.dao.StoreProductProblemDao;
|
||||||
import com.zbkj.service.service.StoreProductProblemService;
|
import com.zbkj.service.service.StoreProductProblemService;
|
||||||
import com.zbkj.service.service.UserService;
|
import com.zbkj.service.service.UserService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -125,6 +131,31 @@ public class StoreProductProblemServiceImpl extends ServiceImpl<StoreProductProb
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoreProductProblemVo> getAdminList(StoreProductProblemRequest request, PageParamRequest pageParamRequest) {
|
||||||
|
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||||
|
LambdaQueryWrapper<StoreProductProblem> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||||
|
lambdaQueryWrapper.select();
|
||||||
|
if (StringUtils.isNotBlank(request.getTitle())) {
|
||||||
|
lambdaQueryWrapper.and(i -> i
|
||||||
|
.or().like(StoreProductProblem::getTitle, request.getTitle())
|
||||||
|
.or().like(StoreProductProblem::getContent, request.getContent()));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(request.getBusinessId())) {
|
||||||
|
lambdaQueryWrapper.eq(StoreProductProblem::getBusinessId, request.getBusinessId());
|
||||||
|
}
|
||||||
|
lambdaQueryWrapper.orderByDesc(StoreProductProblem::getId);
|
||||||
|
List<StoreProductProblem> list = dao.selectList(lambdaQueryWrapper);
|
||||||
|
return list.stream().map(i-> {
|
||||||
|
StoreProductProblemVo vo = new StoreProductProblemVo();
|
||||||
|
vo.setId(i.getId());
|
||||||
|
vo.setBusinessId(i.getBusinessId());
|
||||||
|
vo.setTitle(i.getTitle());
|
||||||
|
vo.setContent(i.getContent());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
private void recursionDel(List<Integer> ids) {
|
private void recursionDel(List<Integer> ids) {
|
||||||
if (ids.isEmpty()) { return; }
|
if (ids.isEmpty()) { return; }
|
||||||
LambdaQueryWrapper<StoreProductProblem> lq = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<StoreProductProblem> lq = new LambdaQueryWrapper<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user