提交
This commit is contained in:
parent
d4890cdc42
commit
5580d056b3
@ -297,13 +297,16 @@ public class Constants {
|
||||
public static final String SEARCH_DATE_YEAR = "year"; //年
|
||||
public static final String SEARCH_DATE_PRE_YEAR = "preYear"; //上一年
|
||||
|
||||
//分类服务类型 类型,1 产品分类,2 附件分类,4 设置分类, 5 菜单分类,6 配置分类,11 套餐分类
|
||||
//分类服务类型 类型,1 产品分类,2 附件分类,4 设置分类, 5 菜单分类,6 配置分类,7 秒杀分类,8 套餐分类,9 帮助分类
|
||||
public static final int CATEGORY_TYPE_PRODUCT = 1; //产品
|
||||
public static final int CATEGORY_TYPE_ATTACHMENT = 2; //附件分类
|
||||
public static final int CATEGORY_TYPE_ARTICLE = 3; //文章分类
|
||||
public static final int CATEGORY_TYPE_SET = 4; //设置分类
|
||||
public static final int CATEGORY_TYPE_MENU = 5; //菜单分类
|
||||
public static final int CATEGORY_TYPE_CONFIG = 6; //配置分类
|
||||
public static final int CATEGORY_TYPE_SECKILL = 7; //秒杀分类
|
||||
public static final int CATEGORY_TYPE_SET_MEAL = 8; //套餐分类
|
||||
public static final int CATEGORY_TYPE_HELP = 9; //帮助分类
|
||||
|
||||
// 首页Banner图片
|
||||
public static final int INDEX_RECOMMEND_BANNER = 1; //是否精品 推荐Banner图片
|
||||
|
@ -31,7 +31,7 @@ public class Category implements Serializable {
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "类型ID | 类型,1 产品分类,2 附件分类,3 文章分类, 4 设置分类, 5 菜单分类, 6 配置分类, 7 秒杀配置,8 活动分类,9 游戏分类,10 文章分类 ")
|
||||
@ApiModelProperty(value = "类型ID | 1 产品分类,2 附件分类,4 设置分类, 5 菜单分类,6 配置分类,7 秒杀配置,8 套餐分类,9 帮助分类 ")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "地址")
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.zbkj.common.model.system;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 帮助问题
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("eb_system_help_problem")
|
||||
@ApiModel(value="SystemHelpProblem对象", description="SystemHelpProblem对象")
|
||||
public class SystemHelpProblem implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private String cid;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "简介")
|
||||
private String synopsis;
|
||||
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "跳转地址")
|
||||
private String jumpUrl;
|
||||
|
||||
@ApiModelProperty(value = "分享标题")
|
||||
private String shareTitle;
|
||||
|
||||
@ApiModelProperty(value = "分享简介")
|
||||
private String shareSynopsis;
|
||||
|
||||
@ApiModelProperty(value = "分享图片")
|
||||
private String shareImage;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "有用")
|
||||
private Integer usefulNum;
|
||||
|
||||
@ApiModelProperty(value = "无用")
|
||||
private Integer uselessNum;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date updateTime;
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
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 org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文章管理 Request
|
||||
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="HelpRequest对象", description="HelpRequest对象")
|
||||
public class HelpRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "分类id", required = true)
|
||||
@NotBlank(message = "请选择分类")
|
||||
private String cid;
|
||||
|
||||
@ApiModelProperty(value = "标题", required = true)
|
||||
@NotBlank(message = "请填写标题")
|
||||
@Length(max = 200, message = "标题最多200个字符")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "简介")
|
||||
@Length(max = 200, message = "简介最多200个字符")
|
||||
private String synopsis;
|
||||
|
||||
@ApiModelProperty(value = "内容", required = true)
|
||||
@NotBlank(message = "请填写内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "跳转地址")
|
||||
private String jumpUrl;
|
||||
|
||||
@ApiModelProperty(value = "分享标题")
|
||||
@Length(max = 200, message = "分享标题最多200个字符")
|
||||
private String shareTitle;
|
||||
|
||||
@ApiModelProperty(value = "分享简介")
|
||||
@Length(max = 200, message = "分享简介最多200个字符")
|
||||
private String shareSynopsis;
|
||||
|
||||
@ApiModelProperty(value = "分析图片")
|
||||
@Length(max = 255, message = "分析图片名称最多255个字符")
|
||||
private String shareImage;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private String sort;
|
||||
|
||||
@ApiModelProperty(value = "状态 0无效,1有效")
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.zbkj.common.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="HelpResponse对象", description="HelpResponse对象")
|
||||
public class HelpResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4585094537501770138L;
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private String cid;
|
||||
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String cName;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "简介")
|
||||
private String synopsis;
|
||||
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "跳转地址")
|
||||
private String jumpUrl;
|
||||
|
||||
@ApiModelProperty(value = "分享标题")
|
||||
private String shareTitle;
|
||||
|
||||
@ApiModelProperty(value = "分享简介")
|
||||
private String shareSynopsis;
|
||||
|
||||
@ApiModelProperty(value = "分享图片")
|
||||
private String shareImage;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "有用")
|
||||
private Integer usefulNum;
|
||||
|
||||
@ApiModelProperty(value = "无用")
|
||||
private Integer uselessNum;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -92,15 +92,15 @@ public class DeliveryUtil {
|
||||
long daysUntil = ChronoUnit.DAYS.between(today, targetDate);
|
||||
// 判断日期
|
||||
if (targetDate.isEqual(today)) {
|
||||
return "今天 " + md;
|
||||
return "今天 " + targetDate.format(md);
|
||||
} else if (targetDate.isAfter(today)) {
|
||||
switch ((int) daysUntil) {
|
||||
case 1:
|
||||
return "明天 " + md;
|
||||
return "明天 " + targetDate.format(md);
|
||||
case 2:
|
||||
return "后天 " + md;
|
||||
return "后天 " + targetDate.format(md);
|
||||
default:
|
||||
return "其他 " + md;
|
||||
return "其他 " + targetDate.format(md);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
@ -85,6 +85,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
excludePathPatterns("/api/front/setMeal/**").
|
||||
excludePathPatterns("/api/front/problem/*").
|
||||
excludePathPatterns("/api/front/problem/son/*").
|
||||
excludePathPatterns("/api/front/help/**").
|
||||
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.zbkj.front.controller;
|
||||
|
||||
import com.zbkj.common.model.system.SystemHelpProblem;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.response.CommonResult;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.common.response.HelpResponse;
|
||||
import com.zbkj.service.service.HelpService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController("HelpController")
|
||||
@RequestMapping("api/front/help")
|
||||
@Api(tags = "帮助与问题")
|
||||
public class HelpController {
|
||||
|
||||
@Autowired
|
||||
private HelpService helpService;
|
||||
|
||||
@ApiOperation(value = "分类列表")
|
||||
@RequestMapping(value = "/category/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<Category>> categoryList() {
|
||||
return CommonResult.success(CommonPage.restPage(helpService.getCategoryList()));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<HelpResponse>> getListArticle(@PathVariable(name="cid") String cid, @Validated PageParamRequest pageParamRequest) {
|
||||
List<SystemHelpProblem> list = helpService.getListHelp(cid, pageParamRequest);
|
||||
List<HelpResponse> responseList = list.stream().map(e -> {
|
||||
HelpResponse response = new HelpResponse();
|
||||
BeanUtils.copyProperties(e, response);
|
||||
return response;
|
||||
}).collect(Collectors.toList());
|
||||
return CommonResult.success(CommonPage.restPage(responseList));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="id")
|
||||
public CommonResult<HelpResponse> info(@RequestParam(value = "id") Integer id) {
|
||||
SystemHelpProblem detail = helpService.getDetail(id);
|
||||
HelpResponse response = new HelpResponse();
|
||||
BeanUtils.copyProperties(detail, response);
|
||||
return CommonResult.success(response);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "有用/无用")
|
||||
@RequestMapping(value = "/praise", method = RequestMethod.GET)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "id"),
|
||||
@ApiImplicitParam(name = "type", value = "类型:1已解决,2为解决", allowableValues = "range[1,2]")
|
||||
})
|
||||
public CommonResult<Boolean> praise(@RequestParam(value = "id") Integer id, @RequestParam(value = "type") Integer type) {
|
||||
if (helpService.feedback(id, type)) {
|
||||
return CommonResult.success();
|
||||
} else {
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,26 +19,26 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("ProblemController")
|
||||
@RequestMapping("api/front")
|
||||
@RequestMapping("api/front/problem")
|
||||
@Api(tags = "商品常见问题")
|
||||
public class ProblemController {
|
||||
|
||||
@Autowired private StoreProductProblemService storeProductProblemService;
|
||||
|
||||
@ApiOperation(value = "常见问题列表")
|
||||
@RequestMapping(value = "/problem/{productId}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{productId}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ProductProblemResponse>> getResponseList(@PathVariable Integer productId, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeProductProblemService.getResponseList(productId, pageParamRequest));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "常见问题列表-子回复列表")
|
||||
@RequestMapping(value = "/problem/son/{majorId}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/son/{majorId}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ProductProblemResponse>> getSonResponseList(@PathVariable Integer majorId, @Validated PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(storeProductProblemService.getSonResponseList(majorId, pageParamRequest));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "常见问题-提问/回复")
|
||||
@PostMapping("/problem/commit")
|
||||
@PostMapping("/commit")
|
||||
public CommonResult<Void> commitProblem(@RequestBody CommitProblemRequest request) {
|
||||
if (storeProductProblemService.commitProblem(request) > 0) {
|
||||
return CommonResult.success();
|
||||
@ -47,7 +47,7 @@ public class ProblemController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "常见问题-点赞/取消点赞")
|
||||
@RequestMapping(value = "/problem/praise/{majorId}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/praise/{majorId}", method = RequestMethod.GET)
|
||||
public CommonResult<Void> praise(@PathVariable Integer majorId) {
|
||||
if (storeProductProblemService.praiseProblem(majorId) > 0) {
|
||||
return CommonResult.success();
|
||||
@ -56,7 +56,7 @@ public class ProblemController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "常见问题列表-删除")
|
||||
@RequestMapping(value = "/problem/del/{majorId}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/del/{majorId}", method = RequestMethod.GET)
|
||||
public CommonResult<Void> delProblem(@PathVariable Integer majorId) {
|
||||
if (storeProductProblemService.delProblem(majorId) > 0) {
|
||||
return CommonResult.success();
|
||||
|
@ -22,7 +22,7 @@ import java.util.Map;
|
||||
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController("StoreOrderFrontController")
|
||||
@RestController("StoreOrderController")
|
||||
@RequestMapping("api/front/order")
|
||||
@Api(tags = "订单")
|
||||
public class StoreOrderController {
|
||||
|
14
food-service/src/main/java/com/zbkj/service/dao/HelpDao.java
Normal file
14
food-service/src/main/java/com/zbkj/service/dao/HelpDao.java
Normal file
@ -0,0 +1,14 @@
|
||||
package com.zbkj.service.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zbkj.common.model.article.Article;
|
||||
import com.zbkj.common.model.system.SystemHelpProblem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HelpDao extends BaseMapper<SystemHelpProblem> {
|
||||
|
||||
List<SystemHelpProblem> getListHelp(@Param("cid") String cid);
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.zbkj.service.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.common.model.system.SystemHelpProblem;
|
||||
import com.zbkj.common.request.HelpRequest;
|
||||
import com.zbkj.common.request.PageParamRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ArticleService 接口
|
||||
|
||||
*/
|
||||
public interface HelpService extends IService<SystemHelpProblem> {
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param cid 分类id
|
||||
* @param pageParamRequest 分页类参数
|
||||
*/
|
||||
List<SystemHelpProblem> getListHelp(String cid, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
* @return List<Category>
|
||||
*/
|
||||
List<Category> getCategoryList();
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param request 新增参数
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean create(HelpRequest request);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id 文章id
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
Boolean updateHelp(Integer id, HelpRequest request);
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id 文章id
|
||||
* @return Article
|
||||
*/
|
||||
SystemHelpProblem getDetail(Integer id);
|
||||
|
||||
/**
|
||||
* 有用/无用
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Boolean feedback(Integer id, Integer type);
|
||||
|
||||
}
|
@ -24,7 +24,7 @@ public class DeliverySetTimeServiceImpl extends ServiceImpl<DeliverySetTimeDao,
|
||||
public List<DeliveryTimeResponse> getDeliveryTime() {
|
||||
LambdaQueryWrapper<DeliverySetTime> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(DeliverySetTime::getType, 1);
|
||||
lqw.eq(DeliverySetTime::getStatus, Constants.COMMON_SWITCH_CLOSE);
|
||||
lqw.eq(DeliverySetTime::getStatus, Constants.COMMON_SWITCH_OPEN);
|
||||
DeliverySetTime deliverySetTime = dao.selectOne(lqw);
|
||||
// 设置起始日期和天数
|
||||
LocalDate startDate = LocalDate.now();; // 起始日期
|
||||
|
@ -0,0 +1,141 @@
|
||||
package com.zbkj.service.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.constants.Constants;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.model.article.Article;
|
||||
import com.zbkj.common.model.category.Category;
|
||||
import com.zbkj.common.model.system.SystemHelpProblem;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.ArticleResponse;
|
||||
import com.zbkj.common.utils.RedisUtil;
|
||||
import com.zbkj.common.vo.ArticleVo;
|
||||
import com.zbkj.service.dao.ArticleDao;
|
||||
import com.zbkj.service.dao.HelpDao;
|
||||
import com.zbkj.service.service.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* ArticleServiceImpl 接口实现
|
||||
|
||||
*/
|
||||
@Service
|
||||
public class HelpServiceImpl extends ServiceImpl<HelpDao, SystemHelpProblem> implements HelpService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(HelpServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private HelpDao dao;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
@Override
|
||||
public List<SystemHelpProblem> getListHelp(String cid, PageParamRequest page) {
|
||||
PageHelper.startPage(page.getPage(), page.getLimit());
|
||||
return dao.getListHelp(cid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类列表(移动端)
|
||||
* @return List<Category>
|
||||
*/
|
||||
@Override
|
||||
public List<Category> getCategoryList() {
|
||||
return categoryService.findCategoryList(Constants.CATEGORY_TYPE_HELP);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param request 新增参数
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean create(HelpRequest request) {
|
||||
SystemHelpProblem entity = JSON.parseObject(JSON.toJSONString(request), SystemHelpProblem.class);
|
||||
entity.setImage(systemAttachmentService.clearPrefix(request.getImage()));
|
||||
entity.setContent(systemAttachmentService.clearPrefix(request.getContent()));
|
||||
return save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id id
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteById(Integer id) {
|
||||
SystemHelpProblem entity = getById(id);
|
||||
if (ObjectUtil.isNull(entity)) {
|
||||
throw new CrmebException("已删除");
|
||||
}
|
||||
return removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param id id
|
||||
* @param request 修改参数
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateHelp(Integer id, HelpRequest request) {
|
||||
SystemHelpProblem entity = JSON.parseObject(JSON.toJSONString(request), SystemHelpProblem.class);
|
||||
entity.setId(id);
|
||||
entity.setImage(systemAttachmentService.clearPrefix(request.getImage()));
|
||||
entity.setContent(systemAttachmentService.clearPrefix(request.getContent()));
|
||||
return updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
* @param id 文章id
|
||||
* @return Article
|
||||
*/
|
||||
@Override
|
||||
public SystemHelpProblem getDetail(Integer id) {
|
||||
SystemHelpProblem entity = getById(id);
|
||||
if (ObjectUtil.isNull(entity)) {
|
||||
throw new CrmebException("不存在");
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean feedback(Integer id, Integer type) {
|
||||
SystemHelpProblem entity = getById(id);
|
||||
if (ObjectUtil.isNull(entity)) {
|
||||
throw new CrmebException("不存在");
|
||||
}
|
||||
SystemHelpProblem upd = new SystemHelpProblem();
|
||||
upd.setId(id);
|
||||
if (type == 1) {
|
||||
upd.setUsefulNum(entity.getUsefulNum() + 1);
|
||||
} else {
|
||||
upd.setUselessNum(entity.getUselessNum() + 1);
|
||||
}
|
||||
return updateById(upd);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
<?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.zbkj.service.dao.HelpDao">
|
||||
|
||||
<select id="getListHelp" resultType="com.zbkj.common.model.system.SystemHelpProblem">
|
||||
SELECT
|
||||
h.id,
|
||||
h.cid,
|
||||
c.`name`,
|
||||
h.title,
|
||||
h.synopsis,
|
||||
h.content,
|
||||
h.image,
|
||||
h.jump_url jumpUrl,
|
||||
h.share_title shareTitle,
|
||||
h.share_synopsis shareSynopsis,
|
||||
h.share_image shareImage,
|
||||
h.useful_num usefulNum,
|
||||
h.useless_num uselessNum,
|
||||
h.status,
|
||||
h.sort,
|
||||
h.create_time createTime
|
||||
FROM eb_system_help_problem h INNER JOIN eb_category c on h.cid = c.id and c.type = 9
|
||||
<if test="cid != null and cid != ''"> and c.id = #{cid} </if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user