Commit 9c734c83 by 阳浪

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	cloud-site-service/src/main/java/com/yizhi/site/application/service/impl/InformationServiceImpl.java
parents 6ef8c136 4c365761
package com.yizhi.site.application.vo.domain; package com.yizhi.site.application.vo.domain;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.activerecord.Model; import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableField;
...@@ -28,14 +29,50 @@ public class InformationClassify extends Model<InformationClassify> { ...@@ -28,14 +29,50 @@ public class InformationClassify extends Model<InformationClassify> {
@TableField("type_one") @TableField("type_one")
private Long typeOne; private Long typeOne;
@ApiModelProperty(value = "文章父类型名称")
@TableField(exist = false)
private String typeOneName;
@ApiModelProperty(value = "文章子类型(二级)") @ApiModelProperty(value = "文章子类型(二级)")
@TableField("type_two") @TableField("type_two")
private Long typeTwo; private Long typeTwo;
@ApiModelProperty(value = "文章子类型(二级)名称")
@TableField(exist = false)
private String typeTwoName;
@ApiModelProperty(value = "文章子类型(三级)") @ApiModelProperty(value = "文章子类型(三级)")
@TableField("type_three") @TableField("type_three")
private Long typeThree; private Long typeThree;
@ApiModelProperty(value = "文章子类型(三级)名称")
@TableField(exist = false)
private String typeThreeName;
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "创建人")
@TableField("create_by_id")
private Long createById;
@ApiModelProperty(value = "创建人姓名")
@TableField("create_by_name")
private String createByName;
@ApiModelProperty(value = "修改时间")
@TableField("update_time")
private Date updateTime;
@ApiModelProperty(value = "修改人")
@TableField("update_by_id")
private Long updateById;
@ApiModelProperty(value = "修改人姓名")
@TableField("update_by_name")
private String updateByName;
@Override @Override
protected Serializable pkVal() { protected Serializable pkVal() {
return this.id; return this.id;
......
package com.yizhi.site.application.vo.domain; package com.yizhi.site.application.vo.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* <p> * <p>
* *
...@@ -97,6 +97,12 @@ public class InformationVo{ ...@@ -97,6 +97,12 @@ public class InformationVo{
@ApiModelProperty(value = "文章第三层类型") @ApiModelProperty(value = "文章第三层类型")
private Long typeThree; private Long typeThree;
@ApiModelProperty(value = "副标题")
private String titleSub;
@ApiModelProperty(value = "图片来源")
private String imgSource;
private String typeThreeName; private String typeThreeName;
@ApiModelProperty(value = "资讯分类") @ApiModelProperty(value = "资讯分类")
......
...@@ -6,9 +6,10 @@ import java.util.Date; ...@@ -6,9 +6,10 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.yizhi.site.application.domain.Information; import com.yizhi.site.application.domain.Information;
import com.yizhi.site.application.mapper.InformationClassifyMapper;
import com.yizhi.site.application.constant.SiteConstant; import com.yizhi.site.application.constant.SiteConstant;
import com.yizhi.site.application.service.PortalBannerService; import com.yizhi.site.application.service.PortalBannerService;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.comment.application.feign.PdfPagesClient; import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.comment.application.vo.PdfVO; import com.yizhi.comment.application.vo.PdfVO;
import com.yizhi.core.application.event.EventWrapper; import com.yizhi.core.application.event.EventWrapper;
...@@ -28,8 +29,10 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -28,8 +29,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.site.application.service.InformationService; import com.yizhi.site.application.service.InformationService;
import com.yizhi.site.application.vo.domain.InformationClassify;
import com.yizhi.site.application.vo.site.IdOneVO; import com.yizhi.site.application.vo.site.IdOneVO;
import com.yizhi.site.application.vo.site.InfomationParamVO; import com.yizhi.site.application.vo.site.InfomationParamVO;
import com.yizhi.site.application.vo.site.ParamVO; import com.yizhi.site.application.vo.site.ParamVO;
...@@ -60,6 +63,12 @@ public class InformationManageController { ...@@ -60,6 +63,12 @@ public class InformationManageController {
@Autowired @Autowired
private PdfPagesClient pdfPagesClient; private PdfPagesClient pdfPagesClient;
@Autowired
private InformationClassifyMapper informationClassifyMapper;
@Autowired
private IdGenerator idGenerator;
private static final Logger LOGGER = LoggerFactory.getLogger(InformationManageController.class); private static final Logger LOGGER = LoggerFactory.getLogger(InformationManageController.class);
@PostMapping("/list") @PostMapping("/list")
...@@ -108,6 +117,58 @@ public class InformationManageController { ...@@ -108,6 +117,58 @@ public class InformationManageController {
information.setState(SiteConstant.TWO); information.setState(SiteConstant.TWO);
informationService.updateById(information); informationService.updateById(information);
} }
//保存资讯分类
if (!CollectionUtils.isEmpty(information.getInformationClassify())) {
for(InformationClassify item : information.getInformationClassify()){
if(item.getId() == null || item.getId() == 0){
item.setId(idGenerator.generate());
item.setInformationId(information.getId());
item.setCreateById(information.getCreateById());
item.setCreateByName(information.getCreateByName());
item.setCreateTime(information.getCreateTime());
item.setUpdateById(information.getUpdateById());
item.setUpdateByName(information.getUpdateByName());
item.setUpdateTime(information.getUpdateTime());
informationClassifyMapper.insert(item);
}
}
//删除不存在的资讯分类
//获取已有的资讯
InformationClassify classify = new InformationClassify();
classify.setInformationId(information.getId());
EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify);
List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(informationClassify)) {
boolean isDel = true;
for(InformationClassify old : informationClassify){
isDel = true;
for(InformationClassify item : information.getInformationClassify()){
if(old.getId().equals(item.getId())){
isDel = false;
break;
}
}
if(isDel){
informationClassifyMapper.deleteById(old.getId());
}
}
}
} else {
//删除所有资讯分类
InformationClassify classify = new InformationClassify();
classify.setInformationId(information.getId());
EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify);
List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(informationClassify)) {
for(InformationClassify old : informationClassify){
informationClassifyMapper.deleteById(old.getId());
}
}
}
if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) { if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) {
List<PdfVO> pdfVOs = new ArrayList<PdfVO>(); List<PdfVO> pdfVOs = new ArrayList<PdfVO>();
PdfVO pdfVO = new PdfVO(); PdfVO pdfVO = new PdfVO();
......
...@@ -124,6 +124,18 @@ public class Information extends Model<Information> { ...@@ -124,6 +124,18 @@ public class Information extends Model<Information> {
@TableField(exist = false) @TableField(exist = false)
private String typeThreeName; private String typeThreeName;
@ApiModelProperty(value = "文章子类型(三级)名称")
@TableField(exist = false)
private String typeThreeName;
@ApiModelProperty(value = "副标题")
@TableField("title_sub")
private String titleSub;
@ApiModelProperty(value = "图片来源")
@TableField("img_source")
private String imgSource;
@ApiModelProperty(value = "资讯分类") @ApiModelProperty(value = "资讯分类")
@TableField(exist = false) @TableField(exist = false)
private List<InformationClassify> informationClassify; private List<InformationClassify> informationClassify;
......
...@@ -923,13 +923,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -923,13 +923,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if (list.size() > 0 && list != null) { if (list.size() > 0 && list != null) {
for (Information info : list) { for (Information info : list) {
if (info.getTypeOne() != null || info.getTypeOne() != 0) { if (info.getTypeOne() != null && info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne())); info.setTypeOneName(findNameById(info.getTypeOne()));
} }
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null && info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) { if (info.getTypeThree() != null && info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree())); info.setTypeThreeName(findNameById(info.getTypeThree()));
} }
} }
...@@ -983,13 +983,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -983,13 +983,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
} }
if (list.size() > 0 && list != null) { if (list.size() > 0 && list != null) {
for (Information info : list) { for (Information info : list) {
if (info.getTypeOne() != null || info.getTypeOne() != 0) { if (info.getTypeOne() != null && info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne())); info.setTypeOneName(findNameById(info.getTypeOne()));
} }
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null && info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) { if (info.getTypeThree() != null && info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree())); info.setTypeThreeName(findNameById(info.getTypeThree()));
} }
} }
...@@ -1004,13 +1004,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1004,13 +1004,13 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
if (info == null) { if (info == null) {
return null; return null;
} }
if (info.getTypeOne() != null || info.getTypeOne() != 0) { if (info.getTypeOne() != null && info.getTypeOne() != 0) {
info.setTypeOneName(findNameById(info.getTypeOne())); info.setTypeOneName(findNameById(info.getTypeOne()));
} }
if (info.getTypeTwo() != null || info.getTypeTwo() != 0) { if (info.getTypeTwo() != null && info.getTypeTwo() != 0) {
info.setTypeTwoName(findNameById(info.getTypeTwo())); info.setTypeTwoName(findNameById(info.getTypeTwo()));
} }
if (info.getTypeThree() != null || info.getTypeThree() != 0) { if (info.getTypeThree() != null && info.getTypeThree() != 0) {
info.setTypeThreeName(findNameById(info.getTypeThree())); info.setTypeThreeName(findNameById(info.getTypeThree()));
} }
...@@ -1019,6 +1019,19 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1019,6 +1019,19 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
classify.setInformationId(id); classify.setInformationId(id);
EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify); EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify);
List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper); List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(informationClassify)) {
for(InformationClassify item : informationClassify){
if (item.getTypeOne() != null && item.getTypeOne() != 0) {
item.setTypeOneName(findNameById(item.getTypeOne()));
}
if (item.getTypeTwo() != null && item.getTypeTwo() != 0) {
item.setTypeTwoName(findNameById(item.getTypeTwo()));
}
if (item.getTypeThree() != null && item.getTypeThree() != 0) {
item.setTypeThreeName(findNameById(item.getTypeThree()));
}
}
}
info.setInformationClassify(informationClassify); info.setInformationClassify(informationClassify);
return info; return info;
...@@ -1052,6 +1065,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1052,6 +1065,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
this.insert(information); this.insert(information);
} }
//保存资讯分类
if (!CollectionUtils.isEmpty(information.getInformationClassify())) {
for(InformationClassify item : information.getInformationClassify()){
item.setId(idGenerator.generate());
item.setInformationId(information.getId());
item.setCreateById(information.getCreateById());
item.setCreateByName(information.getCreateByName());
item.setCreateTime(information.getCreateTime());
item.setUpdateById(information.getUpdateById());
item.setUpdateByName(information.getUpdateByName());
item.setUpdateTime(information.getUpdateTime());
informationClassifyMapper.insert(item);
}
}
if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) { if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) {
List<PdfVO> pdfVOs = new ArrayList<PdfVO>(); List<PdfVO> pdfVOs = new ArrayList<PdfVO>();
PdfVO pdfVO = new PdfVO(); PdfVO pdfVO = new PdfVO();
......
...@@ -96,8 +96,7 @@ ...@@ -96,8 +96,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
...@@ -131,8 +130,7 @@ ...@@ -131,8 +130,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
...@@ -164,8 +162,7 @@ ...@@ -164,8 +162,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_two = c.id LEFT JOIN data_classification c ON a.type_two = c.id
...@@ -242,8 +239,7 @@ ...@@ -242,8 +239,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
...@@ -283,8 +279,7 @@ ...@@ -283,8 +279,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
...@@ -369,8 +364,7 @@ ...@@ -369,8 +364,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
...@@ -403,8 +397,7 @@ ...@@ -403,8 +397,7 @@
WHERE WHERE
rn.information_id = a.id rn.information_id = a.id
) number, ) number,
a.author, a.author
a.info_source
FROM FROM
information AS a information AS a
LEFT JOIN data_classification c ON a.type_one = c.id LEFT JOIN data_classification c ON a.type_one = c.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment