Commit 5a7f90cb by 宋祥

1.项目增加设计来源,区分项目类型

parent 9e0e782d
package com.baosight.hggp.hg.sc.constant;
/**
* @author:songx
* @date:2024/8/22,10:09
*/
public class HgScConst {
/**
* 项目管理
*
* @author:songx
* @date:2024/5/7,16:36
*/
public static class HgSc001 {
}
}
package com.baosight.hggp.hg.sc.enums;
/**
* @author:songx
* @date:2024/3/1,17:29
*/
public enum ProjectTypeEnum {
ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "外来制造图"),
OTHER("other", "其他"),
;
/**
* 编码
*/
private String code;
/**
* 名称
*/
private String name;
/**
* code 是否存在
*
* @param code
* @return
*/
public static boolean contains(String code) {
for (ProjectTypeEnum value : values()) {
if (value.getCode().equals(code)) {
return true;
}
}
return false;
}
ProjectTypeEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
......@@ -7,8 +7,10 @@ import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.constant.HgScConst;
import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectTypeEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.EiInfoUtils;
......@@ -157,6 +159,8 @@ public class ServiceHGSC101 extends ServiceEPBase {
dbSc001.setDepName(dbPz009.getAccountName());
dbSc001.setProjCode(projCode);
dbSc001.setProjName(dcContractList.getTitle());
// TODO 默认其他,需要根据智邦的接口返回值确定
dbSc001.setProjType(ProjectTypeEnum.OTHER.getCode());
dbSc001.setContractNo(dcContractList.getHtid());
DaoUtils.insert(HGSC001.INSERT, dbSc001);
} else {
......
......@@ -78,6 +78,7 @@ public class ServiceHGSC101A extends ServiceEPBase {
*/
private void checkData(HGSC001 fSc001) {
AssertUtils.isEmpty(fSc001.getProjName(), "项目名称不能为空!");
AssertUtils.isEmpty(fSc001.getProjType(), "项目类型不能为空!");
}
/**
......
......@@ -324,6 +324,7 @@
COMPANY_CODE = #companyCode#,
COMPANY_NAME = #companyName#,
PROJ_NAME = #projName#,
PROJ_TYPE = #projType#,
<include refid="SqlBase.updateRevise"/>
WHERE PROJ_CODE = #projCode#
</update>
......
......@@ -50,6 +50,9 @@
<isNotEmpty prepend=" AND " property="depName">
dep_name = #depName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="contractNo">
contract_no like concat('%', #contractNo#, '%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
proj_code = #projCode#
</isNotEmpty>
......
......@@ -16,6 +16,8 @@ public class HgWdSqlConstant {
// 根据父节点统计
public static final String COUNT_BY_PARENT = "HGWD001.countByParent";
// 根据类型统计
public static final String COUNT_BY_TYPE = "HGWD001.countByType";
// 搜索树节点
public static final String SEARCH_TREE_NODE = "HGWD001.searchTreeNode";
}
......
......@@ -35,6 +35,7 @@ public class HGWD001 extends DaoEPBase {
public static final String FIELD_COMPANY_NAME = "companyName"; /* 公司名称*/
public static final String FIELD_PROJ_CODE = "projCode"; /* 项目编码*/
public static final String FIELD_PROJ_NAME = "projName"; /* 项目名称*/
public static final String FIELD_PROJ_TYPE = "projType"; /* 项目类型*/
public static final String FIELD_LEAF_LEVEL = "leafLevel"; /* 节点层级*/
public static final String FIELD_PARENT_ID = "parentId"; /* 父级ID*/
public static final String FIELD_FILE_ID = "fileId"; /* 文件ID*/
......@@ -59,6 +60,7 @@ public class HGWD001 extends DaoEPBase {
public static final String COL_COMPANY_NAME = "COMPANY_NAME"; /* 公司名称*/
public static final String COL_PROJ_CODE = "PROJ_CODE"; /* 项目编码*/
public static final String COL_PROJ_NAME = "PROJ_NAME"; /* 项目名称*/
public static final String COL_PROJ_TYPE = "PROJ_TYPE"; /* 项目类型*/
public static final String COL_PARENT_ID = "PARENT_ID"; /* 节点层级*/
public static final String COL_LEAF_LEVEL = "LEAF_LEVEL"; /* 父级ID*/
public static final String COL_FILE_ID = "FILE_ID"; /* 文件ID*/
......@@ -90,6 +92,7 @@ public class HGWD001 extends DaoEPBase {
private String companyName = " "; /* 公司名称*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private String projType = " "; /* 项目类型*/
private Integer leafLevel = new Integer(0);
private String parentId = " ";
private String fileId = " "; /* 文件ID*/
......@@ -162,7 +165,11 @@ public class HGWD001 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_PROJ_NAME);
eiColumn.setDescName("项目名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PROJ_TYPE);
eiColumn.setDescName("项目类型");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_LEAF_LEVEL);
eiColumn.setDescName("节点层级");
eiMetadata.addMeta(eiColumn);
......@@ -433,7 +440,15 @@ public class HGWD001 extends DaoEPBase {
public void setProjName(String projName) {
this.projName = projName;
}
public String getProjType() {
return projType;
}
public void setProjType(String projType) {
this.projType = projType;
}
/**
* get the leafLevel - 层级
* @return 层级
......@@ -598,6 +613,7 @@ public class HGWD001 extends DaoEPBase {
setCompanyName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_COMPANY_NAME)), companyName));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setProjType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_TYPE)), projType));
setLeafLevel(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_LEAF_LEVEL)), leafLevel));
setParentId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PARENT_ID)), parentId));
setFileId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_FILE_ID)), fileId));
......@@ -630,6 +646,7 @@ public class HGWD001 extends DaoEPBase {
map.put(FIELD_COMPANY_NAME, StringUtils.toString(companyName, eiMetadata.getMeta(FIELD_COMPANY_NAME)));
map.put(FIELD_PROJ_CODE, StringUtils.toString(projCode, eiMetadata.getMeta(FIELD_PROJ_CODE)));
map.put(FIELD_PROJ_NAME, StringUtils.toString(projName, eiMetadata.getMeta(FIELD_PROJ_NAME)));
map.put(FIELD_PROJ_TYPE, StringUtils.toString(projType, eiMetadata.getMeta(FIELD_PROJ_TYPE)));
map.put(FIELD_LEAF_LEVEL, StringUtils.toString(leafLevel, eiMetadata.getMeta(FIELD_LEAF_LEVEL)));
map.put(FIELD_PARENT_ID, StringUtils.toString(parentId, eiMetadata.getMeta(FIELD_PARENT_ID)));
map.put(FIELD_FILE_ID, StringUtils.toString(fileId, eiMetadata.getMeta(FIELD_FILE_ID)));
......
......@@ -3,7 +3,9 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectTypeEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
......@@ -214,9 +216,11 @@ public class ServiceHGWD001D extends TreeService {
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node, ename));
inInfo.addBlock(node).setRows(queryTopNode(node));
} else if (ProjectTypeEnum.contains(node)) {
inInfo.addBlock(node).setRows(queryFirstNode(node, ename));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node,ename));
inInfo.addBlock(node).setRows(queryChildNode(node, ename));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
......@@ -229,10 +233,37 @@ public class ServiceHGWD001D extends TreeService {
*
* @return
*/
public List queryTopNode(String parentId,String ename) {
public List queryTopNode(String parentId) {
List<Map> results = new ArrayList();
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projType");
if (CollectionUtils.isEmpty(codesetMaps)) {
return results;
}
for (Map codesetMap : codesetMaps) {
String label = MapUtils.getString(codesetMap, "value");
String text = MapUtils.getString(codesetMap, "label");
Map leafMap = buildLeaf(parentId, label, text, HgWdConstant.LeafType.P);
leafMap.put("type", "-1");
leafMap.put("leafLevel", "-1");
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results, true);
return results;
}
/**
* 查询一级节点
*
* @param parentId
* @param ename
* @return
*/
public List queryFirstNode(String parentId, String ename) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap<>();
queryMap.put("ename", ename);
queryMap.put("projType", parentId);
// 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) {
......@@ -253,7 +284,7 @@ public class ServiceHGWD001D extends TreeService {
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
setTreeNodeLeaf(results, false);
return results;
}
......@@ -263,7 +294,7 @@ public class ServiceHGWD001D extends TreeService {
* @param parentId
* @return
*/
public List queryChildNode(String parentId,String ename) {
public List queryChildNode(String parentId, String ename) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
......@@ -282,7 +313,7 @@ public class ServiceHGWD001D extends TreeService {
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
setTreeNodeLeaf(results, false);
return results;
}
......@@ -290,13 +321,19 @@ public class ServiceHGWD001D extends TreeService {
* 设置叶子节点是否可以展开
*
* @param nodes
* @param isType
*/
private void setTreeNodeLeaf(List<Map> nodes) {
private void setTreeNodeLeaf(List<Map> nodes, boolean isType) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> resultMap = HGWDTools.HgWd001.countByParent(labels);
Map<String, Integer> resultMap = null;
if (isType) {
resultMap = HGWDTools.HgWd001.countByType(labels);
} else {
resultMap = HGWDTools.HgWd001.countByParent(labels);
}
for (Map node : nodes) {
Integer cnt = resultMap == null ? null : resultMap.get(node.get("label"));
node.put("leaf", cnt == null || cnt == 0 ? 1 : 0);
......
......@@ -17,6 +17,7 @@
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
LEAF_LEVEL as "leafLevel", <!--节点层级-->
PARENT_ID as "parentId", <!--父级ID-->
FILE_ID as "fileId", <!-- 文件ID -->
......@@ -156,6 +157,16 @@
GROUP BY PARENT_ID
</select>
<!-- 更具父级节点统计 -->
<select id="countByType" resultClass="java.util.HashMap">
SELECT PROJ_TYPE, COUNT(1) AS CNT
FROM ${hggpSchema}.HGWD001
WHERE 1=1
AND DELETE_FLAG = 0
AND PROJ_TYPE IN <iterate close=")" open="(" conjunction="," property="projTypes">#projTypes[]#</iterate>
GROUP BY PROJ_TYPE
</select>
<!-- 搜索树节点 -->
<select id="searchTreeNode" resultClass="com.baosight.hggp.hg.wd.domain.HGWD001">
SELECT DISTINCT
......@@ -194,6 +205,7 @@
COMPANY_NAME, <!-- 公司名称 -->
PROJ_CODE, <!-- 项目编码 -->
PROJ_NAME, <!-- 项目名称 -->
PROJ_TYPE, <!-- 项目类型 -->
LEAF_LEVEL, <!--节点层级-->
PARENT_ID, <!--父级ID-->
FILE_ID, <!-- 文件ID -->
......@@ -205,8 +217,8 @@
RELEASE_DATE
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#,#leafLevel#,#parentId#,
#fileId#, #fileType#, #fileName#,
#deleteFlag#, #companyCode#, #companyName#, #projCode#, #projName#, #projType#,
#leafLevel#, #parentId#, #fileId#, #fileType#, #fileName#,
#docVersion#, #status#, #remark#, #releaseDate#
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGWD001
......@@ -258,6 +270,7 @@
COMPANY_NAME as "companyName", <!-- 公司名称 -->
PROJ_CODE as "projCode", <!-- 项目编码 -->
PROJ_NAME as "projName", <!-- 项目名称 -->
PROJ_TYPE as "projType", <!-- 项目类型 -->
LEAF_LEVEL as "leafLevel", <!--节点层级-->
PARENT_ID as "pId", <!--父级ID-->
FILE_ID as "fileId", <!-- 文件ID -->
......
......@@ -121,6 +121,24 @@ public class HGWDTools {
}
/**
* 根据类型统计
*
* @param projTypes
* @return
*/
public static Map<String, Integer> countByType(List<String> projTypes) {
AssertUtils.isEmpty(projTypes, "项目类型不能为空");
Map queryMap = new HashMap();
queryMap.put("projTypes", projTypes);
List<Map> results = DaoBase.getInstance().query(HgWdSqlConstant.HgWd001.COUNT_BY_TYPE, queryMap);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(item -> MapUtils.getString(item, HGWD001.COL_PROJ_TYPE),
item -> MapUtils.getInteger(item, "CNT")));
}
/**
* 搜索树节点
*
* @param fileName
......
$(function () {
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(\'' + item.projCode + '\')" >修改</a>';
return template;
}
}],
loadComplete: function (grid) {
// 新增
$("#ADD").on("click", add);
//删除
$("#REMOVE").on("click", remove);
},
onAdd: function (e) {
e.preventDefault();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
IPLATUI.EFGrid = {
"result": {
exportGrid: false, // 隐藏右侧自定义导出按钮
pageable: {
pageSize: 20,
pageSizes: [20, 100, 250, 500],
},
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="modify(\'' + item.projCode + '\')" >修改</a>';
return template;
}
}],
loadComplete: function (grid) {
// 新增
$("#ADD").on("click", add);
//删除
$("#REMOVE").on("click", remove);
}
}
}
......
......@@ -6,18 +6,22 @@
<EF:EFPage title="项目管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-companyName" cname="公司名称" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-contractNo" cname="合同号" placeholder="模糊查询" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" placeholder="模糊查询" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true" copyToAdd="false">
<EF:EFRegion id="result" title="记录集" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="override" showCount="true" height="74vh">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="120" align="left" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="120" align="left"/>
<EF:EFColumn ename="contractNo" cname="合同号" enable="false" width="120" align="left"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="220" align="left"/>
<EF:EFComboColumn ename="projType" cname="项目类型" enable="false" width="100" align="center">
<EF:EFCodeOption codeName="app.sc.projType"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdBy" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
......
......@@ -39,17 +39,13 @@ let save = function () {
message(msg);
return;
}
JSUtils.confirm("确定\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("", "HGSC101A", "save", true,
function (e) {
if (e.getStatus() !== -1) {
parent.JSColorbox.setValueCallback();
}
}
);
JSUtils.submitGridsData("", "HGSC101A", "save", true,
function (e) {
if (e.getStatus() !== -1) {
parent.JSColorbox.setValueCallback();
}
}
});
);
}
/**
......@@ -60,9 +56,13 @@ let checkParams = function () {
if (isBlank(projName)) {
return "项目名称不能为空";
}
let companyCode = $("#result-0-companyCode").val();
let projType = $("#result-0-projType").val();
if (isBlank(projType)) {
return "项目类型不能为空";
}
/*let companyCode = $("#result-0-companyCode").val();
if (isBlank(companyCode)) {
return "请选择公司";
}
}*/
return null;
}
......@@ -11,10 +11,9 @@
<EF:EFInput cname="项目号" blockId="result" ename="projCode" row="0" colWidth="6" ratio="2:10" required="true"
readonly="true"/>
</div>
<div class="row">
<div class="row" style="display: none">
<EF:EFSelect cname="公司" blockId="result" ename="companyCode" row="0" colWidth="6" ratio="2:10"
filter="contains">
<EF:EFOption label="请选择" value=""/>
<EF:EFOptions blockId="company_code_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFInput cname="公司名称" blockId="result" ename="companyName" row="0" colWidth="6" ratio="2:10"
......@@ -24,6 +23,13 @@
<EF:EFInput cname="项目名称" blockId="result" ename="projName" row="0" colWidth="6" required="true"
ratio="2:10" maxLength="200"/>
</div>
<div class="row">
<EF:EFSelect cname="项目类型" blockId="result" ename="projType" row="0" colWidth="6" ratio="2:10"
filter="contains">
<EF:EFOption label="请选择" value=""/>
<EF:EFCodeOption codeName="app.sc.projType"/>
</EF:EFSelect>
</div>
<br/>
<span style="color: red; ">说明:项目号由系统自动生成</span><br>
</EF:EFRegion>
......
......@@ -243,7 +243,7 @@ let showAuthButton = function () {
let label = IPLATUI.EFTree.docTree.selectNode.treeId;
let leafType = IPLATUI.EFTree.docTree.selectNode.leafType;
// C:目录
if (!leafType && leafType != 'C') {
if (isBlank(leafType) || leafType != 'C') {
$("#AUTH").hide();
$("#REMOVE_USER").hide();
$("#COPY_USER").hide();
......
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