提交 db48f7fa authored 作者: liupengfei's avatar liupengfei

--no commit message

上级 48356465
......@@ -141,38 +141,21 @@ public class EbookController {
if (!ebookservice.saveOrUpdate(form)) {
throw new BaseException("操作失败");
}
// 当图书为免费时,文章图片同步为免费
if(StringUtils.isNotBlank(form.getId()) && form.getPriceOption().equals(PriceOptionEnum.STATUS_0.getCode())){
this.updateArticlePrice(Arrays.asList(form.getId()));
this.updateImagePrice(Arrays.asList(form.getId()));
}
return CallBack.success(true);
}
@ApiOperation("修改电子书")
@PostMapping("/update")
public CallBack<?> updateBook(@RequestBody SaveUpdateEbookForm form) {
if (!ebookservice.saveOrUpdate(form)) {
throw new BaseException("操作失败");
if(StringUtils.isNotBlank(form.getId())){
// 当图书为免费时,文章图片同步为免费
if(form.getPriceOption().equals(PriceOptionEnum.STATUS_0.getCode())){
this.updateArticlePrice(Arrays.asList(form.getId()));
}
// 推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(AllResourceTypeEnum.BOOK.getCode());
if(StringUtils.isNotBlank(form.getImg())){
res.setResImg(form.getImg());
}
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
}
// 当图书为免费时,文章图片同步为免费
if(StringUtils.isNotBlank(form.getId()) && PriceOptionEnum.STATUS_0.getCode().equals(form.getPriceOption())){
this.updateArticlePrice(Arrays.asList(form.getId()));
this.updateImagePrice(Arrays.asList(form.getId()));
}
// 促销活动内容修改
PromotionContent con = new PromotionContent();
con.setResourceId(form.getId());
con.setResourceType(AllResourceTypeEnum.BOOK.getCode());
con.setName(form.getName());
promotionContentService.updateContent(con);
// 推荐位内容修改
UpdateRecommendResourceForm res = new UpdateRecommendResourceForm();
res.setResId(form.getId());
res.setResType(AllResourceTypeEnum.BOOK.getCode());
res.setResImg(form.getBookCover());
res.setResName(form.getName());
recommendResourceService.updateResourceContent(res);
return CallBack.success(true);
}
......@@ -206,12 +189,6 @@ public class EbookController {
if(ebook.getPrice() != null){
vo.setPrice(ebook.getPrice().toString());
}
if(ebook.getEntityRealPrice() != null){
vo.setEntityRealPrice(ebook.getEntityRealPrice().toString());
}
if(ebook.getEntityPrice() != null){
vo.setEntityPrice(ebook.getEntityPrice().toString());
}
if(ebook.getPdfId() == null){
if(ebook.getPdfFile() == null){
vo.setPdfType(3);
......@@ -234,9 +211,6 @@ public class EbookController {
// 选中的LabelContentDiyTypeId
List<Integer> labelContentDiyTypeIds = lcdList.stream().map(EbookLabelContentDiyType :: getLabelContentDiyTypeId).collect(Collectors.toList());
vo.setLabelContentDiyTypeIds(labelContentDiyTypeIds);
if (StringUtils.isNotBlank(ebook.getPdfFile())) {
vo.setPdf_zh(pdfLibraryService.getOriginalFileName(ebook.getPdfFile()));
}
// 目录
List<ChapterLibrary> chapterList = this.getDirectory(vo.getId());
vo.setChapterList(chapterList);
......@@ -248,12 +222,13 @@ public class EbookController {
public CallBack<Boolean> update1(@RequestBody UpdateEbookForm form) {
Ebook eb = new Ebook();
eb.setPriceOption(form.getPriceOption());
eb.setPrice(form.getPrice());
eb.setRealPrice(form.getRealPrice());
eb.setUpdateTime(new Date());
Example example = dtservice.createExample();
Example example = ebookservice.createExample();
example.createCriteria().andIn("id", form.getIds());
if (!ebookservice.UpdateByExampleSelective(eb,example)) {
throw new BaseException("操作失败");
throw new BaseException("修改失败");
}
// 当图书为免费时,文章同步为免费
if(PriceOptionEnum.STATUS_0.getCode().equals(form.getPriceOption())){
......@@ -272,7 +247,7 @@ public class EbookController {
return CallBack.success();
}
@ApiOperation(value = "批量修改销售状态", notes = "批量修改销售状态")
/*@ApiOperation(value = "批量修改销售状态", notes = "批量修改销售状态")
@PostMapping(value = "/batch/update/status")
public CallBack<Boolean> update3(@RequestBody UpdateEbookForm form) {
Book b = new Book();
......@@ -319,7 +294,7 @@ public class EbookController {
throw new BaseException("请求参数有误,请检查!");
}
return CallBack.success();
}
}*/
@ApiOperation(value = "批量修改上下架", notes = "批量修改上下架")
@PostMapping(value = "/batch/update/updown")
......@@ -371,7 +346,7 @@ public class EbookController {
return CallBack.success();
}
@ApiOperation(value = "批量提交审核", notes = "批量提交审核")
/*@ApiOperation(value = "批量提交审核", notes = "批量提交审核")
@PostMapping(value = "/batch/update")
public CallBack<Boolean> update6(@RequestBody List<String> ids) {
if (!list(ids, EbookStatusEnum._1, false, EbookStatusEnum._0)) {// 如果状态不是
......@@ -380,7 +355,7 @@ public class EbookController {
throw new BaseException("请先下架,再删除数据。");
}
return CallBack.success();
}
}*/
@ApiOperation(value = "批量删除", notes = "批量删除")
@PostMapping(value = "/batch/delete")
......@@ -394,15 +369,10 @@ public class EbookController {
}
}
// 这里需要级联删除其他接口关联资源
// ----推荐位内容
recommendResourceService.delectByResourceIds(ids, AllResourceTypeEnum.BOOK.getCode());
// ----促销活动
promotionContentService.delectByResourceIds(ids, AllResourceTypeEnum.BOOK.getCode());
// ----关联资源
example = new Example(ResourceRelation.class);
example.createCriteria().andIn("objectId", ids).orIn("resourceId", ids);
resourceRelationService.deleteByExample(example);
// 删除相关资源
if (!ebookservice.batchDelete(ids)) {
throw new BaseException("操作失败");
}
// 删除文章
example = new Example(ArticleLibrary.class);
example.createCriteria().andIn("bookId", ids);
List<ArticleLibrary> articleList = alservice.selectByExample(example);
......@@ -410,6 +380,7 @@ public class EbookController {
List<String> articleIdList = articleList.stream().map(ArticleLibrary :: getId).collect(Collectors.toList());
alservice.batchDelete(articleIdList);
}
// 删除图片
example = new Example(ImageLibrary.class);
example.createCriteria().andIn("bookId", ids);
List<ImageLibrary> imageList = ilService.selectByExample(example);
......@@ -417,38 +388,6 @@ public class EbookController {
List<String> imageIdList = imageList.stream().map(ImageLibrary :: getId).collect(Collectors.toList());
ilService.batchDelete(imageIdList);
}
// ----目录
example = new Example(ChapterLibrary.class);
example.createCriteria().andIn("bookid", ids);
chapterLibraryService.deleteByExample(example);
// ----自定义分类
example = new Example(EbookDiyType.class);
example.createCriteria().andIn("ebookId", ids);
dtservice.deleteByExample(example);
// ----自定义标签
example = new Example(EbookLabelContentDiyType.class);
example.createCriteria().andIn("ebookId", ids);
lcdtservice.deleteByExample(example);
example = new Example(Ebook.class);
example.createCriteria().andIn("id", ids);
ebookservice.deleteByExample(example);
example = new Example(Book.class);
example.createCriteria().andIn("id", ids);
bookservice.deleteByExample(example);
//删除资源订单相关信息
orderClient.deleteOrder(ids);
//删除资源收藏相关信息
example = new Example(MemberCollection.class);
example.createCriteria().andIn("objectId", ids);
memberCollectionService.deleteByExample(example);
//删除资源购物车相关信息
example = new Example(ShoppingCart.class);
example.createCriteria().andIn("goodsId", ids);
shoppingCartService.deleteByExample(example);
//删除资源浏览记录相关信息
example = new Example(Record.class);
example.createCriteria().andIn("goodsId", ids);
recordService.deleteByExample(example);
return CallBack.success();
}
......@@ -635,7 +574,6 @@ public class EbookController {
article.setUpdateTime(new Date());
article.setStatus(0);
article.setBrowseNum(50);
article.setNationsType(book.getNationsType());
article.setResourceType(AllResourceTypeEnum.ARTICLE.getCode());
article.setGoodsType(GoodsTypeEnum.ARTICLE.getCode());
article.setSalesNum(0);
......@@ -703,7 +641,6 @@ public class EbookController {
ev.getEbook().setBookStatus(0);
ev.getEbook().setGoodsType(GoodsTypeEnum.EBOOK.getCode());
ev.getEbook().setBrowseNum(50);
ev.getEbook().setName(ev.getBook().getName());
ev.getEbook().setBookType(1);
ev.getEbook().setPriceOption(PriceOptionEnum.STATUS_1.getCode());
ebookservice.insert(ev.getEbook());
......@@ -728,7 +665,6 @@ public class EbookController {
article.setUpdateTime(new Date());
article.setStatus(0);
article.setBrowseNum(50);
article.setNationsType(ev.getBook().getNationsType());
article.setResourceType(AllResourceTypeEnum.ARTICLE.getCode());
article.setGoodsType(GoodsTypeEnum.ARTICLE.getCode());
article.setSalesNum(0);
......@@ -907,7 +843,6 @@ public class EbookController {
ev.getEbook().setGoodsType(GoodsTypeEnum.EBOOK.getCode());
ev.getEbook().setBrowseNum(50);
ev.getEbook().setBookType(1);
ev.getEbook().setName(ev.getBook().getName());
ebookservice.insert(ev.getEbook());
// 图书分类关联表
EbookDiyType edt = new EbookDiyType();
......
......@@ -47,7 +47,7 @@ public class ProjectLibraryController {
@Autowired
private RecommendResourceService recommendResourceService;
@ApiOperation(value = "新增" , notes ="新增一个")
/*@ApiOperation(value = "新增" , notes ="新增一个")
@PostMapping(value = "/save")
public CallBack<Boolean> save(@RequestBody SaveUpdateProjectLibraryForm form){
if(!service.saveOrUpdate(form)){
......@@ -111,6 +111,6 @@ public class ProjectLibraryController {
@GetMapping(value = "/page")
public CallBack<PageInfo<ProjectLibraryListVO>> page(QueryProjectLibraryForm form, PageParam pageParam){
return CallBack.success(service.page(form, pageParam));
}
}*/
}
......@@ -282,7 +282,7 @@ public class ResourceLibraryController {
audioIdList = resultMap.get(AllResourceTypeEnum.AUDIO.getCode());
imageIdList = resultMap.get(AllResourceTypeEnum.IMAGE.getCode());
annexIdList = resultMap.get(AllResourceTypeEnum.ANNEX.getCode());
projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
//projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
courseIdList = resultMap.get(AllResourceTypeEnum.COURSE.getCode());
}
QueryResourceForPoPForm f = new QueryResourceForPoPForm();
......@@ -323,10 +323,10 @@ public class ResourceLibraryController {
return CallBack.success(authorLibraryService.pageByTitleAndDiyType(f, pageParam));
}
//专题库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
/*if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
f.setIds(projectIdList);
return CallBack.success(projectLibraryService.pageByTitleAndDiyType(f, pageParam));
}
}*/
//课程库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.COURSE.getCode())){
f.setIds(courseIdList);
......@@ -376,7 +376,7 @@ public class ResourceLibraryController {
audioIdList = resultMap.get(AllResourceTypeEnum.AUDIO.getCode());
imageIdList = resultMap.get(AllResourceTypeEnum.IMAGE.getCode());
annexIdList = resultMap.get(AllResourceTypeEnum.ANNEX.getCode());
projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
//projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
courseIdList = resultMap.get(AllResourceTypeEnum.COURSE.getCode());
}
......@@ -418,10 +418,10 @@ public class ResourceLibraryController {
return CallBack.success(authorLibraryService.pageByTitleAndDiyType(f, pageParam));
}
//专题库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
/*if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
f.setIds(projectIdList);
return CallBack.success(projectLibraryService.pageByTitleAndDiyType(f, pageParam));
}
}*/
//课程库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.COURSE.getCode())){
f.setIds(courseIdList);
......@@ -460,7 +460,7 @@ public class ResourceLibraryController {
audioIdList = resultMap.get(AllResourceTypeEnum.AUDIO.getCode());
imageIdList = resultMap.get(AllResourceTypeEnum.IMAGE.getCode());
annexIdList = resultMap.get(AllResourceTypeEnum.ANNEX.getCode());
projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
//projectIdList = resultMap.get(AllResourceTypeEnum.PROJECT.getCode());
courseIdList = resultMap.get(AllResourceTypeEnum.COURSE.getCode());
}
QueryResourceForPoPForm f = new QueryResourceForPoPForm();
......@@ -501,10 +501,10 @@ public class ResourceLibraryController {
return CallBack.success(authorLibraryService.pageByTitleAndDiyType(f, pageParam));
}
//专题库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
/*if(form.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())){
f.setIds(projectIdList);
return CallBack.success(projectLibraryService.pageByTitleAndDiyType(f, pageParam));
}
}*/
//课程库列表查询
if(form.getResourceType().equals(AllResourceTypeEnum.COURSE.getCode())){
f.setIds(courseIdList);
......@@ -941,7 +941,7 @@ public class ResourceLibraryController {
reslist.add(resultMap);
}
//专题
if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.PROJECT.getCode())){
/*if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.PROJECT.getCode())){
//存储每个高亮处理后的结果
Map<String, Object> resultMap = new HashMap<String, Object>();
//查询结果的id,存入map
......@@ -954,7 +954,7 @@ public class ResourceLibraryController {
}
resultMap.put("uploadTime",solrDocument.get("uploadTime"));
reslist.add(resultMap);
}
}*/
//课程
if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.COURSE.getCode())){
//存储每个高亮处理后的结果
......
......@@ -315,7 +315,7 @@ public class DatabaseController {
}
// pdf
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
StringBuffer ids = new StringBuffer();
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
if (codes.contains(",")) {
......@@ -363,7 +363,7 @@ public class DatabaseController {
process.waitFor();
}
}
}*/
// 视频
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.VIDEO.getCode().toString())) {
StringBuffer ids = new StringBuffer();
......@@ -729,7 +729,7 @@ public class DatabaseController {
}
}
// pdf
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
/*if (resourceType == null || resourceType.contains(AllResourceTypeEnum.PDF.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
try (PreparedStatement ps = conn.prepareStatement(
"select r.pdf from res_pdf_library r inner join res_pdf_library_diy_type rt on r.id =rt.plid where rt.code like '"
......@@ -743,7 +743,7 @@ public class DatabaseController {
}
}
}
}*/
// 视频
if (resourceType == null || resourceType.contains(AllResourceTypeEnum.VIDEO.getCode().toString())) {
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
......
......@@ -28,20 +28,20 @@ public interface EbookMapper extends BaseMapper<Ebook>{
*/
@Select("<script>"
+ "SELECT "
+ " bb.id,bb.name,bb.author,bb.isbn,bb.copyrightTerm, "
+ " be.realprice,be.entityRealPrice,be.uploadTime,be.updateTime,be.bookStatus "
+ " bb.id,bb.name,bb.author,bb.isbn, "
+ " be.realprice,be.uploadTime,be.updateTime,be.bookStatus "
+ " FROM res_book bb "
+ " LEFT JOIN res_ebook be ON bb.id = be.id "
+ " LEFT JOIN res_ebook_diy_type bdt ON be.id = bdt.ebookid"
+ " WHERE 1 = 1 "
+ "<if test='form.option==1'>"
+ " AND bb.author is null "
+ " AND (bb.author is null or bb.author = '') "
+ "</if>"
+ "<if test='form.option==2'>"
+ " AND be.bookCover is null "
+ " AND (be.img is null or be.img = '') "
+ "</if>"
+ "<if test='form.option==3'>"
+ " AND be.summary is null "
+ " AND (be.synopsis is null or be.synopsis = '') "
+ "</if>"
+ "<if test='form.option==4'>"
+ " AND be.realPrice is null "
......
......@@ -17,7 +17,7 @@ import com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper;
import com.zrqx.resource.bg.mapper.audiolibrary.AudioLibraryMapper;
import com.zrqx.resource.bg.mapper.authorLibrary.AuthorLibraryMapper;
import com.zrqx.resource.bg.mapper.courselibrary.CourseLibraryMapper;
import com.zrqx.resource.bg.mapper.ebook.EbookMapper;
import com.zrqx.resource.bg.mapper.ebook.BookMapper;
import com.zrqx.resource.bg.mapper.imagelibrary.ImageLibraryMapper;
import com.zrqx.resource.bg.mapper.projectlibrary.ProjectLibraryMapper;
import com.zrqx.resource.bg.mapper.videolibrary.VideoLibraryMapper;
......@@ -27,9 +27,8 @@ import com.zrqx.resource.commons.model.articlelibrary.ArticleLibrary;
import com.zrqx.resource.commons.model.audiolibrary.AudioLibrary;
import com.zrqx.resource.commons.model.authorLibrary.AuthorLibrary;
import com.zrqx.resource.commons.model.courcelibrary.CourseLibrary;
import com.zrqx.resource.commons.model.ebook.Ebook;
import com.zrqx.resource.commons.model.ebook.Book;
import com.zrqx.resource.commons.model.imagelibrary.ImageLibrary;
import com.zrqx.resource.commons.model.projectlibrary.ProjectLibrary;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.videolibrary.VideoLibrary;
import com.zrqx.resource.commons.vo.bg.ResourceRelationVo;
......@@ -55,7 +54,7 @@ public class ResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelatio
@Autowired
private CourseLibraryMapper courseLibraryMapper;
@Autowired
private EbookMapper ebookMapper;
private BookMapper bookMapper;
@Override
public BaseMapper<ResourceRelation> getMapper() {
......@@ -66,7 +65,7 @@ public class ResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelatio
list.forEach(e -> {
if (e.getResourceType() != null) {
if (e.getResourceType().equals(AllResourceTypeEnum.BOOK.getCode())) {
Ebook vl = ebookMapper.selectByPrimaryKey(e.getResourceId());
Book vl = bookMapper.selectByPrimaryKey(e.getResourceId());
if (vl != null) {
e.setName(vl.getName());
e.setResType_zh(AllResourceTypeEnum.BOOK.getName());
......@@ -114,13 +113,6 @@ public class ResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelatio
e.setResType_zh(AllResourceTypeEnum.AUTHOR.getName());
}
}
if (e.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())) {
ProjectLibrary cl = projectLibraryMapper.selectByPrimaryKey(e.getResourceId());
if (cl != null) {
e.setName(cl.getName());
e.setResType_zh(AllResourceTypeEnum.PROJECT.getName());
}
}
if (e.getResourceType().equals(AllResourceTypeEnum.COURSE.getCode())) {
CourseLibrary cl = courseLibraryMapper.selectByPrimaryKey(e.getResourceId());
if (cl != null) {
......
package com.zrqx.resource.bg.service.ebook;
import java.util.List;
import com.zrqx.core.service.BaseService;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
......@@ -14,4 +16,6 @@ public interface BookService extends BaseService<Book, String> {
PageInfo<Book> queryByIsbn(String isbn, String name, String author,
String uploadTime, PageParam pageParam);
boolean batchDelete(List<String> ids);
}
......@@ -37,7 +37,13 @@ public interface EbookService extends BaseService<Ebook, String>{
*/
boolean batchInsert(SaveEbookForm form);
/**
* 批量删除
* @param ids
* @return
* @author ycw
* @date: 2020年4月21日 下午5:27:24
*/
boolean batchDelete(List<String> ids);
/**
* 后台分页查询
* @param form
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.zrqx.core.client.order.bg.OrderClient;
import com.zrqx.core.client.vo.ImportLabelVo;
import com.zrqx.core.enums.AllResourceTypeEnum;
import com.zrqx.core.enums.GoodsTypeEnum;
......@@ -25,22 +26,37 @@ import com.zrqx.core.util.excelutil.ImportResult;
import com.zrqx.core.util.excelutil.ImportUtil;
import com.zrqx.core.util.page.PageInfo;
import com.zrqx.core.util.page.PageParam;
import com.zrqx.resource.bg.mapper.ResourceRelationMapper;
import com.zrqx.resource.bg.mapper.articlelibrary.ArticleLibraryMapper;
import com.zrqx.resource.bg.mapper.articlelibrary.ChapterLibraryMapper;
import com.zrqx.resource.bg.mapper.ebook.BookMapper;
import com.zrqx.resource.bg.mapper.ebook.EbookDiyTypeMapper;
import com.zrqx.resource.bg.mapper.ebook.EbookLabelContentDiyTypeMapper;
import com.zrqx.resource.bg.mapper.ebook.EbookMapper;
import com.zrqx.resource.bg.mapper.marketing.PromotionContentMapper;
import com.zrqx.resource.bg.mapper.membercollection.MemberCollectionMapper;
import com.zrqx.resource.bg.mapper.recommend.RecommendResourceMapper;
import com.zrqx.resource.bg.mapper.record.RecordMapper;
import com.zrqx.resource.bg.mapper.shoppingcart.ShoppingCartMapper;
import com.zrqx.resource.commons.form.bg.QueryResourceForPoPForm;
import com.zrqx.resource.commons.form.bg.ebook.QueryEbookInfoForm;
import com.zrqx.resource.commons.form.bg.ebook.SaveEbookForm;
import com.zrqx.resource.commons.form.bg.ebook.SaveUpdateEbookForm;
import com.zrqx.resource.commons.model.articlelibrary.ChapterLibrary;
import com.zrqx.resource.commons.model.ebook.Book;
import com.zrqx.resource.commons.model.ebook.Ebook;
import com.zrqx.resource.commons.model.ebook.EbookDiyType;
import com.zrqx.resource.commons.model.ebook.EbookLabelContentDiyType;
import com.zrqx.resource.commons.model.membercollection.MemberCollection;
import com.zrqx.resource.commons.model.record.Record;
import com.zrqx.resource.commons.model.resourcerelation.ResourceRelation;
import com.zrqx.resource.commons.model.shoppingcart.ShoppingCart;
import com.zrqx.resource.commons.vo.bg.ebook.EbookListVO;
import com.zrqx.resource.commons.vo.bg.ebook.ExcelBookExportVo;
import com.zrqx.resource.commons.vo.bg.ebook.ExcelEbookImportVo;
import tk.mybatis.mapper.entity.Example;
/**
* 电子书-serviceimpl
*
......@@ -59,6 +75,24 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
@Autowired
private EbookLabelContentDiyTypeMapper ebookLabelDiyTypeMapper;
@Autowired
private ChapterLibraryMapper chapterLibraryMapper;
@Autowired
private RecommendResourceMapper recommendResourceMapper;
@Autowired
private PromotionContentMapper promotionContentMapper;
@Autowired
private ResourceRelationMapper resourceRelationMapper;
@Autowired
private ArticleLibraryMapper articleLibraryMapper;
@Autowired
private OrderClient orderClient;
@Autowired
private MemberCollectionMapper memberCollectionMapper;
@Autowired
private RecordMapper recordMapper;
@Autowired
private ShoppingCartMapper shoppingCartMapper;
@Autowired
private ImportUtil importUtil;
@Override
......@@ -113,52 +147,33 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
if(PriceOptionEnum.STATUS_0.getCode().equals(ebook.getPriceOption())){
ebook.setRealPrice(new BigDecimal(0));
}
// 默认电子书
Integer bookType = 1;
ebook.setBookType(1);
if (book.getId() == null) {
Integer bookType = ebook.getBookType();
String epubFile = ebook.getEpubFile();
String pdfFile = ebook.getPdfFile();
if((bookType.equals(0) || bookType.equals(1)) && ((epubFile == null) && (pdfFile == null))){
if((bookType.equals(0) || bookType.equals(1)) && ((StringUtils.isBlank(ebook.getEpubFile())) && (StringUtils.isBlank(ebook.getPdfFile())))){
throw new BaseException("请添加相关PDF资源");
}
book.setResourceType(AllResourceTypeEnum.BOOK.getCode());
book.setSalesNum(0);
bookMapper.insertSelective(book);
ebook.setId(book.getId());
ebook.setBookStatus(EbookStatusEnum._5.getCode()); // 默认已下架
ebook.setUploadTime(new Date());
ebook.setOffShelvesTime(new Date());
ebook.setBrowseNum(50); //浏览量
ebook.setGoodsType(GoodsTypeEnum.EBOOK.getCode());
ebookMapper.insertSelective(ebook);
} else {
Ebook e = ebookMapper.selectByPrimaryKey(book.getId());
Integer bookType = ebook.getBookType();
String epubFile = e.getEpubFile();
String pdfFile = e.getPdfFile();
if((bookType.equals(0) || bookType.equals(1)) && ((epubFile == null) && (pdfFile == null))){
//Ebook e = ebookMapper.selectByPrimaryKey(book.getId());
if((bookType.equals(0) || bookType.equals(1)) && ((StringUtils.isBlank(ebook.getEpubFile())) && (StringUtils.isBlank(ebook.getPdfFile())))){
throw new BaseException("请添加相关epub资源或者PDF资源");
}
bookMapper.updateByPrimaryKeySelective(book);
ebook.setUpdateTime(new Date());
ebookMapper.updateByPrimaryKeySelective(ebook);
if(form.getPrice() == null){
Ebook a = ebookMapper.selectByPrimaryKey(ebook.getId());
a.setPrice(form.getPrice());
ebookMapper.updateByPrimaryKey(a);
}
if(form.getEntityPrice() == null){
Ebook a = ebookMapper.selectByPrimaryKey(ebook.getId());
a.setEntityPrice(form.getEntityPrice());
ebookMapper.updateByPrimaryKey(a);
}
if(form.getRealPrice() == null){
Ebook a = ebookMapper.selectByPrimaryKey(ebook.getId());
a.setRealPrice(form.getRealPrice());
ebookMapper.updateByPrimaryKey(a);
}
if(form.getEntityRealPrice() == null){
Ebook a = ebookMapper.selectByPrimaryKey(ebook.getId());
a.setEntityRealPrice(form.getEntityRealPrice());
ebookMapper.updateByPrimaryKey(a);
}
// 修改其他信息
this.updateOtherInfo(form);
// 删除原有关系表中的关系
EbookDiyType ebdt = new EbookDiyType();
ebdt.setEbookId(ebook.getId());
......@@ -187,14 +202,67 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
@Override
public boolean batchInsert(SaveEbookForm form) {
return false;
// TODO Auto-generated method stub
return false;
}
@Override
public boolean batchDelete(List<String> ids) {
Example example = new Example(Ebook.class);
example.createCriteria().andIn("id", ids);
ebookMapper.deleteByExample(example);
example = new Example(Book.class);
example.createCriteria().andIn("id", ids);
bookMapper.deleteByExample(example);
// ----目录
example = new Example(ChapterLibrary.class);
example.createCriteria().andIn("bookid", ids);
chapterLibraryMapper.deleteByExample(example);
// ----自定义分类
example = new Example(EbookDiyType.class);
example.createCriteria().andIn("ebookId", ids);
ebookDiyTypeMapper.deleteByExample(example);
// ----自定义标签
example = new Example(EbookLabelContentDiyType.class);
example.createCriteria().andIn("ebookId", ids);
ebookLabelDiyTypeMapper.deleteByExample(example);
// 这里需要级联删除其他接口关联资源
// ----推荐位内容
recommendResourceMapper.delectByResourceIds(ids, AllResourceTypeEnum.BOOK.getCode());
// ----促销活动
promotionContentMapper.delectByResourceIds(ids, AllResourceTypeEnum.BOOK.getCode());
// ----关联资源
example = new Example(ResourceRelation.class);
example.createCriteria().andIn("objectId", ids).orIn("resourceId", ids);
resourceRelationMapper.deleteByExample(example);
//删除资源订单相关信息
orderClient.deleteOrder(ids);
//删除资源收藏相关信息
example = new Example(MemberCollection.class);
example.createCriteria().andIn("objectId", ids);
memberCollectionMapper.deleteByExample(example);
//删除资源购物车相关信息
example = new Example(ShoppingCart.class);
example.createCriteria().andIn("goodsId", ids);
shoppingCartMapper.deleteByExample(example);
//删除资源浏览记录相关信息
example = new Example(Record.class);
example.createCriteria().andIn("goodsId", ids);
recordMapper.deleteByExample(example);
return true;
}
@Override
public PageInfo<EbookListVO> page(QueryEbookInfoForm form, PageParam pageParam) {
if (null != pageParam && StringUtils.isBlank(pageParam.getOrderBy())) {
pageParam.setOrderBy("uploadTime desc");
}
startPage(pageParam);
List<EbookListVO> list = ebookMapper.page(form);
list.stream().forEach( li -> li.setStatus_zh(EbookStatusEnum.getName(Integer.parseInt(li.getBookStatus()))));
return new PageInfo<EbookListVO>(list);
}
......@@ -219,6 +287,31 @@ public class EbookServiceImpl extends BaseServiceImpl<Ebook, String> implements
return 1;
}
/**
* 更新信息
* @param form
* @author ycw
* @date: 2020年4月21日 下午4:25:45
*/
private void updateOtherInfo(SaveUpdateEbookForm form){
Ebook eb = ebookMapper.selectByPrimaryKey(form.getId());
Book b = bookMapper.selectByPrimaryKey(form.getId());
if(form.getPrice() == null){
eb.setPrice(null);
}
if(form.getRealPrice() == null){
eb.setRealPrice(null);
}
if(StringUtils.isBlank(form.getAuthorId())){
b.setAuthorId(null);
}
if(StringUtils.isBlank(form.getTranslatorId())){
b.setTranslatorId(null);
}
ebookMapper.updateByPrimaryKey(eb);
bookMapper.updateByPrimaryKey(b);
}
/**
* 导入元数据
......
......@@ -47,7 +47,7 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
/**
* 保存或修改专题库
*/
@Override
/*@Override
public boolean saveOrUpdate(SaveUpdateProjectLibraryForm form) {
ProjectLibrary entity = new ProjectLibrary();
if(StringUtils.isNotBlank(form.getAuthorNameAndId())){
......@@ -73,13 +73,13 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
return true;
}
/**
*//**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
*//*
@Override
public boolean batchDelete(List<String> ids) {
if (ids.size() == 0) {
......@@ -104,9 +104,9 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
return true;
}
/**
*//**
* 分页查询专题库
*/
*//*
@Override
public PageInfo<ProjectLibraryListVO> page(QueryProjectLibraryForm form,
PageParam pageParam) {
......@@ -118,9 +118,9 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
return new PageInfo<ProjectLibraryListVO>(list);
}
/**
*//**
* 关联资源选择弹框
*/
*//*
@Override
public PageInfo<ProjectLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam){
startPage(pageParam);
......@@ -131,5 +131,5 @@ public class ProjectLibrarySerivceImpl extends BaseServiceImpl<ProjectLibrary,St
}
}
return new PageInfo<ProjectLibraryListVO>(list);
}
}*/
}
......@@ -20,32 +20,32 @@ public interface ProjectLibraryService extends BaseService<ProjectLibrary,String
* @param form
* @return
*/
boolean saveOrUpdate(SaveUpdateProjectLibraryForm form);
/*boolean saveOrUpdate(SaveUpdateProjectLibraryForm form);
/**
*//**
* 批量删除
* @param ids
* @return
* @author yzg
* @date: 2018年11月22日 下午2:39:23
*/
*//*
boolean batchDelete(List<String> ids);
/**
*//**
* 分页查询专题库
* @param form
* @param pageParam
* @return
*/
*//*
PageInfo<ProjectLibraryListVO> page(QueryProjectLibraryForm form, PageParam pageParam);
/**
*//**
* 选择弹窗中的列表
* @param form
* @param pageParam
* @return
* @author ycw
* @date: 2019年1月3日 下午7:12:29
*/
PageInfo<ProjectLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);
*//*
PageInfo<ProjectLibraryListVO> pageByTitleAndDiyType(QueryResourceForPoPForm form, PageParam pageParam);*/
}
......@@ -33,8 +33,4 @@ public class QueryEbookInfoForm {
private List<Integer> diyTypeId;
@ApiModelProperty("自定义分类code")
private String diyTypeCode;
@ApiModelProperty("1包含实体书")
private Integer isContainEntity;
@ApiModelProperty("0全部1电子书2实体书")
private Integer bookType;
}
......@@ -52,16 +52,6 @@ public class SaveUpdateEbookForm {
private String printNo;
@ApiModelProperty("印张")
private String printCount;
@ApiModelProperty("CIP")
private String CIP;
@ApiModelProperty("关于作者")
private String aboutAuthor;
@ApiModelProperty("版权期限开始")
private String copyrightTermBegin;
@ApiModelProperty("版权期限结束")
private String copyrightTerm;
@ApiModelProperty("邮编")
private String zipCode;
@ApiModelProperty("书刊类型 0外版书 1本版书")
private Integer type;
@ApiModelProperty("销售状态 0 不可售 1 可售")
......@@ -69,15 +59,13 @@ public class SaveUpdateEbookForm {
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("电子书封面")
private String bookCover;
@ApiModelProperty("上下架状态 0:录入中 1:待审核 2:审核中 3:审核不通过 4:已上架 5:已下架")
private Integer bookStatus;
private String img;
@ApiModelProperty("pdfId")
private String pdfId;
@ApiModelProperty("pdf文件")
private String pdfFile;
@ApiModelProperty("内容简介")
private String summary;
private String synopsis;
@ApiModelProperty("图书目录")
private String bookCatalog;
@ApiModelProperty("定价 元 在前台展示为划线价格")
......@@ -86,22 +74,12 @@ public class SaveUpdateEbookForm {
private Integer priceOption;
@ApiModelProperty("售价 元")
private BigDecimal realPrice;
@ApiModelProperty("是否包含实体书")
private Integer isContainEntity;
@ApiModelProperty("实体书售价(元)")
private BigDecimal entityRealPrice;
@ApiModelProperty("实体书定价(元)")
private BigDecimal entityPrice;
@ApiModelProperty("0全部1电子书2实体书")
private Integer bookType;
@ApiModelProperty("分类id")
private List<EbookDiyType> diyType;
@ApiModelProperty("标签id")
private List<EbookLabelContentDiyType> label;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty("pdf名称")
private String pdfName;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
......
......@@ -18,6 +18,8 @@ public class UpdateEbookForm {
private Integer status;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("定价 元")
private BigDecimal price;
@ApiModelProperty("售价 元")
private BigDecimal realPrice;
@ApiModelProperty(value = "分类id")
......
......@@ -78,13 +78,13 @@ public class Book {
private Integer type;
@ApiModelProperty("销售状态 0 不可售 1 可售")
private Integer status;
@ApiModelProperty("民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族")
private Integer nationsType;
@ApiModelProperty("编者,主编等")
private String editor;
@ApiModelProperty(value = "销量")
private Integer salesNum;
@ApiModelProperty(value = "纸质书购买地址")
private Integer purchaseAddress;
@ApiModelProperty(value = "资源类型")
private Integer resourceType;
}
......@@ -28,8 +28,6 @@ public class Ebook {
private String keywords;
@ApiModelProperty("电子书封面")
private String bookCover;
@ApiModelProperty("图书名称")
private String name;
@ApiModelProperty("上下架状态 0:录入中 1:待审核 2:审核中 3:审核不通过 4:已上架 5:已下架")
private Integer bookStatus;
......@@ -46,7 +44,7 @@ public class Ebook {
private String pdfFile;
@ApiModelProperty("内容简介")
private String summary;
private String synopsis;
@ApiModelProperty("图书目录")
private String bookCatalog;
......
......@@ -17,7 +17,7 @@ public class AboutListVO {
@ApiModelProperty("资源名称")
private String name;
@ApiModelProperty("电子书封面")
private String bookCover;
private String img;
@ApiModelProperty("内容简介")
private String summary;
private String synopsis;
}
......@@ -14,15 +14,13 @@ public class EbookListVO {
@ApiModelProperty(value = "电子书名")
private String name;
@ApiModelProperty(value = "电子书封面")
private String bookCover;
private String img;
@ApiModelProperty("作者")
private String author;
@ApiModelProperty("ISBN")
private String isbn;
@ApiModelProperty("售价")
private String realPrice;
@ApiModelProperty("实体书售价")
private String entityRealPrice;
@ApiModelProperty("上传时间")
private Date uploadTime;
@ApiModelProperty("更新时间")
......@@ -31,8 +29,4 @@ public class EbookListVO {
private String bookStatus;
@ApiModelProperty("电子书状态 0:录入中 1:待审核 2:审核中 3:审核不通过 4:已上架 5:已下架")
private String status_zh;
@ApiModelProperty("版权期限")
private String copyrightTerm;
@ApiModelProperty("版权期限开始")
private String copyrightTermBegin;
}
......@@ -29,8 +29,6 @@ public class EbookVO {
private String translator;
@ApiModelProperty("isbn")
private String isbn;
@ApiModelProperty("编号")
private String bookNo;
@ApiModelProperty("所属丛书")
private String bookSeries;
@ApiModelProperty("责任编辑")
......@@ -48,25 +46,11 @@ public class EbookVO {
@ApiModelProperty("字数")
private Integer fontCount;
@ApiModelProperty("封面")
private String bookCover;
private String img;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("中图分类")
private String midpicid;
@ApiModelProperty("版权期限开始")
private String copyrightTermBegin;
@ApiModelProperty("版权期限结束")
private String copyrightTerm;
@ApiModelProperty("印次")
private String printNo;
@ApiModelProperty("印张")
private String printCount;
@ApiModelProperty("CIP")
private String CIP;
@ApiModelProperty("关于作者")
private String aboutAuthor;
@ApiModelProperty("邮编")
private String zipCode;
@ApiModelProperty(value = "分类id")
private List<EbookDiyType> diyType;
......@@ -75,7 +59,7 @@ public class EbookVO {
@ApiModelProperty(value = "标签内容id")
private List<Integer> labelContentDiyTypeIds;
@ApiModelProperty("内容简介")
private String summary;
private String synopsis;
@ApiModelProperty("图书目录")
private String bookCatalog;
@ApiModelProperty("pdf文件")
......@@ -88,23 +72,15 @@ public class EbookVO {
private String realPrice;
@ApiModelProperty("售价选项 0 免费,1收费")
private Integer priceOption;
@ApiModelProperty("是否包含实体书")
private Integer isContainEntity;
@ApiModelProperty("实体书售价(元)")
private String entityRealPrice;
@ApiModelProperty("实体书定价(元)")
private String entityPrice;
@ApiModelProperty("0全部1电子书2实体书")
private Integer bookType;
@ApiModelProperty("书刊类型 0外版书 1本版书")
private Integer type;
@ApiModelProperty("销售状态 0 不可售 1 可售")
private Integer status;
@ApiModelProperty(value = "epub文件名称")
private String fileName;
@ApiModelProperty("pdf名称")
private String pdfName;
@ApiModelProperty(value = "pdf原始名")
private String pdf_zh;
@ApiModelProperty(value = "关联目录章节")
private List<ChapterLibrary> chapterList;
@ApiModelProperty(value = "作者名称和id(用,隔开)")
......
......@@ -270,9 +270,9 @@ public class FgEbookController {
@ApiOperation(value = "图书相关资源", notes = "查询图书相关资源")
@GetMapping(value = "/relation-resource/{oid}")
public CallBack<List<FgAboutListVo>> queryByRelation(@PathVariable String oid){
Ebook ebook = ebookservice.selectByPrimaryKey(oid);
Book book = bookservice.selectByPrimaryKey(oid);
// 相关资源
String guanjianzi = ebook.getName();
String guanjianzi = book.getName();
List<FgAboutListVo> xglist= new ArrayList<FgAboutListVo>();
if(guanjianzi==null || guanjianzi.equals("")){
//title查询结果list
......
......@@ -357,13 +357,13 @@ public class FgResourceLibraryController {
}
}
//专题
if(AllResourceTypeEnum.PROJECT.getCode().equals(form.getResourceType())){
/*if(AllResourceTypeEnum.PROJECT.getCode().equals(form.getResourceType())){
ProjectLibrary entity = projectLibraryService.selectByPrimaryKey(form.getResourceId());
if(entity != null){
resourceType = entity.getResourceType();
query.setSort("browseNum", ORDER.desc);
}
}
}*/
// 相关资源
List<FgAboutListVo> xglist= new ArrayList<FgAboutListVo>();
......@@ -777,7 +777,7 @@ public class FgResourceLibraryController {
Ebook ebook = ebookService.selectByPrimaryKey(id);
vo.setAuthor(book.getAuthor());
vo.setAuthorId(book.getAuthorId());
vo.setSummary(removeLabel(ebook.getSummary()));
vo.setSummary(removeLabel(ebook.getSynopsis()));
vo.setCover(ebook.getBookCover());
return CallBack.success(vo);
}
......@@ -1462,7 +1462,7 @@ public class FgResourceLibraryController {
reslist.add(resultMap);
}
//专题
if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.PROJECT.getCode())){
/*if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.PROJECT.getCode())){
//存储每个高亮处理后的结果
Map<String, Object> resultMap = new HashMap<String, Object>();
//查询结果的id,存入map
......@@ -1486,7 +1486,7 @@ public class FgResourceLibraryController {
}
}
reslist.add(resultMap);
}
}*/
//课程
if(solrDocument.get("resourceType").equals(AllResourceTypeEnum.COURSE.getCode())){
//存储每个高亮处理后的结果
......
......@@ -187,18 +187,18 @@ public class FgResourceRelationServiceImpl extends BaseServiceImpl<ResourceRelat
e.setResourceType_zh(RelationResourceTypeEnum.YIJIA.getName());*/
}
}
if (e.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())) {
/*if (e.getResourceType().equals(AllResourceTypeEnum.PROJECT.getCode())) {
ProjectLibrary sc = projectLibraryMapper.selectByPrimaryKey(e.getResourceId());
if (sc != null) {
e.setName(sc.getName());
e.setCover(sc.getCover());
e.setAuthor(sc.getAuthor());
/*if(StringUtils.isNotBlank(sc.getSynopsis())){
if(StringUtils.isNotBlank(sc.getSynopsis())){
e.setSynopsis(sc.getSynopsis().replaceAll("\\<.*?>", ""));
}
e.setResourceType_zh(RelationResourceTypeEnum.YIJIA.getName());*/
e.setResourceType_zh(RelationResourceTypeEnum.YIJIA.getName());
}
}
}*/
}
});
return list;
......
......@@ -205,7 +205,7 @@ public class FgAuthorLibraryServiceImpl extends BaseServiceImpl<AuthorLibrary, S
BeanUtils.copyProperties(book, aboutListVO);
Ebook ebook = ebookMapper.selectByPrimaryKey(resource.getResourceId());
BeanUtils.copyProperties(ebook, aboutListVO);
aboutListVO.setSummary(ebook.getSummary() == null ? "" : ebook.getSummary().replaceAll("\\<.*?>", ""));
aboutListVO.setSynopsis(StringUtils.isBlank(ebook.getSynopsis()) ? "" : ebook.getSynopsis().replaceAll("\\<.*?>", ""));
list.add(aboutListVO);
}
if(resource.getResourceType() == AllResourceTypeEnum.ARTICLE.getCode()){
......
......@@ -151,7 +151,7 @@ public class FgRecordServiceImpl extends BaseServiceImpl<Record, Integer>
if(book != null){
vo.setName(book.getName());
vo.setImg(ebook.getBookCover());
vo.setText(ebook.getSummary());
vo.setText(ebook.getSynopsis());
vo.setAuthor(book.getAuthor());
vo.setAuthorId(book.getAuthorId());
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论