Commit fdea5073 authored by jiawei's avatar jiawei

BUG修改==》》单位管理员创建的学习内容不需要通过审核,直接变成通过

parent 0d271418
......@@ -25,6 +25,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -91,7 +92,14 @@ public class LearningContentController extends BaseController {
if (tUser != null) {
learningContent.setOrganCode(tUser.getOrgCode());
}
learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
//
boolean nonUnitRole = !isUnitRole(tUser);
if (nonUnitRole){
learningContent.setAuditStatus(AuditStatusEnum.TBC.name());
}else {
//是单位管理员直接变成通过
learningContent.setAuditStatus(AuditStatusEnum.APPROVED_FINAL.name());
}
learningContent.setPublished(false);
QueryWrapper<LearningContent> queryWrapper = new QueryWrapper<>();
queryWrapper.select("max(sortorder) as sortorder");
......@@ -136,7 +144,7 @@ public class LearningContentController extends BaseController {
}
// 返回操作结果
if (result) {
if (result && nonUnitRole) {
final Audit audit = Audit.builder()
.content(learningContent.getName())
.name(learningContent.getName())
......@@ -150,12 +158,32 @@ public class LearningContentController extends BaseController {
.build();
this.auditService.save(audit);
return getSuccessResult();
} else if (result) {
return getSuccessResult();
} else {
// 保存失败
return getFailResult();
}
}
/**
* 判断是否为单位管理员
*
* @param tUser
* @return
*/
private boolean isUnitRole(TUser tUser) {
boolean result = false;
if (tUser != null) {
List<String> roleList = tUser.getRoleList();
if (!CollectionUtils.isEmpty(roleList)) {
//单位管理员角色id为2
result = roleList.contains("2");
}
}
return result;
}
@PutMapping("/update")
@RequiresAuthentication //@RequiresPermissions("learning:content:update")
@ApiOperation(value = "修改学习内容信息", notes = "修改学习内容信息")
......
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