Commit be44504f authored by liqin's avatar liqin 💬

bug fixed

parent 32c7bdbd
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -30,18 +25,16 @@ import java.io.Serializable;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("exhibition_board_tmp")
@ApiModel(value = "展板临时", description = "展板临时")
public class ExhibitionBoardTmp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("展板内容ID")
@ApiModelProperty(hidden = true)
@TableId(value = "id", type = IdType.INPUT)
@NotNull(message = "展板内容ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(hidden = true)
@TableField("data")
@NotBlank(message = "不能为空", groups = {Add.class, Update.class})
private String data;
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -30,18 +25,16 @@ import java.io.Serializable;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("learning_content_tmp")
@ApiModel(value = "学习内容临时", description = "学习内容临时")
public class LearningContentTmp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("学习内容ID")
@ApiModelProperty(hidden = true)
@TableId(value = "id", type = IdType.INPUT)
@NotNull(message = "学习内容ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(hidden = true)
@TableField("data")
@NotBlank(message = "不能为空", groups = {Add.class, Update.class})
private String data;
}
package cn.wisenergy.chnmuseum.party.model;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
......@@ -30,18 +25,16 @@ import java.io.Serializable;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("video_content_tmp")
@ApiModel(value = "视频内容临时", description = "视频内容临时")
public class VideoContentTmp implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("视频内容ID")
@ApiModelProperty(hidden = true)
@TableId(value = "id", type = IdType.INPUT)
@NotNull(message = "视频内容ID不能为空", groups = {Update.class})
private String id;
@ApiModelProperty(hidden = true)
@TableField("data")
@NotBlank(message = "不能为空", groups = {Add.class, Update.class})
private String data;
}
......@@ -79,11 +79,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 分页查询
*
* @param name
* @param status
* @param type
* @return
*/
@Override
public Page<Audit> pageList(String name, AuditStatusEnum status, AuditStatusEnum auditStatusLevel, AuditTypeEnum type, Page<Object> page) {
......@@ -104,17 +99,11 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
if (status != null) {
ew.eq(status != null, "a.status", status.name());
}
Page<Audit> pageList = pageByType(ew, name, type, auditPage);
return pageList;
return pageByType(ew, name, type, auditPage);
}
/**
* 分别查询
*
* @param name
* @param type
* @param auditPage
* @return
*/
private Page<Audit> pageByType(QueryWrapper<Audit> ew, String name,
AuditTypeEnum type, Page<Audit> auditPage) {
......@@ -141,9 +130,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 根据id更新审核信息
*
* @param audit
* @return
*/
@Override
public boolean updateAuditAllById(Audit audit) {
......@@ -177,8 +163,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 初审级别的修改情况
*
* @return
*/
private boolean updateOnTBC(Audit audit) {
audit.setFirstTime(LocalDateTime.now());
......@@ -204,8 +188,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 复审级别的修改情况
*
* @return
*/
private boolean updateOnTBCA(Audit audit) {
audit.setSecondTime(LocalDateTime.now());
......@@ -255,9 +237,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 根据审核操作 填充VideoContent属性用于更改
*
* @param audit
* @return
*/
public boolean fillVideoContentByAudit(Audit audit) {
final String videoContentId = audit.getRefItemId();
......@@ -317,6 +296,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.videoContentService.updateById(one);
this.videoContentTmpService.removeById(videoContentId);
break;
default:
}
......@@ -325,9 +305,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 根据审核操作 填充ExhibitionBoard属性用于更改
*
* @param audit
* @return
*/
public boolean fillExhibitionBoardByAudit(Audit audit) {
final String exhibitionBoardId = audit.getRefItemId();
......@@ -396,6 +373,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.exhibitionBoardService.updateById(one);
this.exhibitionBoardTmpService.removeById(exhibitionBoardId);
break;
default:
}
......@@ -404,9 +382,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
/**
* 根据审核操作 填充LearningContent属性用于更改
*
* @param audit
* @return
*/
public boolean fillLearningContentByAudit(Audit audit) {
final String learningContentId = audit.getRefItemId();
......@@ -477,6 +452,7 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
one.setAuditStatus(audit.getStatus());
one.setPublished(true); //todo
update = this.learningContentService.updateById(one);
this.learningContentTmpService.removeById(learningContentId);
break;
default:
}
......@@ -490,7 +466,6 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
* @param content 审核内容
* @param typeEnum 审核类型
* @param operationEnum 操作类型
* @return
*/
@Override
public boolean saveByRefItemInfo(String refItemId, String content, AuditTypeEnum typeEnum, AuditOperationEnum operationEnum) {
......
......@@ -119,13 +119,14 @@ public class ExhibitionBoardController extends BaseController {
public Map<String, Object> updateExhibitionBoard(@Validated(value = {Update.class}) ExhibitionBoard exhibitionBoard) {
final boolean flag = this.exhibitionBoardTmpService.save(ExhibitionBoardTmp.builder().id(exhibitionBoard.getId()).data(JSONObject.toJSONString(exhibitionBoard)).build());
if (flag) {
TUser user = getcurUser();
exhibitionBoard.setAuditStatus(AuditStatusEnum.TBC.name());
exhibitionBoardService.updateById(exhibitionBoard);
final ExhibitionBoard one = this.exhibitionBoardService.getById(exhibitionBoard.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.exhibitionBoardService.updateById(one);
final Audit audit = Audit.builder()
.content(exhibitionBoard.getName())
.refItemId(exhibitionBoard.getId())
.userId(user.getId())
.userId(getcurUser().getId())
.type(AuditTypeEnum.EXHIBITION_BOARD.name())
.operation(AuditOperationEnum.EDIT.name())
.status(AuditStatusEnum.TBC.name())
......@@ -135,7 +136,7 @@ public class ExhibitionBoardController extends BaseController {
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult();
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
}
@PostMapping("/getList")
......
......@@ -13,9 +13,9 @@ import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -49,24 +49,37 @@ public class LearningContentController extends BaseController {
@Resource
private ExhibitionBoardCatService exhibitionBoardCatService;
@Resource
private VideoContentService videoContentService;
@Resource
private CopyrightOwnerService copyrightOwnerService;
@Resource
private LearningContentService learningContentService;
@Resource
private LearningContentTmpService learningContentTmpService;
@Resource
private LearningContentBoardCatService learningContentBoardCatService;
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningProjectService learningProjectService;
@Resource
private AuditService auditService;
@Resource
private AssetService assetService;
......@@ -148,53 +161,15 @@ public class LearningContentController extends BaseController {
@ApiOperation(value = "修改学习内容信息", notes = "修改学习内容信息")
@MethodLog(operModule = OperModule.LEARNCONTENT, operType = OperType.UPDATE)
public Map<String, Object> updateLearningContent(@Validated(value = {Update.class}) LearningContent learningContent) {
TUser user = getcurUser();
learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
// 保存业务节点信息
final String learningContentId = learningContent.getId();
final List<String> exhibitionBoardCatIdList = learningContent.getExhibitionBoardCatIdList();
if (exhibitionBoardCatIdList != null && !exhibitionBoardCatIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoardCat> lambdaUpdateWrapper = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getLearningContentId, learningContentId);
this.learningContentBoardCatService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardCatId : exhibitionBoardCatIdList) {
LearningContentBoardCat learningContentBoardCat = LearningContentBoardCat.builder().exhibitionBoardCatId(exhibitionBoardCatId).learningContentId(learningContentId).build();
this.learningContentBoardCatService.save(learningContentBoardCat);
}
}
final List<String> copyrightOwnerIdList = learningContent.getCopyrightOwnerIdList();
if (copyrightOwnerIdList != null && !copyrightOwnerIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentCopyrightOwner> lambdaUpdateWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getLearningContentId, learningContentId);
this.learningContentCopyrightOwnerService.remove(lambdaUpdateWrapper);
for (String copyrightOwnerId : copyrightOwnerIdList) {
LearningContentCopyrightOwner contentCopyrightOwner = LearningContentCopyrightOwner.builder().copyrightOwnerId(copyrightOwnerId).learningContentId(learningContentId).build();
this.learningContentCopyrightOwnerService.save(contentCopyrightOwner);
}
}
final List<String> exhibitionBoardIdList = learningContent.getExhibitionBoardIdList();
if (exhibitionBoardIdList != null && !exhibitionBoardIdList.isEmpty()) {
LambdaUpdateWrapper<LearningContentBoard> lambdaUpdateWrapper = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getLearningContentId, learningContentId);
this.learningContentBoardService.remove(lambdaUpdateWrapper);
for (String exhibitionBoardId : exhibitionBoardIdList) {
LearningContentBoard learningContentBoard = LearningContentBoard.builder()
.learningContentId(learningContentId)
.exhibitionBoardCatId(this.exhibitionBoardService.getById(exhibitionBoardId).getExhibitionBoardCatId())
.exhibitionBoardId(exhibitionBoardId)
.build();
this.learningContentBoardService.save(learningContentBoard);
}
}
boolean flag = learningContentService.updateById(learningContent);
final boolean flag = this.learningContentTmpService.save(LearningContentTmp.builder().id(learningContent.getId()).data(JSONObject.toJSONString(learningContent)).build());
if (flag) {
final LearningContent one = this.learningContentService.getById(learningContent.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.learningContentService.updateById(one);
final Audit audit = Audit.builder()
.content(learningContent.getName())
.userId(user.getId())
.userId(getcurUser().getId())
.refItemId(learningContent.getId())
.type(AuditTypeEnum.LEARNING_CONTENT.name())
.operation(AuditOperationEnum.EDIT.name())
......@@ -203,10 +178,9 @@ public class LearningContentController extends BaseController {
.level(AuditStatusEnum.TBC.name())
.build();
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult();
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
}
@GetMapping("/getList")
......
......@@ -112,12 +112,13 @@ public class VideoContentController extends BaseController {
public Map<String, Object> updateVideoContent(@Validated(value = {Update.class}) VideoContent videoContent) {
final boolean flag = this.videoContentTmpService.save(VideoContentTmp.builder().id(videoContent.getId()).data(JSONObject.toJSONString(videoContent)).build());
if (flag) {
TUser user = getcurUser();
videoContent.setAuditStatus(AuditStatusEnum.TBC.name());
videoContentService.updateById(videoContent);
final VideoContent one = this.videoContentService.getById(videoContent.getId());
one.setAuditStatus(AuditStatusEnum.TBC.name());
this.videoContentService.updateById(one);
final Audit audit = Audit.builder()
.content(videoContent.getName())
.userId(user.getId())
.userId(getcurUser().getId())
.refItemId(videoContent.getId())
.type(AuditTypeEnum.VIDEO_CONTENT.name())
.operation(AuditOperationEnum.EDIT.name())
......@@ -128,7 +129,7 @@ public class VideoContentController extends BaseController {
this.auditService.save(audit);
return getSuccessResult();
}
return getFailResult();
return getFailResult("提交失败!上次提交的修改申请已经在审核中");
}
@GetMapping("/getExhibitionBoardById/{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