Commit 36067bde authored by suhuiguang's avatar suhuiguang

1.使用登记单据变更功能,增加详情页面控制按钮权限字段,控制当前人是否有修改的权限,当有权限且满足后续无业务发生时,页面才显示编辑设备按钮

parent 329e44f5
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.GroupModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import lombok.extern.slf4j.Slf4j;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List;
@Slf4j
public class FillingEditPermForCurrentUser extends BaseUseRegisterResultData {
public FillingEditPermForCurrentUser(JSONObject data) {
super(data);
}
@Override
public JSONObject getData() {
JSONObject data = super.getData();
fillingEditPermission(data);
return data;
}
private void fillingEditPermission(JSONObject jsonObject) {
String HAS_PERMISSION = "hasPermission";
jsonObject.put(HAS_PERMISSION, false);
// 当前登录人所在用户组
List<GroupModel> groupModels = FeignUtil.remoteCall(() -> Privilege.groupClient.queryByUserId(RequestContext.getExeUserId()));
// 有权限编辑设备的用户组(value为用户组名称)
List<DictionarieValueModel> hasPermGroup = FeignUtil.remoteCall(() -> Systemctl.dictionarieClient.dictValues("USE_REG_PERMISSION_GROUP"));
if (groupModels.stream().anyMatch(g -> hasPermGroup.stream().anyMatch(h -> h.getDictDataValue().equals(g.getGroupName())))) {
jsonObject.put(HAS_PERMISSION, true);
}
}
}
......@@ -1761,7 +1761,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 转化 附件 字段
commonServiceImpl.convertStringToJsonobject(jsonObject, jsonFields);
// 结果增强,填充单据是否可变更设备状态,用来控制前端按钮的显示隐藏。
return new FillingUseRegisterResult(sequenceNbr, jsonObject, applicationContext).getData();
new FillingUseRegisterResult(sequenceNbr, jsonObject, applicationContext).getData();
// 结果增强,填充当前人是否有编辑按钮权限
new FillingEditPermForCurrentUser(jsonObject).getData();
return jsonObject;
}
// 基本信息 + 制造信息
Map<String, Object> detail = this.baseMapper.getDetail(record);
......@@ -1809,7 +1812,10 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
JSONObject result = new JSONObject();
result.putAll(detail);
// 结果增强,填充单据是否可变更设备状态
return new DefaultUseRegisterResult(result).getData();
new DefaultUseRegisterResult(result).getData();
// 结果增强,填充当前人是否有编辑按钮权限
new FillingEditPermForCurrentUser(result).getData();
return result;
}
......
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