|
@@ -3,22 +3,39 @@ package thyyxxk.webserver.service.dashboardEditor;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import thyyxxk.webserver.config.exception.BizException;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.dashboardEditor.DashboardEditorDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.dashboardEditor.TDashboardTemplate;
|
|
|
+import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
+import thyyxxk.webserver.service.PublicServer;
|
|
|
+import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
|
|
|
@Service
|
|
|
@RequiredArgsConstructor
|
|
|
public class DashboardEditorService {
|
|
|
private final DashboardEditorDao dao;
|
|
|
+ private final PublicServer publicServer;
|
|
|
+ private final RedisLikeService redisLikeService;
|
|
|
|
|
|
public ResultVo<TDashboardTemplate> getDashboardTemplateByWardCode(String wardCode) {
|
|
|
return ResultVoUtil.success(dao.selectOne(TDashboardTemplate.lambdaQueryWrapper().eq(TDashboardTemplate::getWardCode, wardCode)));
|
|
|
}
|
|
|
|
|
|
+ public void checkRole(String wardCode) {
|
|
|
+ if (publicServer.needRule(84)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UserInfo info = redisLikeService.getUserInfoByToken();
|
|
|
+ if (!wardCode.equals(info.getDeptCode())) {
|
|
|
+ throw new BizException(ExceptionEnum.ERROR_MESSAGE, "您只能操作自己科室的模板。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public ResultVo<TDashboardTemplate> saveTemplate(TDashboardTemplate param) {
|
|
|
+ checkRole(param.getWardCode());
|
|
|
if (param.getId() == null) {
|
|
|
param.setId(IdUtil.simpleUUID());
|
|
|
dao.insert(param);
|
|
@@ -30,6 +47,7 @@ public class DashboardEditorService {
|
|
|
|
|
|
public ResultVo<String> release(String id) {
|
|
|
TDashboardTemplate tDashboardTemplate = dao.selectById(id);
|
|
|
+ checkRole(tDashboardTemplate.getWardCode());
|
|
|
TDashboardTemplate tmp = TDashboardTemplate.builder()
|
|
|
.htmlData(tDashboardTemplate.getHtmlDataTemp())
|
|
|
.id(tDashboardTemplate.getId())
|