Commit 3a69bad2 by 宋祥

1.项目来源增加备件制造图,该目录无需授权可直接操作

parent f553f9e9
package com.baosight.hggp.controller; package com.baosight.hggp.controller;
import com.baosight.hggp.core.tools.ThreadLocalTools; import com.baosight.hggp.core.tools.ThreadLocalTools;
import com.baosight.hggp.util.LogUtils;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -13,9 +20,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -13,9 +20,9 @@ import lombok.extern.slf4j.Slf4j;
* @date:2024/3/14,14:26 * @date:2024/3/14,14:26
*/ */
@Slf4j @Slf4j
@Controller
@CrossOrigin @CrossOrigin
@RequestMapping({"/dataAuth"}) @RestController
@RequestMapping("/dataAuth")
public class DataAuthController { public class DataAuthController {
/** /**
...@@ -23,15 +30,19 @@ public class DataAuthController { ...@@ -23,15 +30,19 @@ public class DataAuthController {
* *
* @param value 1-已用,0-停用 * @param value 1-已用,0-停用
*/ */
@RequestMapping({"/enable/{value}"}) @RequestMapping(value = "/enable", method = RequestMethod.GET)
public String enable(@PathVariable String value) { public Map<String, Object> enable(@Param("value") String value) {
Map<String, Object> resultMap = new HashMap();
try { try {
ThreadLocalTools.DATA_AUTH.set(!"0".equals(value)); ThreadLocalTools.DATA_AUTH.set(!"0".equals(value));
resultMap.put("status", 1);
resultMap.put("message", "操作成功");
} catch (Exception e) { } catch (Exception e) {
log.error("操作失败:{}", e.getMessage(), e); log.error("操作失败:{}", e.getMessage(), e);
return "操作失败"; resultMap.put("status", 500);
resultMap.put("message", LogUtils.getMsg(e));
} }
return "操作成功"; return resultMap;
} }
} }
package com.baosight.hggp.controller; package com.baosight.hggp.controller;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.tools.ThreadLocalTools;
import com.baosight.hggp.core.utils.QrCodeUtils; import com.baosight.hggp.core.utils.QrCodeUtils;
import com.baosight.hggp.hg.mt.utils.UploadUtils; import com.baosight.hggp.hg.mt.utils.UploadUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
...@@ -19,6 +20,7 @@ import java.util.HashMap; ...@@ -19,6 +20,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest; import org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest;
...@@ -28,6 +30,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -28,6 +30,7 @@ import javax.servlet.http.HttpServletRequest;
* @author:songx * @author:songx
* @date:2024/3/14,14:26 * @date:2024/3/14,14:26
*/ */
@Slf4j
@CrossOrigin @CrossOrigin
@RestController @RestController
@RequestMapping({"/upload/file"}) @RequestMapping({"/upload/file"})
...@@ -81,5 +84,5 @@ public class FileUploadController { ...@@ -81,5 +84,5 @@ public class FileUploadController {
return resultMap; return resultMap;
} }
} }
} }
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst; import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.extapp.decheng.model.DcChance; import com.baosight.hggp.core.extapp.decheng.model.DcChance;
import com.baosight.hggp.core.extapp.decheng.model.DcContract;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList; import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.extapp.decheng.model.DcDeptList; import com.baosight.hggp.core.extapp.decheng.model.DcDeptList;
import com.baosight.hggp.core.extapp.decheng.model.DcProductList; import com.baosight.hggp.core.extapp.decheng.model.DcProductList;
...@@ -116,6 +117,22 @@ public class DcOpenApi { ...@@ -116,6 +117,22 @@ public class DcOpenApi {
} }
/** /**
* 合同管理-详情
*
* @param ord 单据ID
*/
public static DcContract contractDetail(int ord) throws IOException {
JSONObject paramJson = new JSONObject();
paramJson.put("ord", ord);
String result = HttpUtils.post(DeChengConst.CONTRACT_DETAIL, DcApiUtils.buildHeader(true),
JSON.toJSONString(paramJson), HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】获取合同管理详情失败");
}
return DcApiUtils.handleResultDetailV3(result, DcContract.class);
}
/**
* 工作互动-添加 * 工作互动-添加
* *
* @param title 主题 * @param title 主题
......
package com.baosight.hggp.core.extapp.decheng.model;
import lombok.Data;
/**
* 合同信息
*
* @author:songx
* @date:2024/8/9,16:41
*/
@Data
public class DcContract {
/**
* 合同标识
*/
private Integer ord;
/**
* 合同编号
*/
private String htid;
/**
* 合同主题
*/
private String title;
/**
* 设计来源
*/
private String designSource;
}
...@@ -14,7 +14,7 @@ public class DcContractList { ...@@ -14,7 +14,7 @@ public class DcContractList {
/** /**
* 合同标识 * 合同标识
*/ */
private String ord; private Integer ord;
/** /**
* 合同编号 * 合同编号
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon; import com.baosight.hggp.core.extapp.decheng.annotation.AliasNameAnon;
import com.baosight.hggp.core.extapp.decheng.api.DcTokenApi; import com.baosight.hggp.core.extapp.decheng.api.DcTokenApi;
import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst; import com.baosight.hggp.core.extapp.decheng.constant.DeChengConst;
import com.baosight.hggp.core.extapp.decheng.model.DcContract;
import com.baosight.hggp.core.model.Pager; import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ClassFieldUtils; import com.baosight.hggp.core.utils.ClassFieldUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
...@@ -104,7 +105,25 @@ public class DcApiUtils { ...@@ -104,7 +105,25 @@ public class DcApiUtils {
handleMessageV3(resultJson); handleMessageV3(resultJson);
// 构建结果数据集 // 构建结果数据集
JSONObject dataJson = resultJson.getJSONObject("Data"); JSONObject dataJson = resultJson.getJSONObject("Data");
return dataJson.toJavaObject(clazz); // 合同详情单独处理
if (clazz == DcContract.class) {
return (T) handleResultContractV3(dataJson);
} else {
return dataJson.toJavaObject(clazz);
}
}
/**
* 处理合同详情
*
* @return
*/
private static DcContract handleResultContractV3(JSONObject dataJson) {
DcContract dcContract = new DcContract();
dcContract.setHtid(dataJson.getString("Htid"));
dcContract.setTitle(dataJson.getString("Title"));
dcContract.setDesignSource(dataJson.getString("!B__SysCusmf_0_11001_507_0"));
return dcContract;
} }
/** /**
......
...@@ -2,6 +2,8 @@ package com.baosight.hggp.core.security; ...@@ -2,6 +2,8 @@ package com.baosight.hggp.core.security;
import com.baosight.hggp.core.enums.OrgTypeEnum; import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.xs.domain.Company; import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.hg.xs.domain.Dept; import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.Org; import com.baosight.hggp.hg.xs.domain.Org;
...@@ -80,6 +82,19 @@ public class UserSessionUtils extends UserSession { ...@@ -80,6 +82,19 @@ public class UserSessionUtils extends UserSession {
} }
/** /**
* 获取登录用户的租户信息
*
* @return
*/
public static HGPZ009 getAccount() {
String accountCode = getAccountCode();
if (StringUtils.isBlank(accountCode)) {
return null;
}
return HGPZTools.HgPz009.getByCode(accountCode);
}
/**
* 获取用户所属公司 * 获取用户所属公司
* *
* @return * @return
......
...@@ -28,6 +28,7 @@ public class HGPZ009 extends DaoEPBase { ...@@ -28,6 +28,7 @@ public class HGPZ009 extends DaoEPBase {
public static final String FIELD_LOGIN_PREFIX = "loginPrefix"; /* 登录前缀*/ public static final String FIELD_LOGIN_PREFIX = "loginPrefix"; /* 登录前缀*/
public static final String FIELD_DOC_ID_PC = "docIdPc"; /* pc文档标识*/ public static final String FIELD_DOC_ID_PC = "docIdPc"; /* pc文档标识*/
public static final String FIELD_DOC_ID_APP = "docIdApp"; /* app文档标识*/ public static final String FIELD_DOC_ID_APP = "docIdApp"; /* app文档标识*/
public static final String FIELD_DATA_AUTH_FLAG = "dataAuthFlag"; /* 是否启用数据权限:1.启用,0.停用*/
public static final String FIELD_REMARK = "remark"; /* 备注*/ public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/ public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
...@@ -44,6 +45,7 @@ public class HGPZ009 extends DaoEPBase { ...@@ -44,6 +45,7 @@ public class HGPZ009 extends DaoEPBase {
public static final String COL_LOGIN_PREFIX = "LOGIN_PREFIX"; /* 登录前缀*/ public static final String COL_LOGIN_PREFIX = "LOGIN_PREFIX"; /* 登录前缀*/
public static final String COL_DOC_ID_PC = "DOC_ID_PC"; /* pc文档标识*/ public static final String COL_DOC_ID_PC = "DOC_ID_PC"; /* pc文档标识*/
public static final String COL_DOC_ID_APP = "DOC_ID_APP"; /* app文档标识*/ public static final String COL_DOC_ID_APP = "DOC_ID_APP"; /* app文档标识*/
public static final String COL_DATA_AUTH_FLAG = "DATA_AUTH_FLAG"; /* 是否启用数据权限:1.启用,0.停用*/
public static final String COL_REMARK = "REMARK"; /* 备注*/ public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
...@@ -66,6 +68,7 @@ public class HGPZ009 extends DaoEPBase { ...@@ -66,6 +68,7 @@ public class HGPZ009 extends DaoEPBase {
private String loginPrefix = " "; /* 登录前缀*/ private String loginPrefix = " "; /* 登录前缀*/
private String docIdPc = " "; /* pc文档标识*/ private String docIdPc = " "; /* pc文档标识*/
private String docIdApp = " "; /* app文档标识*/ private String docIdApp = " "; /* app文档标识*/
private Integer dataAuthFlag; /* 是否启用数据权限:1.启用,0.停用*/
private String remark = " "; /* 备注*/ private String remark = " "; /* 备注*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
...@@ -109,7 +112,11 @@ public class HGPZ009 extends DaoEPBase { ...@@ -109,7 +112,11 @@ public class HGPZ009 extends DaoEPBase {
eiColumn = new EiColumn(FIELD_DOC_ID_APP); eiColumn = new EiColumn(FIELD_DOC_ID_APP);
eiColumn.setDescName("app文档标识"); eiColumn.setDescName("app文档标识");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_DATA_AUTH_FLAG);
eiColumn.setDescName("是否启用数据权限:1.启用,0.停用");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_REMARK); eiColumn = new EiColumn(FIELD_REMARK);
eiColumn.setDescName("备注"); eiColumn.setDescName("备注");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -264,6 +271,15 @@ public class HGPZ009 extends DaoEPBase { ...@@ -264,6 +271,15 @@ public class HGPZ009 extends DaoEPBase {
public void setDocIdApp(String docIdApp) { public void setDocIdApp(String docIdApp) {
this.docIdApp = docIdApp; this.docIdApp = docIdApp;
} }
public Integer getDataAuthFlag() {
return dataAuthFlag;
}
public void setDataAuthFlag(Integer dataAuthFlag) {
this.dataAuthFlag = dataAuthFlag;
}
/** /**
* get the remark - 备注. * get the remark - 备注.
* @return the remark * @return the remark
...@@ -407,6 +423,7 @@ public class HGPZ009 extends DaoEPBase { ...@@ -407,6 +423,7 @@ public class HGPZ009 extends DaoEPBase {
setLoginPrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOGIN_PREFIX)), loginPrefix)); setLoginPrefix(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_LOGIN_PREFIX)), loginPrefix));
setDocIdPc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_PC)), docIdPc)); setDocIdPc(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_PC)), docIdPc));
setDocIdApp(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_APP)), docIdApp)); setDocIdApp(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DOC_ID_APP)), docIdApp));
setDataAuthFlag(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_DATA_AUTH_FLAG)), dataAuthFlag));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark)); setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy)); setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName)); setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
...@@ -431,6 +448,7 @@ public class HGPZ009 extends DaoEPBase { ...@@ -431,6 +448,7 @@ public class HGPZ009 extends DaoEPBase {
map.put(FIELD_LOGIN_PREFIX, StringUtils.toString(loginPrefix, eiMetadata.getMeta(FIELD_LOGIN_PREFIX))); map.put(FIELD_LOGIN_PREFIX, StringUtils.toString(loginPrefix, eiMetadata.getMeta(FIELD_LOGIN_PREFIX)));
map.put(FIELD_DOC_ID_PC, StringUtils.toString(docIdPc, eiMetadata.getMeta(FIELD_DOC_ID_PC))); map.put(FIELD_DOC_ID_PC, StringUtils.toString(docIdPc, eiMetadata.getMeta(FIELD_DOC_ID_PC)));
map.put(FIELD_DOC_ID_APP, StringUtils.toString(docIdApp, eiMetadata.getMeta(FIELD_DOC_ID_APP))); map.put(FIELD_DOC_ID_APP, StringUtils.toString(docIdApp, eiMetadata.getMeta(FIELD_DOC_ID_APP)));
map.put(FIELD_DATA_AUTH_FLAG, StringUtils.toString(dataAuthFlag, eiMetadata.getMeta(FIELD_DATA_AUTH_FLAG)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK))); map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY))); map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME))); map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 --> LOGIN_PREFIX as "loginPrefix", <!-- 登录前缀 -->
DOC_ID_PC as "docIdPc", DOC_ID_PC as "docIdPc",
DOC_ID_APP as "docIdApp", DOC_ID_APP as "docIdApp",
DATA_AUTH_FLAG as "dataAuthFlag", <!-- 是否启用数据权限:1.启用,0.停用 -->
REMARK as "remark", <!-- 备注 --> REMARK as "remark", <!-- 备注 -->
CREATED_BY as "createdBy", <!-- 创建人 --> CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 --> CREATED_NAME as "createdName", <!-- 创建人名称 -->
...@@ -82,19 +83,20 @@ ...@@ -82,19 +83,20 @@
<insert id="insert"> <insert id="insert">
INSERT INTO ${metaSchema}.HGPZ009 ( INSERT INTO ${metaSchema}.HGPZ009 (
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
ACCOUNT_NAME, <!-- 企业名称 --> ACCOUNT_NAME, <!-- 企业名称 -->
VALID_FLAG, <!-- 是否启用:1.启用,0.停用 --> VALID_FLAG, <!-- 是否启用:1.启用,0.停用 -->
LOGIN_PREFIX, <!-- 登录前缀 --> LOGIN_PREFIX, <!-- 登录前缀 -->
DOC_ID_PC, DOC_ID_PC,
DOC_ID_APP, DOC_ID_APP,
REMARK, <!-- 备注 --> DATA_AUTH_FLAG, <!-- 是否启用数据权限:1.启用,0.停用 -->
CREATED_BY, <!-- 创建人 --> REMARK, <!-- 备注 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_BY, <!-- 创建人 -->
CREATED_TIME <!-- 创建时间 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME <!-- 创建时间 -->
) VALUES ( ) VALUES (
#accountCode#, #accountName#, #validFlag#, #loginPrefix#, #docIdPc#, #accountCode#, #accountName#, #validFlag#, #loginPrefix#, #docIdPc#,
#docIdApp#, #remark#, #createdBy#, #createdName#, #createdTime# #docIdApp#, #dataAuthFlag#, #remark#, #createdBy#, #createdName#, #createdTime#
) )
</insert> </insert>
...@@ -102,12 +104,13 @@ ...@@ -102,12 +104,13 @@
<update id="update"> <update id="update">
UPDATE ${metaSchema}.HGPZ009 UPDATE ${metaSchema}.HGPZ009
SET SET
ACCOUNT_NAME = #accountName#, ACCOUNT_NAME = #accountName#,
DOC_ID_PC = #docIdPc#, DOC_ID_PC = #docIdPc#,
DOC_ID_APP = #docIdApp#, DOC_ID_APP = #docIdApp#,
VALID_FLAG = #validFlag#, VALID_FLAG = #validFlag#,
REMARK = #remark#, DATA_AUTH_FLAG = #dataAuthFlag#,
<include refid="updateRevise"/> REMARK = #remark#,
<include refid="updateRevise"/>
WHERE ACCOUNT_CODE = #accountCode# WHERE ACCOUNT_CODE = #accountCode#
</update> </update>
......
...@@ -7,7 +7,8 @@ package com.baosight.hggp.hg.sc.enums; ...@@ -7,7 +7,8 @@ package com.baosight.hggp.hg.sc.enums;
public enum ProjectSourceEnum { public enum ProjectSourceEnum {
ENGINEERING("engineering", "工程设计图"), ENGINEERING("engineering", "工程设计图"),
FOREIGN("foreign", "外来制造图"), FOREIGN("foreign", "外来涉密图"),
SPARE("spare", "备件制造图"),
OTHER("other", "其他"), OTHER("other", "其他"),
; ;
...@@ -36,6 +37,21 @@ public enum ProjectSourceEnum { ...@@ -36,6 +37,21 @@ public enum ProjectSourceEnum {
return false; return false;
} }
/**
* 根据名称查询
*
* @param name
* @return
*/
public static ProjectSourceEnum getByName(String name) {
for (ProjectSourceEnum value : values()) {
if (value.getName().equals(name)) {
return value;
}
}
return null;
}
ProjectSourceEnum(String code, String name) { ProjectSourceEnum(String code, String name) {
this.code = code; this.code = code;
this.name = name; this.name = name;
......
...@@ -2,7 +2,10 @@ package com.baosight.hggp.hg.sc.service; ...@@ -2,7 +2,10 @@ package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi; import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.extapp.decheng.model.DcContract;
import com.baosight.hggp.core.extapp.decheng.model.DcContractList; import com.baosight.hggp.core.extapp.decheng.model.DcContractList;
import com.baosight.hggp.core.extapp.decheng.model.DcUser;
import com.baosight.hggp.core.extapp.decheng.model.DcUserList;
import com.baosight.hggp.core.model.Pager; import com.baosight.hggp.core.model.Pager;
import com.baosight.hggp.core.utils.ThreadUtils; import com.baosight.hggp.core.utils.ThreadUtils;
import com.baosight.hggp.hg.pz.domain.HGPZ009; import com.baosight.hggp.hg.pz.domain.HGPZ009;
...@@ -11,10 +14,18 @@ import com.baosight.hggp.hg.sc.constant.HgScSqlConstant; ...@@ -11,10 +14,18 @@ import com.baosight.hggp.hg.sc.constant.HgScSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum; import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.constant.HgXsSqlConstant;
import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.hg.xs.utils.HGXSUtils;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.EiInfoUtils; import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
...@@ -62,7 +73,7 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -62,7 +73,7 @@ public class ServiceHGSC101 extends ServiceEPBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo); Map queryRow = EiInfoUtils.getFirstRow(inInfo);
inInfo = super.query(inInfo, HGSC001.QUERY, new HGSC001()); inInfo = super.query(inInfo, "HGSC101.query", new HGSC001());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -133,43 +144,97 @@ public class ServiceHGSC101 extends ServiceEPBase { ...@@ -133,43 +144,97 @@ public class ServiceHGSC101 extends ServiceEPBase {
break; break;
} }
// 写入合同数据 // 写入合同数据
saveContractData(accountCode, dcContractLists); syncDcContractData(accountCode, dcContractLists);
pageIndex++; pageIndex++;
} }
} }
/** /**
* 写入合同信息 * 同步合同信息
* *
* @param accountCode * @param accountCode
* @param dcContractLists * @param dcContractLists
*/ */
private void saveContractData(String accountCode, List<DcContractList> dcContractLists) { private void syncDcContractData(String accountCode, List<DcContractList> dcContractLists) {
// 查询帐套信息 // 查询帐套信息
HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode); HGPZ009 dbPz009 = HGPZTools.HgPz009.getByCode(accountCode);
String prefix = dbPz009.getLoginPrefix();
for (DcContractList dcContractList : dcContractLists) { for (DcContractList dcContractList : dcContractLists) {
String projCode = prefix + dcContractList.getOrd(); try {
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode); syncDcContractSingle(dbPz009, dcContractList);
if (dbSc001 == null) { } catch (Exception e) {
dbSc001 = new HGSC001(); log.error("同步德诚合同失败:{}", e.getMessage(), e);
dbSc001.setAccountCode(accountCode);
dbSc001.setDepCode(accountCode);
dbSc001.setDepName(dbPz009.getAccountName());
dbSc001.setProjCode(projCode);
dbSc001.setProjName(dcContractList.getTitle());
// TODO 默认其他,需要根据智邦的接口返回值确定
dbSc001.setProjectSource(ProjectSourceEnum.OTHER.getCode());
dbSc001.setContractNo(dcContractList.getHtid());
DaoUtils.insert(HGSC001.INSERT, dbSc001);
} else {
Map updateMap = new HashMap();
updateMap.put(HGSC001.FIELD_proj_code, projCode);
updateMap.put(HGSC001.FIELD_contract_no, dcContractList.getHtid());
updateMap.put(HGSC001.FIELD_proj_name, dcContractList.getTitle());
DaoUtils.update(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, updateMap);
} }
} }
} }
/**
* 同步单个用户
*
* @param dbPz009
* @param dcContractList
*/
private void syncDcContractSingle(HGPZ009 dbPz009, DcContractList dcContractList) throws IOException {
// 获取用户详情
DcContract dcContract = DcOpenApi.contractDetail(dcContractList.getOrd());
if (dcContract == null) {
return;
}
dcContract.setOrd(dcContractList.getOrd());
// 判断合同是否存在
String projCode = dbPz009.getLoginPrefix() + dcContractList.getOrd();
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
if (dbSc001 == null) {
this.syncDcSingleContractAdd(projCode, dcContract, dbPz009);
} else {
this.syncDcSingleContractModify(projCode, dcContract);
}
}
/**
* 新增
*
* @param projCode
* @param dcContract
* @param dbPz009
*/
private void syncDcSingleContractAdd(String projCode, DcContract dcContract, HGPZ009 dbPz009) {
HGSC001 dbSc001 = new HGSC001();
dbSc001.setAccountCode(dbPz009.getAccountCode());
dbSc001.setDepCode(dbPz009.getAccountCode());
dbSc001.setDepName(dbPz009.getAccountName());
dbSc001.setProjCode(projCode);
dbSc001.setProjName(dcContract.getTitle());
// 设计来源
dbSc001.setProjectSource(getProjectSource(dcContract.getDesignSource()));
dbSc001.setContractNo(dcContract.getHtid());
DaoUtils.insert(HGSC001.INSERT, dbSc001);
}
/**
* 修改
*
* @param projCode
* @param dcContract
*/
private void syncDcSingleContractModify(String projCode, DcContract dcContract) {
Map updateMap = new HashMap();
updateMap.put(HGSC001.FIELD_proj_code, projCode);
updateMap.put(HGSC001.FIELD_contract_no, dcContract.getHtid());
updateMap.put(HGSC001.FIELD_proj_name, dcContract.getTitle());
updateMap.put(HGSC001.FIELD_project_source, getProjectSource(dcContract.getDesignSource()));
DaoUtils.update(HgScSqlConstant.HgSc001.UPDATE_PROJ_NAME, updateMap);
// 同步更新文档库
DaoUtils.update(HgWdSqlConstant.HgWd001.UPDATE_PROJECT, updateMap);
}
/**
* 设计来源
*
* @return
*/
private String getProjectSource(String name) {
ProjectSourceEnum projectSourceEnum = ProjectSourceEnum.getByName(name);
return projectSourceEnum == null ? ProjectSourceEnum.OTHER.getCode() : projectSourceEnum.getCode();
}
} }
...@@ -103,9 +103,6 @@ ...@@ -103,9 +103,6 @@
<isNotEmpty prepend=" AND " property="endDate"> <isNotEmpty prepend=" AND " property="endDate">
end_date = #endDate# end_date = #endDate#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
account_code = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy"> <isNotEmpty prepend=" AND " property="createdBy">
created_by = #createdBy# created_by = #createdBy#
</isNotEmpty> </isNotEmpty>
...@@ -333,6 +330,7 @@ ...@@ -333,6 +330,7 @@
SET SET
CONTRACT_NO = #contractNo#, CONTRACT_NO = #contractNo#,
PROJ_NAME = #projName#, PROJ_NAME = #projName#,
PROJECT_SOURCE = #projectSource#,
<include refid="SqlBase.updateRevise"/> <include refid="SqlBase.updateRevise"/>
WHERE PROJ_CODE = #projCode# WHERE PROJ_CODE = #projCode#
</update> </update>
......
...@@ -27,7 +27,7 @@ import java.util.stream.Collectors; ...@@ -27,7 +27,7 @@ import java.util.stream.Collectors;
* @date:2024/8/22,16:15 * @date:2024/8/22,16:15
*/ */
public class HgScUtils { public class HgScUtils {
/** /**
* @author:songx * @author:songx
* @date:2024/8/22,16:17 * @date:2024/8/22,16:17
......
...@@ -11,6 +11,7 @@ import com.baosight.hggp.core.tools.FileTools; ...@@ -11,6 +11,7 @@ import com.baosight.hggp.core.tools.FileTools;
import com.baosight.hggp.core.tools.Iplat4jTools; import com.baosight.hggp.core.tools.Iplat4jTools;
import com.baosight.hggp.core.utils.Iplat4jUtils; import com.baosight.hggp.core.utils.Iplat4jUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant; import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
...@@ -200,8 +201,9 @@ public class ServiceHGWD001 extends ServiceEPBase { ...@@ -200,8 +201,9 @@ public class ServiceHGWD001 extends ServiceEPBase {
} }
} }
// 非管理员仅查询自己有权限的项目 // 非管理员仅查询自己有权限的项目
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(hgwd001.getProjectSource());
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) { if (isAuth && !HgWdUtils.HgWd009.isManager(userId)) {
HGWDTools.HgWd003.checkProjectManager(hgwd001.getFileId()); HGWDTools.HgWd003.checkProjectManager(hgwd001.getFileId());
} }
......
...@@ -6,6 +6,7 @@ import com.baosight.hggp.core.security.UserSessionUtils; ...@@ -6,6 +6,7 @@ import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.CodeValueTools; import com.baosight.hggp.core.tools.CodeValueTools;
import com.baosight.hggp.hg.sc.domain.HGSC001; import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum; import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
...@@ -215,12 +216,13 @@ public class ServiceHGWD001D extends TreeService { ...@@ -215,12 +216,13 @@ public class ServiceHGWD001D extends TreeService {
Map queryMap = EiInfoUtils.getFirstRow(inInfo); Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE); String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME); String ename = MapUtils.getString(queryMap, CommonConstant.Field.ENAME);
String projCode = MapUtils.getString(queryMap, HGWD001.FIELD_PROJ_CODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) { if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node)); inInfo.addBlock(node).setRows(queryTopNode(node));
} else if (ProjectSourceEnum.contains(node)) { } else if (ProjectSourceEnum.contains(node)) {
inInfo.addBlock(node).setRows(queryFirstNode(node, ename)); inInfo.addBlock(node).setRows(queryFirstNode(node, ename));
} else { } else {
inInfo.addBlock(node).setRows(queryChildNode(node, ename)); inInfo.addBlock(node).setRows(queryChildNode(projCode, node, ename));
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败"); LogUtils.setMsg(inInfo, e, "查询节点失败");
...@@ -235,7 +237,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -235,7 +237,7 @@ public class ServiceHGWD001D extends TreeService {
*/ */
public List queryTopNode(String parentId) { public List queryTopNode(String parentId) {
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projType"); List<Map> codesetMaps = CodeValueTools.getCodeValues("app.sc.projectSource");
if (CollectionUtils.isEmpty(codesetMaps)) { if (CollectionUtils.isEmpty(codesetMaps)) {
return results; return results;
} }
...@@ -260,13 +262,14 @@ public class ServiceHGWD001D extends TreeService { ...@@ -260,13 +262,14 @@ public class ServiceHGWD001D extends TreeService {
* @return * @return
*/ */
public List queryFirstNode(String parentId, String ename) { public List queryFirstNode(String parentId, String ename) {
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(parentId);
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap<>(); Map queryMap = new HashMap<>();
queryMap.put("ename", ename); queryMap.put("ename", ename);
queryMap.put("projectSource", parentId); queryMap.put("projectSource", parentId);
// 非管理员仅查询自己有权限的项目 // 非管理员仅查询自己有权限的项目
String userId = UserSessionUtils.getLoginName(); String userId = UserSessionUtils.getLoginName();
if (!HgWdUtils.HgWd009.isManager(userId)) { if (isAuth && !HgWdUtils.HgWd009.isManager(userId)) {
queryMap.put("userId", userId); queryMap.put("userId", userId);
} }
List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap); List<HGSC001> dbSc001s = dao.query("HGSC101.query", queryMap);
...@@ -281,6 +284,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -281,6 +284,7 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("ename", dbSc001.getProjCode()); leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1"); leafMap.put("type", "1");
leafMap.put("leafLevel", "0"); leafMap.put("leafLevel", "0");
leafMap.put("isAuth", isAuth ? "1" : "0");
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点 // 设置叶子节点
...@@ -291,10 +295,15 @@ public class ServiceHGWD001D extends TreeService { ...@@ -291,10 +295,15 @@ public class ServiceHGWD001D extends TreeService {
/** /**
* 查询叶子节点 * 查询叶子节点
* *
* @param projCode
* @param parentId * @param parentId
* @param ename
* @return * @return
*/ */
public List queryChildNode(String parentId, String ename) { public List queryChildNode(String projCode, String parentId, String ename) {
// 查询项目来源
HGSC001 dbSc001 = HGSCTools.Hgsc001.queryByCode(projCode);
boolean isAuth = !ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
List<Map> results = new ArrayList(); List<Map> results = new ArrayList();
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("parentId", parentId); queryMap.put("parentId", parentId);
...@@ -310,6 +319,7 @@ public class ServiceHGWD001D extends TreeService { ...@@ -310,6 +319,7 @@ public class ServiceHGWD001D extends TreeService {
leafMap.put("ename", dbWd001.getProjCode()); leafMap.put("ename", dbWd001.getProjCode());
leafMap.put("type", dbWd001.getFileType()); leafMap.put("type", dbWd001.getFileType());
leafMap.put("leafLevel", dbWd001.getLeafLevel()); leafMap.put("leafLevel", dbWd001.getLeafLevel());
leafMap.put("isAuth", isAuth ? "1" : "0");
results.add(leafMap); results.add(leafMap);
} }
// 设置叶子节点 // 设置叶子节点
......
...@@ -3,9 +3,11 @@ package com.baosight.hggp.hg.wd.service; ...@@ -3,9 +3,11 @@ package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.wd.constant.HgWdConstant; import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001; import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD002; import com.baosight.hggp.hg.wd.domain.HGWD002;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.wd.utils.HgWdUtils; import com.baosight.hggp.hg.wd.utils.HgWdUtils;
import com.baosight.hggp.hg.xs.domain.User; import com.baosight.hggp.hg.xs.domain.User;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
...@@ -58,12 +60,16 @@ public class ServiceHGWD002 extends ServiceBase { ...@@ -58,12 +60,16 @@ public class ServiceHGWD002 extends ServiceBase {
// 未选择文件目录时,返回空 // 未选择文件目录时,返回空
String fileId = MapUtils.getString(queryRow, HGWD001.FIELD_FILE_ID); String fileId = MapUtils.getString(queryRow, HGWD001.FIELD_FILE_ID);
if (StringUtils.isBlank(fileId)) { if (StringUtils.isBlank(fileId)) {
return inInfo; return inInfo;
} }
String parentId = MapUtils.getString(queryRow, HGWD001.FIELD_PARENT_ID);
String projCode = MapUtils.getString(queryRow, HGWD001.FIELD_PROJ_CODE);
// 判断是否备件制造图
boolean isSpare = HgWdUtils.HgWd001.isSpare(parentId, projCode);
// 仅查询已发布的文件 // 仅查询已发布的文件
queryRow.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1); queryRow.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1);
// 管理员不做权限验证 // 管理员、无权限的目录不做权限验证
if (!HgWdUtils.HgWd009.isManager()) { if (!(isSpare || HgWdUtils.HgWd009.isManager())) {
queryRow.put(User.FIELD_USER_ID, UserSessionUtils.getUserId()); queryRow.put(User.FIELD_USER_ID, UserSessionUtils.getUserId());
} }
builder(inInfo); builder(inInfo);
......
...@@ -96,7 +96,9 @@ public class ServiceHGWD002A extends ServiceEPBase { ...@@ -96,7 +96,9 @@ public class ServiceHGWD002A extends ServiceEPBase {
Map queryMap = new HashMap(); Map queryMap = new HashMap();
queryMap.put("fileId", parentId); queryMap.put("fileId", parentId);
queryMap.put("parentId", parentId); queryMap.put("parentId", parentId);
if (!HgWdUtils.HgWd009.isManager()) { // 是否备件制造图
boolean isSpare = HgWdUtils.HgWd001.isSpare(parentId);
if (!(isSpare || HgWdUtils.HgWd009.isManager())) {
queryMap.put("userId", UserSessionUtils.getLoginName()); queryMap.put("userId", UserSessionUtils.getLoginName());
} }
queryMap.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1); queryMap.put(HGWD001.FIELD_STATUS, HgWdConstant.FileStatus.S_1);
......
...@@ -114,10 +114,10 @@ ...@@ -114,10 +114,10 @@
AND M.IS_PROJECT_MANAGER = 1 AND M.IS_PROJECT_MANAGER = 1
) )
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="userId"> <isNotEmpty prepend=" AND " property="userId" open="(" close=")">
EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID EXISTS (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 M WHERE T.FILE_ID = M.FILE_ID
AND M.USER_ID = #userId# AND M.USER_ID = #userId#
) ) OR PROJECT_SOURCE = 'spare'
</isNotEmpty> </isNotEmpty>
</sql> </sql>
......
...@@ -60,17 +60,14 @@ ...@@ -60,17 +60,14 @@
<isNotEmpty prepend=" AND " property="docName"> <isNotEmpty prepend=" AND " property="docName">
B.DOC_NAME LIKE CONCAT('%', #docName#, '%') B.DOC_NAME LIKE CONCAT('%', #docName#, '%')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="parentId"> <isNotEmpty prepend=" AND " property="userId">
<isNotEmpty prepend=" AND " property="userId"> B.BIZ_ID IN (SELECT FILE_ID FROM ${hggpSchema}.HGWD003 WHERE USER_ID = #userId#)
B.BIZ_ID IN (select FILE_ID from ${hggpSchema}.hgwd003 where USER_ID = #userId#
AND FILE_ID = #parentId#)
</isNotEmpty>
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateFrom"> <isNotEmpty prepend=" AND " property="createdDateFrom">
CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000') B.CREATED_TIME &gt;= CONCAT(REPLACE(#createdDateFrom#, '-', ''), '000000')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="createdDateTo"> <isNotEmpty prepend=" AND " property="createdDateTo">
CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959') B.CREATED_TIME &lt;= CONCAT(REPLACE(#createdDateTo#, '-', ''), '235959')
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="docType"> <isNotEmpty prepend=" AND " property="docType">
B.DOC_TYPE = #docType# B.DOC_TYPE = #docType#
......
package com.baosight.hggp.hg.wd.utils; package com.baosight.hggp.hg.wd.utils;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.enums.ProjectSourceEnum;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD003; import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.tools.HGWDTools; import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.util.StringUtils;
/** /**
* @author:songx * @author:songx
...@@ -10,6 +15,55 @@ import com.baosight.hggp.hg.wd.tools.HGWDTools; ...@@ -10,6 +15,55 @@ import com.baosight.hggp.hg.wd.tools.HGWDTools;
*/ */
public class HgWdUtils { public class HgWdUtils {
/**
* HGSC001 定义
*
* @author:songx
* @date:2024/10/15,13:38
*/
public static class HgWd001 {
/**
* 是否备件制造图
*
* @param fileId
* @return
*/
public static boolean isSpare(String fileId) {
if (StringUtils.isBlank(fileId)) {
return false;
}
HGWD001 dbWd001 = HGWDTools.HgWd001.get(fileId);
if (dbWd001 == null || StringUtils.isBlank(dbWd001.getProjectSource())) {
return false;
}
return ProjectSourceEnum.SPARE.getCode().equals(dbWd001.getProjectSource());
}
/**
* 是否备件制造图
*
* @param treeId
* @param projCode
* @return
*/
public static boolean isSpare(String treeId, String projCode) {
if (ProjectSourceEnum.SPARE.getCode().equals(treeId)) {
return true;
}
if (StringUtils.isBlank(projCode)) {
return false;
}
HGSC001 dbSc001 = HGSCTools.Hgsc001.getByCode(projCode);
if (dbSc001 == null || StringUtils.isBlank(dbSc001.getProjectSource())) {
return false;
}
return ProjectSourceEnum.SPARE.getCode().equals(dbSc001.getProjectSource());
}
}
/** /**
* @author:songx * @author:songx
* @date:2024/8/19,14:57 * @date:2024/8/19,14:57
......
...@@ -22,8 +22,10 @@ public class HgXsSqlConstant { ...@@ -22,8 +22,10 @@ public class HgXsSqlConstant {
*/ */
public static class HgXsOrg { public static class HgXsOrg {
// 新增管理 // 新增
public static final String ADD_RELATION = "HGXSOrg.addRelation"; public static final String ADD_RELATION = "HGXSOrg.addRelation";
// 删除
public static final String REMOVE_RELATION = "HGXSOrg.removeRelation";
// 修改组织名称 // 修改组织名称
public static final String UPDATE_ORG_CNAME = "HGXSOrg.updateOrgCname"; public static final String UPDATE_ORG_CNAME = "HGXSOrg.updateOrgCname";
} }
......
...@@ -173,9 +173,9 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -173,9 +173,9 @@ public class ServiceHGXSOrg extends ServiceBase {
if (dbOrg == null) { if (dbOrg == null) {
dbOrg = new Org(); dbOrg = new Org();
dbOrg.setOrgId(orgId); dbOrg.setOrgId(orgId);
this.syncDcDeptAdd(accountCode, dcDeptList, dbOrg, dbPz009); this.syncDcDeptAdd(dcDeptList, dbOrg, dbPz009);
} else { } else {
this.syncDcDeptModify(dcDeptList, orgId); this.syncDcDeptModify(dcDeptList, orgId, dbPz009);
} }
} }
} }
...@@ -183,21 +183,25 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -183,21 +183,25 @@ public class ServiceHGXSOrg extends ServiceBase {
/** /**
* 新增数据 * 新增数据
* *
* @param accountCode
* @param dcDeptList * @param dcDeptList
* @param dbOrg * @param dbOrg
* @param dbPz009 * @param dbPz009
*/ */
private void syncDcDeptAdd(String accountCode, DcDeptList dcDeptList, Org dbOrg, HGPZ009 dbPz009) { private void syncDcDeptAdd(DcDeptList dcDeptList, Org dbOrg, HGPZ009 dbPz009) {
String orgId = dbOrg.getOrgId(); // parentId=-1:表示是组织机构顶级,顶级用租户,因此需要过滤掉
if ("-1".equals(dcDeptList.getParentId())) {
return;
}
String accountCode = dbPz009.getAccountCode();
dbOrg.setAccountCode(accountCode); dbOrg.setAccountCode(accountCode);
dbOrg.setOrgEname(orgId); dbOrg.setOrgEname(dbOrg.getOrgId());
dbOrg.setOrgCname(dcDeptList.getNodeText()); dbOrg.setOrgCname(dcDeptList.getNodeText());
// parentId=-1:表示是组织机构顶级 dbOrg.setOrgType(OrgTypeEnum.DEPT.getCode());
dbOrg.setOrgType("-1".equals(dcDeptList.getParentId()) ? OrgTypeEnum.COMPANY.getCode() if ("0".equals(dcDeptList.getParentId())) {
: OrgTypeEnum.DEPT.getCode()); dbOrg.setParentOrgId(accountCode);
dbOrg.setParentOrgId("-1".equals(dcDeptList.getParentId()) } else {
? accountCode : dbPz009.getLoginPrefix() + dcDeptList.getParentId()); dbOrg.setParentOrgId(dbPz009.getLoginPrefix() + dcDeptList.getParentId());
}
dbOrg.setEstablishDate("20240101"); dbOrg.setEstablishDate("20240101");
dbOrg.setSortIndex(dcDeptList.getFullSort()); dbOrg.setSortIndex(dcDeptList.getFullSort());
dbOrg.setCompanyCode(accountCode); dbOrg.setCompanyCode(accountCode);
...@@ -213,11 +217,18 @@ public class ServiceHGXSOrg extends ServiceBase { ...@@ -213,11 +217,18 @@ public class ServiceHGXSOrg extends ServiceBase {
* *
* @param dcDeptList * @param dcDeptList
* @param orgId * @param orgId
* @param dbPz009
*/ */
private void syncDcDeptModify(DcDeptList dcDeptList, String orgId) { private void syncDcDeptModify(DcDeptList dcDeptList, String orgId, HGPZ009 dbPz009) {
String accountCode = dbPz009.getAccountCode();
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(Org.FIELD_ORG_ID, orgId); updateMap.put(Org.FIELD_ORG_ID, orgId);
updateMap.put(Org.FIELD_ORG_CNAME, dcDeptList.getNodeText()); updateMap.put(Org.FIELD_ORG_CNAME, dcDeptList.getNodeText());
if ("0".equals(dcDeptList.getParentId())) {
updateMap.put(Org.FIELD_PARENT_ORG_ID, accountCode);
} else {
updateMap.put(Org.FIELD_PARENT_ORG_ID, dbPz009.getLoginPrefix() + dcDeptList.getParentId());
}
updateMap.put(Org.FIELD_REC_REVISOR, "System"); updateMap.put(Org.FIELD_REC_REVISOR, "System");
updateMap.put(Org.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime()); updateMap.put(Org.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
updateMap.put(Org.FIELD_IS_DELETED, DeleteFlagEnum.UN_REMOVE.getCode().toString()); updateMap.put(Org.FIELD_IS_DELETED, DeleteFlagEnum.UN_REMOVE.getCode().toString());
......
...@@ -286,7 +286,7 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -286,7 +286,7 @@ public class ServiceHGXSUser extends ServiceBase {
if (dbUser == null) { if (dbUser == null) {
this.syncDcSingleUserAdd(dcUserList, dcUser, dbPz009); this.syncDcSingleUserAdd(dcUserList, dcUser, dbPz009);
} else { } else {
this.syncDcSingleUserModify(dcUserList, dcUser); this.syncDcSingleUserModify(dcUserList, dcUser, dbPz009);
} }
} }
...@@ -299,26 +299,21 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -299,26 +299,21 @@ public class ServiceHGXSUser extends ServiceBase {
* @throws Exception * @throws Exception
*/ */
private void syncDcSingleUserAdd(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) throws Exception { private void syncDcSingleUserAdd(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) throws Exception {
String userId = dcUser.getYgid();
// -1:冻结用户,1:正常 // -1:冻结用户,1:正常
String isLocked = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus()); String isLocked = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
// 新增用户 // 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(), HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), dcUser.getYgid(), dcUser.getName(), dcUser.getSex(),
dcUser.getCardid(), isLocked, dcUserList.getOrd().toString()); dcUser.getEmail(), dcUser.getCardid(), isLocked, dcUserList.getOrd().toString());
// 新增用户和组织机构关系 // 新增用户和组织机构关系
Map addMap = new HashMap(); this.addOrgRelation(dcUser, dbPz009);
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
addMap.put("userId", userId);
addMap.put("recCreator", "System");
addMap.put("recCreateTime", DateUtils.shortDateTime());
dao.insert(HgXsSqlConstant.HgXsOrg.ADD_RELATION, addMap);
} }
/** /**
* @param dcUserList * @param dcUserList
* @param dcUser * @param dcUser
* @param dbPz009
*/ */
private void syncDcSingleUserModify(DcUserList dcUserList, DcUser dcUser) { private void syncDcSingleUserModify(DcUserList dcUserList, DcUser dcUser, HGPZ009 dbPz009) {
Map updateMap = new HashMap(); Map updateMap = new HashMap();
updateMap.put(User.FIELD_LOGIN_NAME, dcUser.getYgid()); updateMap.put(User.FIELD_LOGIN_NAME, dcUser.getYgid());
updateMap.put(User.FIELD_USER_NAME, dcUser.getName()); updateMap.put(User.FIELD_USER_NAME, dcUser.getName());
...@@ -333,6 +328,29 @@ public class ServiceHGXSUser extends ServiceBase { ...@@ -333,6 +328,29 @@ public class ServiceHGXSUser extends ServiceBase {
updateMap.put(User.FIELD_REC_REVISOR, "System"); updateMap.put(User.FIELD_REC_REVISOR, "System");
updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime()); updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap); dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap);
// 修改用户组织机构关系
this.addOrgRelation(dcUser, dbPz009);
} }
/**
* 新增用户和组织机构关系
*
* @param dcUser
* @param dbPz009
*/
private void addOrgRelation(DcUser dcUser, HGPZ009 dbPz009) {
Map addMap = new HashMap();
if ("0".equals(dcUser.getOrgsid())) {
addMap.put("orgId", dbPz009.getAccountCode());
} else {
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
}
addMap.put("userId", dcUser.getYgid());
addMap.put("recCreator", "System");
addMap.put("recCreateTime", DateUtils.shortDateTime());
// 先清除用户的组织机构关系
dao.update(HgXsSqlConstant.HgXsOrg.REMOVE_RELATION, addMap);
// 然后新增用户的组织机构关系
dao.insert(HgXsSqlConstant.HgXsOrg.ADD_RELATION, addMap);
}
} }
...@@ -259,6 +259,7 @@ ...@@ -259,6 +259,7 @@
UPDATE ${platSchema}.TXSOG01 UPDATE ${platSchema}.TXSOG01
SET SET
ORG_CNAME = #orgCname#, ORG_CNAME = #orgCname#,
PARENT_ORG_ID = #parentOrgId#,
REC_REVISOR = #recRevisor#, REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#, REC_REVISE_TIME = #recReviseTime#,
IS_DELETED = '0' IS_DELETED = '0'
...@@ -273,4 +274,10 @@ ...@@ -273,4 +274,10 @@
#orgId#, #userId#, #recCreator#, #recCreateTime# #orgId#, #userId#, #recCreator#, #recCreateTime#
) )
</insert> </insert>
<!-- 删除 -->
<insert id="removeRelation">
DELETE FROM ${platSchema}.TXSOG02 WHERE USER_ID = #userId#
</insert>
</sqlMap> </sqlMap>
...@@ -4,6 +4,7 @@ import com.baosight.hggp.common.DataAuthTypeEnum; ...@@ -4,6 +4,7 @@ import com.baosight.hggp.common.DataAuthTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.core.tools.ThreadLocalTools; import com.baosight.hggp.core.tools.ThreadLocalTools;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.xs.domain.UserGroup; import com.baosight.hggp.hg.xs.domain.UserGroup;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
...@@ -191,7 +192,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -191,7 +192,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
*/ */
private void setAccountCode(String name, Map parameters) { private void setAccountCode(String name, Map parameters) {
// 需要过滤部分sql name,否则会形成死循环 // 需要过滤部分sql name,否则会形成死循环
String[] serviceFilter = {"HGXSUser", "HGPZ009.query"}; String[] serviceFilter = {"HGXSUser", "HGPZ009"};
if (StringUtils.startsWithAny(name, serviceFilter)) { if (StringUtils.startsWithAny(name, serviceFilter)) {
return; return;
} }
...@@ -220,7 +221,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -220,7 +221,7 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
} }
// 需要过滤部分sql name,否则会形成死循环;admin账户不需要校验 // 需要过滤部分sql name,否则会形成死循环;admin账户不需要校验
String loginName = UserSessionUtils.getLoginName(); String loginName = UserSessionUtils.getLoginName();
String[] serviceFilter = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009.query", "HGPZ010.query"}; String[] serviceFilter = {"HGXSUser", "HGXSOrg", "HGXSUserGroup", "HGPZ009", "HGPZ010.query"};
if (StringUtils.startsWithAny(name, serviceFilter) || "admin".equalsIgnoreCase(loginName)) { if (StringUtils.startsWithAny(name, serviceFilter) || "admin".equalsIgnoreCase(loginName)) {
return; return;
} }
...@@ -232,6 +233,11 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -232,6 +233,11 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
if (StringUtils.isNotBlank(authEnable) && CommonConstant.YesNo.NO_S0.equals(authEnable)) { if (StringUtils.isNotBlank(authEnable) && CommonConstant.YesNo.NO_S0.equals(authEnable)) {
return; return;
} }
// 租户是否开启数据权限
HGPZ009 dbPz009 = UserSessionUtils.getAccount();
if (dbPz009 != null && CommonConstant.YesNo.NO_0.equals(dbPz009.getDataAuthFlag())) {
return;
}
// 当前用户所有角色 // 当前用户所有角色
List<UserGroup> userGroups = UserSessionUtils.getRole(); List<UserGroup> userGroups = UserSessionUtils.getRole();
AssertUtils.isEmpty(userGroups, "当前用户未绑定角色,无法操作数据,请联系管理员!"); AssertUtils.isEmpty(userGroups, "当前用户未绑定角色,无法操作数据,请联系管理员!");
...@@ -289,6 +295,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -289,6 +295,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
return null; return null;
} }
if (DataAuthTypeEnum.ONLY_COMPANY.getCode().equals(dataAuthType)) { if (DataAuthTypeEnum.ONLY_COMPANY.getCode().equals(dataAuthType)) {
if (StringUtils.isBlank(userGroup.getCompanyCode())) {
return null;
}
return HGXSTools.XsOrg.queryChildren(userGroup.getCompanyCode()); return HGXSTools.XsOrg.queryChildren(userGroup.getCompanyCode());
} else if (DataAuthTypeEnum.ONLY_FACTORY.getCode().equals(dataAuthType)) { } else if (DataAuthTypeEnum.ONLY_FACTORY.getCode().equals(dataAuthType)) {
if (StringUtils.isBlank(userGroup.getFactoryCode())) { if (StringUtils.isBlank(userGroup.getFactoryCode())) {
...@@ -296,6 +305,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao { ...@@ -296,6 +305,9 @@ public class SqlMapDaoLogProxy extends SqlMapDao {
} }
return HGXSTools.XsOrg.queryChildren(userGroup.getFactoryCode()); return HGXSTools.XsOrg.queryChildren(userGroup.getFactoryCode());
} else if (DataAuthTypeEnum.ONLY_DEPT.getCode().equals(dataAuthType)) { } else if (DataAuthTypeEnum.ONLY_DEPT.getCode().equals(dataAuthType)) {
if (StringUtils.isBlank(userGroup.getDepCode())) {
return null;
}
return HGXSTools.XsOrg.queryChildren(userGroup.getDepCode()); return HGXSTools.XsOrg.queryChildren(userGroup.getDepCode());
} }
return null; return null;
......
...@@ -206,6 +206,7 @@ let save = function (){ ...@@ -206,6 +206,7 @@ let save = function (){
ei.set("result-0-accountName", $("#accountName").val()); ei.set("result-0-accountName", $("#accountName").val());
ei.set("result-0-loginPrefix", $("#loginPrefix").val()); ei.set("result-0-loginPrefix", $("#loginPrefix").val());
ei.set("result-0-validFlag", $("#validFlag").val()); ei.set("result-0-validFlag", $("#validFlag").val());
ei.set("result-0-dataAuthFlag", $("#dataAuthFlag").val());
ei.set("result-0-docIdPc", $("#PCfileDocId").val()); ei.set("result-0-docIdPc", $("#PCfileDocId").val());
ei.set("result-0-docIdApp", $("#APPfileDocId").val()); ei.set("result-0-docIdApp", $("#APPfileDocId").val());
ei.set("result-0-remark", $("#remark").val()); ei.set("result-0-remark", $("#remark").val());
...@@ -268,6 +269,7 @@ function updateCompany() { ...@@ -268,6 +269,7 @@ function updateCompany() {
$("#loginPrefix").val(rows[0]["loginPrefix"]); $("#loginPrefix").val(rows[0]["loginPrefix"]);
$("#loginPrefix").attr("readonly","true"); $("#loginPrefix").attr("readonly","true");
$("#validFlag").val(rows[0]["validFlag"]); $("#validFlag").val(rows[0]["validFlag"]);
$("#dataAuthFlag").val(rows[0]["dataAuthFlag"]);
$("#PCfileDocId").val(rows[0]["docIdPc"]); $("#PCfileDocId").val(rows[0]["docIdPc"]);
$("#APPfileDocId").val(rows[0]["docIdApp"]); $("#APPfileDocId").val(rows[0]["docIdApp"]);
$("#remark").val(rows[0]["remark"]); $("#remark").val(rows[0]["remark"]);
......
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
<EF:EFComboColumn cname="是否启用" ename="validFlag" width="90" align="center" required="true"> <EF:EFComboColumn cname="是否启用" ename="validFlag" width="90" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/> <EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn cname="是否启用数据权限" ename="dataAuthFlag" width="130" align="center" required="true">
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFComboColumn>
<EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/> <EF:EFColumn cname="备注" ename="remark" width="150" editType="textarea"/>
<EF:EFColumn cname="创建人" ename="createdName" enable="false" align="center"/> <EF:EFColumn cname="创建人" ename="createdName" enable="false" align="center"/>
<EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center" <EF:EFColumn cname="创建时间" ename="createdTime" enable="false" width="140" align="center"
...@@ -64,6 +67,15 @@ ...@@ -64,6 +67,15 @@
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="dataAuthFlag" class="col-sm-2 col-form-label col-form-label-sm">是否启用数据权限</label>
<div class="col-sm-6">
<select class="form-control" id="dataAuthFlag">
<option value="1"></option>
<option value="0"></option>
</select>
</div>
</div>
<div class="form-group row">
<label for="docIdPc" class="col-sm-2 col-form-label">PC端log</label> <label for="docIdPc" class="col-sm-2 col-form-label">PC端log</label>
<div class="col-sm-6"> <div class="col-sm-6">
<EF:EFUpload ename="docIdPc" cname="PC上传" docTag="hk_filePc" path="A"/> <EF:EFUpload ename="docIdPc" cname="PC上传" docTag="hk_filePc" path="A"/>
...@@ -102,11 +114,14 @@ ...@@ -102,11 +114,14 @@
<EF:EFRegion id="updateResult"> <EF:EFRegion id="updateResult">
<EF:EFInput ename="accountName" colWidth="6" cname="企业名称"/> <EF:EFInput ename="accountName" colWidth="6" cname="企业名称"/>
<EF:EFInput ename="loginPrefix" colWidth="6" cname="登录前缀"/> <EF:EFInput ename="loginPrefix" colWidth="6" cname="登录前缀"/>
<EF:EFSelect ename="validFlag" cname="是否启" <EF:EFSelect ename="validFlag" cname="是否启"
template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#" template="#=valueField#-#=textField#" valueTemplate="#=valueField#-#=textField#"
required="true" defaultValue="China"> <%--enable="false":不可下拉--%> required="true" > <%--enable="false":不可下拉--%>
<EF:EFOptions blockId="made_country_block_id" textField="country_ch_name" valueField="country"/> <EF:EFOptions blockId="made_country_block_id" textField="country_ch_name" valueField="country"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect ename="dataAuthFlag" cname="是否启用数据权限" required="true" >
<EF:EFCodeOption codeName="hpjx.hppz.validFlag"/>
</EF:EFSelect>
<EF:EFUpload ename="uploadFilePc" cname="PC上传" docTag="hk_filePc" path="A"/> <EF:EFUpload ename="uploadFilePc" cname="PC上传" docTag="hk_filePc" path="A"/>
<EF:EFUpload ename="uploadFileApp" cname="APP上传" docTag="hk_fileApp" path="A"/> <EF:EFUpload ename="uploadFileApp" cname="APP上传" docTag="hk_fileApp" path="A"/>
<EF:EFInput ename="remark" colWidth="6" cname="备注"/> <EF:EFInput ename="remark" colWidth="6" cname="备注"/>
......
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/6/19
Time: 17:26
To change this template use File | Settings | File Templates.
--%>
<!DOCTYPE html> <!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %> <%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
......
...@@ -96,6 +96,10 @@ $(function () { ...@@ -96,6 +96,10 @@ $(function () {
IPLATUI.EFTree = { IPLATUI.EFTree = {
"categoryTree": { "categoryTree": {
query: function (inInfo, model) {
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
return inInfo;
},
select: function (e) { select: function (e) {
var _data = this.dataItem(e.node); var _data = this.dataItem(e.node);
var labelValue = _data.label; var labelValue = _data.label;
...@@ -373,7 +377,7 @@ $(function () { ...@@ -373,7 +377,7 @@ $(function () {
companyCode: '', companyCode: '',
leafLevel: '', leafLevel: '',
leafType: '', leafType: '',
isAuth: '1',
}, },
// expandLevel:1, // expandLevel:1,
/** /**
...@@ -669,6 +673,7 @@ let setTreeNodeValue = function (nodeData) { ...@@ -669,6 +673,7 @@ let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode; IPLATUI.EFTree.categoryTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel; IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel = nodeData.leafLevel;
IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType; IPLATUI.EFTree.categoryTree.selectTreeNode.leafType = nodeData.leafType;
IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth = nodeData.isAuth;
} }
/** /**
...@@ -810,23 +815,32 @@ function updateRelease(operStatus) { ...@@ -810,23 +815,32 @@ function updateRelease(operStatus) {
let showAuthButton = function () { let showAuthButton = function () {
let leafType = IPLATUI.EFTree.categoryTree.selectTreeNode.leafType; let leafType = IPLATUI.EFTree.categoryTree.selectTreeNode.leafType;
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId; let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId;
let leafLevel = IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel let leafLevel = IPLATUI.EFTree.categoryTree.selectTreeNode.leafLevel;
let isAuth = IPLATUI.EFTree.categoryTree.selectTreeNode.isAuth;
let changeRecord = $("#CHANGE_RECORD").hide(); let changeRecord = $("#CHANGE_RECORD").hide();
if (!isBlank(leafLevel) && leafLevel == 0){ if (!isBlank(leafLevel) && leafLevel == 0){
changeRecord.show(); changeRecord.show();
} }
// C:目录 // C:目录
if (isBlank(leafType) || leafType != "C") { if (isBlank(leafType) || leafType != "C") {
$("#RELEASE").hide(); $("#RELEASE").hide();
$("#UPLOAD_FILE").hide(); $("#UPLOAD_FILE").hide();
$("#COPY_FILE").hide(); $("#COPY_FILE").hide();
$("#COPY_PROT_FILE").hide(); $("#COPY_PROT_FILE").hide();
$("#PREVIEW").hide(); $("#PREVIEW").hide();
$("#BATCH_DOWNLOAD").hide(); $("#BATCH_DOWNLOAD").hide();
return return
} }
// 0:不授权
if (isAuth == 0) {
$("#RELEASE").show();
$("#UPLOAD_FILE").show();
$("#COPY_FILE").show();
$("#COPY_PROT_FILE").show();
$("#PREVIEW").show();
$("#BATCH_DOWNLOAD").show();
return;
}
isProjectManager(parentId); isProjectManager(parentId);
} }
......
...@@ -133,16 +133,16 @@ ...@@ -133,16 +133,16 @@
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" required="true" maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true"/> align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="center" <EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="left"
required="true" hidden="true"/> required="true" hidden="true"/>
<EF:EFComboColumn ename="fileType" cname="文件类型" width="100" align="center" readonly="false" required="true" <EF:EFComboColumn ename="fileType" cname="目录类型" width="100" align="center" readonly="false" required="true"
defaultValue="20"> defaultValue="20">
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="fileName" cname="文件名称" width="160" enable="true" readonly="false" align="center" <EF:EFColumn ename="fileName" cname="目录名称" width="160" enable="true" readonly="false" align="left"
required="true"/> required="true"/>
<EF:EFColumn ename="fileId" cname="文件号" width="100" enable="false" readonly="true" align="center" <EF:EFColumn ename="fileId" cname="目录号" width="100" enable="false" readonly="true" align="center"
required="false"/> required="false"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
...@@ -164,8 +164,8 @@ ...@@ -164,8 +164,8 @@
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="200" required="true" maxLength="16" readonly="true" width="200" required="true"
align="center" filter="contains" sort="true"/> align="left" filter="contains" sort="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="center" <EF:EFColumn ename="projName" cname="项目名称" width="160" enable="true" readonly="true" align="left"
required="true" hidden="true"/> required="true" hidden="true"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
...@@ -88,6 +88,10 @@ $(function () { ...@@ -88,6 +88,10 @@ $(function () {
IPLATUI.EFTree = { IPLATUI.EFTree = {
"docTree": { "docTree": {
query: function (inInfo, model) {
inInfo.set("inqu_status-0-projCode", $("#inqu_status-0-projCode").val());
return inInfo;
},
select: function (e) { select: function (e) {
var _data = this.dataItem(e.node); var _data = this.dataItem(e.node);
var labelValue = _data.label; var labelValue = _data.label;
...@@ -120,7 +124,6 @@ $(function () { ...@@ -120,7 +124,6 @@ $(function () {
} }
} }
return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>' return ' <span class="' + icon + '" style="padding-right: 8px"> </span> <span class="titleClass" title="' + item.label + '">' + title + '</span>'
}, },
loadComplete: function (options) { loadComplete: function (options) {
...@@ -132,6 +135,7 @@ $(function () { ...@@ -132,6 +135,7 @@ $(function () {
companyCode: '', companyCode: '',
leafLevel: '', leafLevel: '',
type: '', type: '',
isAuth: '1'
}, },
// expandLevel:1, // expandLevel:1,
/** /**
...@@ -251,33 +255,6 @@ let showDownloadRecord = function (fileId, docId) { ...@@ -251,33 +255,6 @@ let showDownloadRecord = function (fileId, docId) {
let preview = function () { let preview = function () {
let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val(); let url = "HGWD002A?inqu_status-0-fileId=" + $("#inqu_status-0-fileId").val();
window.open(url, '_blank'); window.open(url, '_blank');
// let params = {
// "inqu_status-0-fileId": $("#inqu_status-0-fileId").val()
// }
// JSColorbox.open({
// href: "HGWD002A",
// title: "<div style='text-align: center;'>文件预览</div>",
// width: "90%",
// height: "95%",
// params: params
// });
// let rows = resultGrid.getCheckedRows();
// if (rows.length < 1) {
// message("请选择数据");
// return;
// }
// JSUtils.submitGridsData("result", "HGWD001B", "add", false,
// function (res) {
// if (res.status > -1) {
// for (let i = 0; i < rows.length; i++) {
// let row = rows[i];
// previewDoc(row['docType'], row['docId']);
// }
// } else {
// message(res.msg);
// }
// }
// );
} }
/** /**
...@@ -318,6 +295,7 @@ let setTreeNodeValue = function (nodeData) { ...@@ -318,6 +295,7 @@ let setTreeNodeValue = function (nodeData) {
IPLATUI.EFTree.docTree.selectTreeNode.companyCode = nodeData.companyCode; IPLATUI.EFTree.docTree.selectTreeNode.companyCode = nodeData.companyCode;
IPLATUI.EFTree.docTree.selectTreeNode.projCode = nodeData.projCode; IPLATUI.EFTree.docTree.selectTreeNode.projCode = nodeData.projCode;
IPLATUI.EFTree.docTree.selectTreeNode.leafLevel = nodeData.leafLevel; IPLATUI.EFTree.docTree.selectTreeNode.leafLevel = nodeData.leafLevel;
IPLATUI.EFTree.docTree.selectTreeNode.isAuth = nodeData.isAuth;
} }
/** /**
...@@ -328,10 +306,10 @@ let showAuthButton = function () { ...@@ -328,10 +306,10 @@ let showAuthButton = function () {
// C:目录 // C:目录
if (leafType && leafType > 0) { if (leafType && leafType > 0) {
$("#PREVIEW").attr("disabled", false); $("#PREVIEW").attr("disabled", false);
$("#DOWNLOAD").attr("disabled", false); // $("#DOWNLOAD").attr("disabled", false);
} else { } else {
$("#PREVIEW").attr("disabled", true); $("#PREVIEW").attr("disabled", true);
$("#DOWNLOAD").attr("disabled", true); // $("#DOWNLOAD").attr("disabled", true);
} }
} }
...@@ -344,7 +322,7 @@ let showAuthButton = function () { ...@@ -344,7 +322,7 @@ let showAuthButton = function () {
*/ */
let showPreview = function (fileId, docId, docType) { let showPreview = function (fileId, docId, docType) {
if (isBlank(docId)) { if (isBlank(docId)) {
message("件类型或ID不能为空"); message("件类型或ID不能为空");
return; return;
} }
$("#previewFile").data("kendoWindow").center(); $("#previewFile").data("kendoWindow").center();
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
<EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="层级" ename="leafLevel" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="文档库名称" ename="fileName" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/> <EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden" value="WD"/>
<EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="件分类" colWidth="3" <EF:EFSelect blockId="inqu_status" row="0" ename="fileType" cname="件分类" colWidth="3"
filter="contains"> filter="contains">
<EF:EFOption label="全部" value=""/> <EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFInput cname="件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3"/> <EF:EFInput cname="件名称" ename="docName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFDateSpan startCname="上传时间" endCname="至" blockId="inqu_status" row="0" <EF:EFDateSpan startCname="上传时间" endCname="至" blockId="inqu_status" row="0"
startName="createdDateFrom" endName="createdDateTo" role="date" startName="createdDateFrom" endName="createdDateTo" role="date"
format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="false"> format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8" endRatio="4:8" readonly="false">
...@@ -51,20 +51,20 @@ ...@@ -51,20 +51,20 @@
checkMode="row"> checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/> <EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="fileId" cname="ID" hidden="true"/> <EF:EFColumn ename="fileId" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="件ID" enable="false" width="120" align="center" sort="false" <EF:EFColumn ename="docId" cname="件ID" enable="false" width="120" align="center" sort="false"
hidden="true"/> hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="80" align="center" sort="false"/> <EF:EFColumn ename="operator" cname="操作" enable="false" width="80" align="center" sort="false"/>
<EF:EFComboColumn ename="fileType" cname="件分类" enable="false" width="90" align="center"> <EF:EFComboColumn ename="fileType" cname="件分类" enable="false" width="90" align="center">
<EF:EFCodeOption codeName="hggp.hgwd.fileType"/> <EF:EFCodeOption codeName="hggp.hgwd.fileType"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="docName" cname="件名称" enable="false" width="220" sort="true"/> <EF:EFColumn ename="docName" cname="件名称" enable="false" width="220" sort="true"/>
<EF:EFColumn ename="docType" cname="件后缀" enable="false" width="110" align="center" sort="true"/> <EF:EFColumn ename="docType" cname="件后缀" enable="false" width="110" align="center" sort="true"/>
<EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/> <EF:EFColumn ename="docVersion" cname="版本号" enable="false" width="90" align="center" sort="true"/>
<EF:EFColumn ename="updatedTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime" <EF:EFColumn ename="updatedTime" cname="上传时间" parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true" dateFormat="yyyy-MM-dd HH:mm:ss" align="center" width="140" readonly="true"
required="false" enable="false" sort="true"/> required="false" enable="false" sort="true"/>
<%-- <EF:EFColumn ename="previewNum" cname="预览次数" enable="false" width="100" align="right" sort="true"/>--%> <%-- <EF:EFColumn ename="previewNum" cname="预览次数" enable="false" width="100" align="right" sort="true"/>--%>
<%-- <EF:EFColumn ename="downloadNum" cname="下载次数" enable="false" width="100" align="right" sort="true"/>--%> <%-- <EF:EFColumn ename="downloadNum" cname="下载次数" enable="false" width="100" align="right" sort="true"/>--%>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
</div> </div>
...@@ -73,9 +73,9 @@ ...@@ -73,9 +73,9 @@
</EF:EFPage> </EF:EFPage>
<%-- 预览文件 --%> <%-- 预览文件 --%>
<EF:EFWindow id="previewFile" title="文件预览" height="90%" width="90%"> <EF:EFWindow id="previewFile" title="附件预览" height="100%" width="100%">
<div id="descDiv" class="center-flex"> <div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">件预览区域...</span> <span id="descSpan" style="font-weight: bold;font-size: 18px">件预览区域...</span>
</div> </div>
<%-- 文本预览 --%> <%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;"> <div id="textContainer" class="left-flex" style="display: none;">
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<script src="${ctx}/common/js/xlsx.full.min.js"></script> <script src="${ctx}/common/js/xlsx.full.min.js"></script>
<script src="${ctx}/HG/WD/HGWD002A1.js"></script> <script src="${ctx}/HG/WD/HGWD002A1.js"></script>
<link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css"> <link rel="stylesheet" href="${ctx}/HG/WD/HGWD002A.css">
<EF:EFPage title="件预览"> <EF:EFPage title="件预览">
<div class="row" style="margin: 0 -10px;"> <div class="row" style="margin: 0 -10px;">
<div class="col-md-3"> <div class="col-md-3">
<EF:EFRegion title="文件目录树" id="tree" fitHeight="true"> <EF:EFRegion title="文件目录树" id="tree" fitHeight="true">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="col-md-9"> <div class="col-md-9">
<EF:EFRegion title="预览区域" id="preview" fitHeight="true"> <EF:EFRegion title="预览区域" id="preview" fitHeight="true">
<div id="descDiv" class="center-flex"> <div id="descDiv" class="center-flex">
<span id="descSpan" style="font-weight: bold;font-size: 18px">件预览区域...</span> <span id="descSpan" style="font-weight: bold;font-size: 18px">件预览区域...</span>
</div> </div>
<%-- 文本预览 --%> <%-- 文本预览 --%>
<div id="textContainer" class="left-flex" style="display: none;"> <div id="textContainer" class="left-flex" style="display: none;">
......
...@@ -265,6 +265,25 @@ function previewFrame(docId) { ...@@ -265,6 +265,25 @@ function previewFrame(docId) {
} }
/** /**
* 监听iframe
*/
function iframeLoad() {
$('#previewFrame').on('load', function() {
// 当iframe加载完成后,获取iframe中的元素
let iframeBody = document.getElementById('previewFrame');
// 获取iframe的document对象
let iframeDoc = iframeBody.contentDocument || iframeBody.contentWindow.document;
// 例如,获取iframe中的一个具有特定类的元素
let viewer = iframeDoc.querySelector("#viewer")
let download = viewer.shadowRoot.querySelector("#toolbar")
.shadowRoot.querySelector("#downloads")
.shadowRoot.querySelector("#download");
// let download = iframeBody.find('#download');
download.css('display', 'none');
});
}
/**
* 其他下载 * 其他下载
* *
* @param isRoot * @param isRoot
...@@ -310,6 +329,8 @@ let imageOuterDiv = null; ...@@ -310,6 +329,8 @@ let imageOuterDiv = null;
let realImage = null; let realImage = null;
let bigImage = null; let bigImage = null;
window.onload = function () { window.onload = function () {
// 监听iframe
iframeLoad();
imageOuterDiv = document.querySelector("#imageOuterDiv"); imageOuterDiv = document.querySelector("#imageOuterDiv");
realImage = document.querySelector("#image"); realImage = document.querySelector("#image");
bigImage = document.querySelector("#bigImage"); bigImage = document.querySelector("#bigImage");
......
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