Commit e9ade1a5 by liuyang

2024-09-24

1.文裆库新增目录时可直接选择,保留自定义新增
2.设置用户为管理员可以对所有项目进行授权和发布文件
parent cd6434a7
......@@ -23,6 +23,7 @@ import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
......@@ -204,6 +205,11 @@ public class ServiceHGWD001 extends ServiceEPBase {
strFileName.append("新发布文件名称:").append(String.join(",", changeEnd));
}
}
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
HGWDTools.HgWd003.checkProjectManager(hgwd001.getFileId());
}
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
......@@ -212,11 +218,6 @@ public class ServiceHGWD001 extends ServiceEPBase {
hgwd099.setStatus(HgWdConstant.FileStatus.S_1);
hgwd099.setReleaseDate(DateUtils.shortDateTime());
hgwd099.setOperStatus(HgWdConstant.OperStatus.S_0);
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd099.getBizId());
List hgwd003s = listByFile.stream().map(HGWD003::getUserId).distinct().collect(Collectors.toList());
AssertUtils.isTrue(hgwd003s.size() <= 1, "文件未分配人员,请先分配人员!");
hgwd003s = listByFile.stream().filter(hgwd003 -> hgwd003.getUserId().equals(UserSessionUtils.getUserId()) && hgwd003.getIsProjectManager() == 1).collect(Collectors.toList());
AssertUtils.isEmpty(hgwd003s, "您不是该项目的项目经理管理员,无法发布!");
DaoUtils.update(HgWdSqlConstant.HgWd099.RELEASE_DATE, hgwd099); //发布附件
//添加变更记录
......@@ -417,6 +418,17 @@ public class ServiceHGWD001 extends ServiceEPBase {
return inInfo;
}
public EiInfo queryProjectManager(EiInfo inInfo) {
try {
Map queryRow =EiInfoUtils.getFirstRow(inInfo);
Integer isManager =HGWDTools.HgWd003.isProjectManager(queryRow.get(HGWD001.FIELD_FILE_ID).toString());
inInfo.set("isManager", isManager);
}catch (Exception e){
LogUtils.setMsg(inInfo, e, "查询失败");
}
return inInfo;
}
private static void cleanBaseInfo(HGWD099 hgwd099){
hgwd099.setCreatedBy(null);
hgwd099.setCreatedName(null);
......
......@@ -11,11 +11,13 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
......@@ -135,4 +137,14 @@ public class ServiceHGWD001E extends ServiceEPBase {
DaoUtils.update(HGWD001.UPDATE, hgwd001);
}
public EiInfo queryProductName(EiInfo inInfo){
//EiBlock block = inInfo.getBlock(EiConstant.resultBlock);
//block.set(EiConstant.limitStr,-999999);
inInfo = super.query(inInfo, "HGWD005.queryProductName");
EiBlock productBlock = new EiBlock("product_name_block_id");
productBlock.setRows(inInfo.getBlock(EiConstant.resultBlock).getRows());
inInfo.addBlock(productBlock);
return inInfo;
}
}
......@@ -119,4 +119,14 @@
WHERE ID = #id#
</update>
<!--查询产品名称-->
<select id="queryProductName" resultClass="java.util.HashMap">
SELECT
PRODUCT_NAME as "textField"
FROM ${hggpSchema}.HGWD005
WHERE 1=1
<include refid="condition"/>
group by PRODUCT_NAME
</select>
</sqlMap>
......@@ -15,9 +15,11 @@ import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD005;
import com.baosight.hggp.hg.wd.domain.HGWD009;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.io.IOException;
......@@ -214,6 +216,40 @@ public class HGWDTools {
return dbWd001s.stream().collect(Collectors.groupingBy(HGWD003::getFileId));
}
/** 校验项目管理员
* @param fileId
*/
public static void checkProjectManager(String fileId) {
List<HGWD003> hgwd003List = HGWDTools.HgWd003.listByFile(fileId);
List hgwd003s = hgwd003List.stream().map(HGWD003::getUserId).distinct().collect(Collectors.toList());
AssertUtils.isTrue(hgwd003s.size() <= 1, "文件未分配人员,请先分配人员!");
hgwd003s = hgwd003List.stream().filter(hgwd003 -> hgwd003.getUserId().equals(UserSessionUtils.getUserId()) && hgwd003.getIsProjectManager() == 1).collect(Collectors.toList());
AssertUtils.isEmpty(hgwd003s, "您不是该项目的项目经理管理员,无法发布!");
}
/**
* 查询用户是否拥有权限
*
* @param fileId 文件ID
* @return 0 没有权限 1 是管理员,2 是项目经理,3 设计员
*/
public static Integer isProjectManager(String fileId) {
String userId = UserSessionUtils.getLoginName();
if (HgWdUtils.HgWd009.isManager(userId)) {
return 1;
}
if (StringUtils.isEmpty(fileId)){
return 0;
}
List<HGWD003> hgwd003List = HGWDTools.HgWd003.listByFile(fileId);
List<HGWD003> hgwd003s = hgwd003List.stream().filter(hgwd003 -> hgwd003.getUserId().equals(userId) && hgwd003.getIsProjectManager() == 1).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(hgwd003s)){
return 2;
}
hgwd003s = hgwd003List.stream().filter(hgwd003 -> hgwd003.getUserId().equals(userId)).collect(Collectors.toList());
return !CollectionUtils.isEmpty(hgwd003s) ? 3 : 0;
}
}
/**
......
......@@ -822,7 +822,8 @@ let showAuthButton = function () {
$("#CHANGE_RECORD").attr("disabled", false);
$("#COPY_FILE").attr("disabled", true);
}
let inEiInfo = new EiInfo();
isProjectManager(parentId);
/*let inEiInfo = new EiInfo();
inEiInfo.set("inqu_status-0-fileId", parentId);
inEiInfo.set("inqu_status-0-isProjectManager", "1");
inEiInfo.set("inqu_status-0-userId", $("#inqu_status-0-userId").val());
......@@ -843,7 +844,7 @@ let showAuthButton = function () {
}
}, {
async: false
});
});*/
}
/**
......@@ -924,3 +925,42 @@ let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + fileId;
window.open(url, '_blank');
}
let isProjectManager = function (parentId) {
let inEiInfo = new EiInfo();
inEiInfo.set("inqu_status-0-fileId", parentId);
//inEiInfo.set("inqu_status-0-userId", $("#inqu_status-0-userId").val());
EiCommunicator.send("HGWD001", "queryProjectManager", inEiInfo, {
onSuccess(ei) {
if (ei.status != -1){
switch (ei.extAttr.isManager) {
case 1:
$("#RELEASE").attr("disabled", false);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break;
case 2:
$("#RELEASE").attr("disabled", false);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break;
case 3:
$("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", false);
$("#COPY_FILE").attr("disabled", false);
$("#PREVIEW").attr("disabled", false);
break
default:
$("#RELEASE").attr("disabled", true);
$("#UPLOAD_FILE").attr("disabled", true);
$("#COPY_FILE").attr("disabled", true);
$("#PREVIEW").attr("disabled", true);
}
}
}
}, {
async: false
})
}
\ No newline at end of file
......@@ -63,6 +63,40 @@ $(function () {
}
return dataItem["projCode"];
}
}, {
field:"fileName",
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
var eiblock = new EiBlock("result");
eiblock.set(EiConstant.LIMIT, -999999);
eiblock.set(EiConstant.OFFSET, 0);
eiInfo.addBlock(eiblock);
var dataSource;
EiCommunicator.send("HGWD001E", "queryProductName", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("product_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoAutoComplete({
dataSource: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:valueField#",
template: "#:textField#",
filter: "contains"
});
input.data("kendoAutoComplete").search();
}
}
],
exportGrid: {
......
......@@ -42,6 +42,40 @@ $(function () {
}
return dataItem["companyCode"];
}
}, {
field:"fileName",
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
var eiblock = new EiBlock("result");
eiblock.set(EiConstant.LIMIT, -999999);
eiblock.set(EiConstant.OFFSET, 0);
eiInfo.addBlock(eiblock);
var dataSource;
EiCommunicator.send("HGWD001E", "queryProductName", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("product_name_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
input.kendoAutoComplete({
dataSource: dataSource,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:valueField#",
template: "#:textField#",
filter: "contains"
});
input.data("kendoAutoComplete").search();
}
}
],
exportGrid: {
......
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