提交 4572297c authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 859fb80c
......@@ -19,6 +19,6 @@ public class MemberCollectionForm {
@ApiModelProperty("收藏对象")
private List<GoodsForm> goodsList;
@ApiModelProperty("资源类型 供查询用1医著2文章")
@ApiModelProperty("资源类型 1图书 2文章")
private String goodsType;
}
......@@ -45,4 +45,8 @@ public class AudioLibrary {
private Integer nationsType;
@ApiModelProperty(value = "销量")
private Integer salesNum;
@ApiModelProperty("是否删除 1未删除 2已删除")
private Integer isDelete;
@ApiModelProperty("文章id")
private String objectId;
}
......@@ -41,5 +41,9 @@ public class PdfLibrary {
private Integer nationsType;
@ApiModelProperty("状态:0已录入,1已上架,2已下架")
private Integer status;
@ApiModelProperty("是否删除 1未删除 2已删除")
private Integer isDelete;
@ApiModelProperty("文章id")
private String objectId;
}
......@@ -54,4 +54,8 @@ public class VideoLibrary {
private Integer clickNum;
@ApiModelProperty(value = "销量")
private Integer salesNum;
@ApiModelProperty("是否删除 1未删除 2已删除")
private Integer isDelete;
@ApiModelProperty("文章id")
private String objectId;
}
......@@ -41,6 +41,7 @@ public class BulletinContent {
private String content;
@ApiModelProperty(value="置顶状态:0未置顶,1已置顶")
private Integer topStatus;
/***
* @see StatusEnum
*/
......@@ -57,4 +58,12 @@ public class BulletinContent {
private String linkType;
@ApiModelProperty(value = "链接地址")
private String linkUrl;
//rjc添加
@ApiModelProperty(value = "浏览数量")
private Integer browseNum;
@ApiModelProperty(value = "点赞量")
private Integer fabulousNum;
@ApiModelProperty("用户id")
private String userId;
}
......@@ -95,12 +95,14 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
audio.setTimeLength(form.getTimeLength());
audio.setAudio(form.getAudio());
audio.setName(form.getAudioName());
audio.setObjectId(entity.getId());
audioLibraryMapper.insertSelective(audio);
}
if (form.getPdf()!=null) {
PdfLibrary pdf=new PdfLibrary();
pdf.setPdf(form.getPdfName());
pdf.setName(form.getPdfName());
pdf.setObjectId(entity.getId());
pdfLibraryMapper.insertSelective(pdf);
}
if (form.getVideo()!=null) {
......@@ -109,6 +111,7 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
video.setTimeLength(form.getTimeLength());
video.setVideo(form.getVideo());
video.setName(form.getVideoName());
video.setObjectId(entity.getId());
videoLibraryMapper.insertSelective(video);
}
return true;
......@@ -128,8 +131,30 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
if (entity.getStatus() == LibraryStatusEnum.STATUS_1.getCode()) {
throw new BusinessValidateException("不能删除已上架的资源");
}
Example example1 = createExample();
example1.createCriteria().andEqualTo("objectId", entity.getId());
//逻辑删除视频
if(entity.getVideo()!=null && entity.getVideo()!=""){
VideoLibrary videoLibrary = videoLibraryMapper.selectOneByExample(example1);
videoLibrary.setIsDelete(2);
videoLibraryMapper.updateByExample(videoLibrary, example1);
}
//逻辑删除音频
if(entity.getAudio()!=null && entity.getAudio()!=""){
AudioLibrary audioLibrary = audioLibraryMapper.selectOneByExample(example1);
audioLibrary.setIsDelete(2);
audioLibraryMapper.updateByExample(audioLibrary, example1);
}
//逻辑删除pdf
if(entity.getPdf()!=null && entity.getPdf()!=""){
PdfLibrary pdfLibrary = pdfLibraryMapper.selectOneByExample(example1);
pdfLibrary.setIsDelete(2);
pdfLibraryMapper.updateByExample(pdfLibrary, example1);
}
//逻辑删除文章
entity.setIsDelete(2);
mapper.updateByPrimaryKey(entity);
}
return true;
}
......
......@@ -118,7 +118,6 @@ public class FgArticleLibraryController {
List<ArticleLibrary> vos = service.selectByExample(example);
return CallBack.success(vos);
}
@ApiOperation(value = "相关文章", notes = "图书详情页-相关文章列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.GET_OID)
public CallBack<List<FgArticleLibraryListVO>> queryRelatedArticles(FgQueryRelatedArticleForm form){
......
......@@ -2,6 +2,7 @@ package com.zrqx.sysuser.fg.controller.information;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
......@@ -9,10 +10,14 @@ 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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.zrqx.core.constant.sysuser.SysUserRequestPath;
import com.zrqx.core.exception.LoginValidateException;
import com.zrqx.core.exception.ParameterValidateException;
import com.zrqx.core.form.sysuser.fg.bulletin.FgQueryBulletinForm;
import com.zrqx.core.form.sysuser.fg.message.FgQueryMessageForm;
import com.zrqx.core.model.sysuser.bulletin.BulletinContent;
......@@ -22,6 +27,7 @@ import com.zrqx.core.util.response.CallBack;
import com.zrqx.core.vo.sysuser.fg.bulletin.FgBulletinContentListVo;
import com.zrqx.core.vo.sysuser.fg.bulletin.FgBulletinContentVo;
import com.zrqx.core.vo.sysuser.fg.message.FgMessageListVO;
import com.zrqx.sysuser.commons.redis.Redis;
import com.zrqx.sysuser.fg.service.bulletin.FgBulletinContentService;
import com.zrqx.sysuser.fg.service.message.FgMessageService;
......@@ -46,7 +52,7 @@ public class FgInformationController {
return CallBack.success(service.list(form));
}
@ApiOperation(value = "医药资讯/考试专栏列表", notes = "根据栏目名查询公告")
@ApiOperation(value = "资讯列表", notes = "根据栏目名查询资讯")
@GetMapping(value = SysUserRequestPath.BULLETIN_CONTENT + SysUserRequestPath.PAGE)
public CallBack<List<FgBulletinContentVo>> queryBulletinContentList(String name, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
......@@ -55,10 +61,18 @@ public class FgInformationController {
return CallBack.success(service.page(name, pageParam));
}
@ApiOperation(value = "查询医药资讯/考试专栏的内容详情", notes = "根据ID查询")
@ApiOperation(value = "资讯详情页", notes = "根据ID查询")
@GetMapping(value = SysUserRequestPath.BULLETIN_CONTENT + SysUserRequestPath.OID)
public CallBack<BulletinContent> getById(@PathVariable Integer oid) {
return CallBack.success(service.selectByPrimaryKey(oid));
BulletinContent vo = service.selectByPrimaryKey(oid);
// 更新浏览量
service.updateBrowseNum(oid);
return CallBack.success(vo);
}
@ApiOperation(value = "资讯点赞", notes = "根据id点赞")
@PostMapping(SysUserRequestPath.AGREE)
public CallBack<?> agreeInformation(@ApiParam("资讯id")@RequestParam(required = true) Integer oid){
return service.agreeInformation(oid) ? CallBack.success() : CallBack.fail();
}
@ApiOperation(value = "在线咨询列表", notes = "分页查询")
......@@ -69,6 +83,7 @@ public class FgInformationController {
}
return CallBack.success(messageService.queryMessageList(form,pageParam));
}
/*
@ApiOperation(value = "查看提问", notes = "根据ID查询")
@GetMapping(value = SysUserRequestPath.MESSAGE + SysUserRequestPath.OID)
......
......@@ -34,4 +34,20 @@ public interface FgBulletinContentService extends
* @date: 2018年8月10日 下午4:40:38
*/
List<FgBulletinContentVo> page(String name, PageParam pageParam);
/**
* 资讯点赞
* @param oid
* @return
* @author rjc
* @date: 2019年3月12日 下午1:49:26
*/
public boolean agreeInformation(Integer oid);
/**
* 更新浏览量
* @param oid
* @return
* @author rjc
* @date: 2019年3月12日 下午2:16:32
*/
boolean updateBrowseNum(Integer oid);
}
......@@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.zrqx.core.enums.ResponseCodeEnum;
import com.zrqx.core.exception.LoginValidateException;
import com.zrqx.core.exception.ParameterValidateException;
import com.zrqx.core.form.sysuser.fg.bulletin.FgQueryBulletinForm;
import com.zrqx.core.mapper.BaseMapper;
......@@ -17,6 +18,7 @@ import com.zrqx.core.service.BaseServiceImpl;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.core.vo.sysuser.fg.bulletin.FgBulletinContentListVo;
import com.zrqx.core.vo.sysuser.fg.bulletin.FgBulletinContentVo;
import com.zrqx.sysuser.commons.redis.Redis;
import com.zrqx.sysuser.fg.mapper.bulletin.FgBulletinContentMapper;
/**
......@@ -31,6 +33,8 @@ public class FgFgBulletinContentServiceImpl extends
@Autowired
FgBulletinContentMapper mapper;
@Autowired
private Redis redisManage;
@Override
public BaseMapper<BulletinContent> getMapper() {
return mapper;
......@@ -80,4 +84,49 @@ public class FgFgBulletinContentServiceImpl extends
}
return voList;
}
public boolean agreeInformation(Integer oid){
if(StringUtils.isEmpty(redisManage.get(Redis.getFgToken()))){
throw new LoginValidateException(1, "登录过期或未登录");
}
if(oid == null){
throw new ParameterValidateException(2,"资讯id不能为空");
}
BulletinContent content= mapper.selectByPrimaryKey(oid);
content.setUserId(redisManage.getMember().getId().toString());
if(content.getFabulousNum()==null){
content.setFabulousNum(0);
}
Integer num = content.getFabulousNum();
num += 1;
content.setFabulousNum(num);
mapper.updateByPrimaryKey(content);
return true;
}
/**
* 更新浏览量
* @see com.zrqx.sysuser.fg.service.bulletin.FgBulletinContentService#updateBrowseNum(java.lang.Integer)
* @param oid
* @return
* @author rjc
* @date: 2019年3月12日 下午2:16:53
*/
public boolean updateBrowseNum(Integer oid) {
if(StringUtils.isEmpty(redisManage.get(Redis.getFgToken()))){
throw new LoginValidateException(1, "登录过期或未登录");
}
if(oid == null){
throw new ParameterValidateException(2,"资讯id不能为空");
}
BulletinContent content = mapper.selectByPrimaryKey(oid);
content.setUserId(redisManage.getMember().getId().toString());
if(content.getBrowseNum()==null){
content.setBrowseNum(0);
}
Integer num = content.getBrowseNum();
num += 1;
content.setBrowseNum(num);
mapper.updateByPrimaryKey(content);
return false;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论