Commit 6f1c2ebd by 宋祥
parents fb391799 f26f2752
......@@ -109,9 +109,8 @@ public class ServiceHGKC008 extends ServiceBase {
hgkc008.setApplyCode(SequenceGenerator.getNextSequence(HGConstant.SequenceId.RECEIVE_CODE));
hgkc008.setStatus(HGConstant.ProductStatus.WTJ);
DaoUtils.insert(HGKC008.INSERT, hgkc008);
//移动端新增需要获取对象id信息
HGKC008 queryKC008 = HGKCTools.HgKc008.getByApplyCode(hgkc008.getApplyCode());
EiInfoUtils.addBlock(inInfo,"entity", queryKC008, HGKC008.class);
EiInfoUtils.addBlock(inInfo,"entity", hgkc008, HGKC008.class);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("保存成功!");
......
......@@ -131,6 +131,9 @@
RECEIVE_TYPE <!-- 领料单类型 0:正常,1:退库 -->
)
VALUES (#id#,#projCode#, #projName#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #receiptDate#, #applyCode#, #whCode#, #whName#, #status#, #receiveType#)
<selectKey resultClass="long" keyProperty="id">
SELECT MAX(ID) AS "id" FROM ${hggpSchema}.HGKC008
</selectKey>
</insert>
<delete id="delete">
......
......@@ -311,7 +311,8 @@ public class HGKCTools {
//修改计划生产任务完工数量
HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty().intValue(),hgkc003.getRectificationId(),HGConstant.StorageType.RK);
//查询当前工序
HGPZ005A hgpz005A = hgpz005AList.stream().filter(o -> o.getInventCode().equals(hgkc003.getPrdtCode())).findAny().orElse(null);
HGPZ005A hgpz005A = hgpz005AList.stream().filter(o -> o.getId().equals(hgkc003.getInventProcessId())).findAny().orElse(null);
AssertUtils.isNull(hgpz005A, "未获取到当前工序信息!");
//查询比当前工序靠后的工序是否存在,不存在说明是最后工序,修改实时库存
List<HGPZ005A> nextHgpz005AList = hgpz005AList.stream().filter(o->o.getProcessOrder().compareTo(hgpz005A.getProcessOrder()) == 1).collect(Collectors.toList());
if(CollectionUtils.isEmpty(nextHgpz005AList)){
......
......@@ -316,7 +316,7 @@ public class HGKCUtils {
newKc010.setWhCode(whCode);
newKc010.setInventCode(inventCode);
newKc010.setInvQty(qty);
newKc010.setInvUnitWeight(unitWeight);
newKc010.setInvUnitWeight(unitWeight == null ? weight.divide(qty, 3, RoundingMode.HALF_UP) : unitWeight);
newKc010.setInvWeight(weight);
return newKc010;
}
......
......@@ -138,8 +138,7 @@ public class ServiceHGPZ009 extends ServiceBase {
dao.insert(HGPZ009.INSERT, fPz009);
// 默认新增企业管理员账号
String userId = fPz009.getLoginPrefix() + "0000";
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName(),
null, null, null, "1");
HGXSTools.XsUser.addUser(fPz009.getAccountCode(), userId, fPz009.getAccountName());
// 关联企业管理员角色
this.insertGroupMember(fPz009, userId);
// 新增组织机构顶级
......
......@@ -122,7 +122,7 @@ public class ServiceHGSC005A extends ServiceBase {
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(planCode);
int count = HGSCTools.THGSC005A.schedule(queryMap);
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
inInfo = this.query(inInfo);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-17 17:15:03
Version : 1.0
schema : hggp
tableName : HGSC005A
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
mat_detail_id BIGINT NOT NULL,
tech_flow_id BIGINT,
tech_flow_name BIGINT,
invent_process_id BIGINT,
process_name VARCHAR,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
product_type TINYINT,
product_code VARCHAR,
product_name VARCHAR,
finish_date VARCHAR,
plan_start_date VARCHAR,
plan_end_date VARCHAR,
quantity TINYINT,
finish_quantity TINYINT,
unfinish_quantity TINYINT,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC005A">
<sql id="condition">
<sql id="condition">
<!--<include refid="HGXSDataAuth.authCondition"/>-->
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
......@@ -156,46 +120,45 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
company_code as "companyCode", <!-- 公司编码 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005A WHERE 1=1
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
mat_detail_id as "matDetailId", <!-- 物料清单明细ID -->
tech_flow_id as "techFlowId", <!-- 工艺流程ID -->
tech_flow_name as "techFlowName", <!-- 工艺流程名称 -->
invent_process_id as "inventProcessId", <!-- 存货工序ID,对应HGPZ005A.id -->
process_code as "processCode", <!-- 工序编码 -->
process_name as "processName", <!-- 工序名称 -->
company_code as "companyCode", <!-- 公司编码 -->
process_order as "processOrder", <!-- 加工顺序 -->
company_name as "companyName", <!-- 公司名称 -->
dep_code as "depCode", <!-- 部门编码 -->
dep_name as "depName", <!-- 部门名称 -->
proj_code as "projCode", <!-- 项目编码 -->
proj_name as "projName", <!-- 项目名称 -->
plan_code as "planCode", <!-- 计划编码 -->
product_type as "productType", <!-- 产品类型 -->
product_code as "productCode", <!-- 产品编号 -->
product_name as "productName", <!-- 产品名称 -->
finish_date as "finishDate", <!-- 完工日期 -->
plan_start_date as "planStartDate", <!-- 计划开始日期 -->
plan_end_date as "planEndDate", <!-- 计划结束日期 -->
quantity as "quantity", <!-- 数量 -->
finish_quantity as "finishQuantity", <!-- 完工数量 -->
unfinish_quantity as "unfinishQuantity", <!-- 未完工数量 -->
single_weight as "singleWeight", <!-- 单重 -->
total_weight as "totalWeight", <!-- 总重 -->
finish_weight as "finishWeight", <!-- 完工重量 -->
unfinish_weight as "unfinishWeight", <!-- 未完工重量 -->
account_code as "accountCode", <!-- 帐套 -->
created_by as "createdBy", <!-- 创建人 -->
created_name as "createdName", <!-- 创建人名称 -->
created_time as "createdTime", <!-- 创建时间 -->
updated_by as "updatedBy", <!-- 更新人 -->
updated_name as "updatedName", <!-- 修改人名称 -->
updated_time as "updatedTime" <!-- 更新时间 -->
FROM ${hggpSchema}.HGSC005A WHERE 1=1
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......
......@@ -615,6 +615,11 @@ public class HGSCTools {
}
}
/**
*
* @author:songx
* @date:2024/9/4,22:02
*/
public static class THGSC005A{
public static HGSC005A getById(Long id){
......@@ -639,6 +644,22 @@ public class HGSCTools {
List<HGSC005A> results = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* 根据工序查询
*
* @param planCode
* @param processName
* @return
*/
public static List<HGSC005A> queryByPlanCode(String planCode, String processName) {
AssertUtils.isEmpty(planCode, "计划编码不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_plan_code, planCode);
paramMap.put(HGSC005A.FIELD_process_name, processName);
List<HGSC005A> results = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC005A> queryByMatId(Long matId){
AssertUtils.isTrue(Objects.isNull(matId)||matId<=0, "物料清单ID不能为空!");
......@@ -1038,11 +1059,11 @@ public class HGSCTools {
/**
* 排产
*
* @param planCode
* @param queryMap
* @return
*/
public static int schedule(String planCode) {
List<HGSC005A> hgsc005AList = queryByPlanCode(planCode);
public static int schedule(Map queryMap) {
List<HGSC005A> hgsc005AList = DaoBase.getInstance().query(HGSC005A.QUERY, queryMap);
// hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder()));
//通过工序编码查询工序设置
List<String> processCodes = hgsc005AList.stream().map(HGSC005A::getProcessCode)
......@@ -1080,12 +1101,18 @@ public class HGSCTools {
}
}
for (HGSC005A planInfo : partList) {
remainder = calculateWordHour(planInfo,hgsj001List,hgpz005List,hgpz005AList,minDate,remainder);
minDate = DateUtil.toDate(planInfo.getPlanStartDate(),DateUtil.DATE10_PATTERN).compareTo(DateUtil.toDate(minDate,DateUtil.DATE10_PATTERN)) <=0?planInfo.getPlanStartDate():minDate;
DaoUtils.update(HGSC005A.UPDATE,planInfo);
}
return hgsc005AList.size();
}
remainder = calculateWordHour(planInfo, hgsj001List, hgpz005List, hgpz005AList, minDate, remainder);
if (StringUtils.isBlank(minDate)) {
minDate = planInfo.getPlanStartDate();
} else {
minDate = DateUtil.toDate(planInfo.getPlanStartDate(), DateUtil.DATE10_PATTERN)
.compareTo(DateUtil.toDate(minDate, DateUtil.DATE10_PATTERN)) <= 0
? planInfo.getPlanStartDate() : minDate;
}
DaoUtils.update(HGSC005A.UPDATE, planInfo);
}
return hgsc005AList.size();
}
private static String handleEndDate(String endDate ,HGSC005A planInfo){
if(StringUtils.isBlank(endDate)&&StringUtils.isNotBlank(planInfo.getFinishDate())){
......
......@@ -37,6 +37,7 @@ public class HGWD003 extends DaoEPBase {
public static final String FIELD_USER_NAME = "userName"; /* 用户姓名*/
public static final String FIELD_REMARK = "remark"; /* 备注*/
public static final String FIELD_IS_PROJECT_MANAGER = "isProjectManager"; /* 是否项目经理,0=否,1=是*/
public static final String FIELD_EXT_ID = "extId"; /* 外部系统主键ID*/
public static final String FIELD_ORG_ID = "orgId"; /* 部门编码*/
public static final String FIELD_ORG_CNAME = "orgCname"; /* 部门名称*/
......@@ -55,6 +56,7 @@ public class HGWD003 extends DaoEPBase {
public static final String COL_USER_NAME = "USER_NAME"; /* 用户姓名*/
public static final String COL_REMARK = "REMARK"; /* 备注*/
public static final String COL_IS_PROJECT_MANAGER = "IS_PROJECT_MANAGER"; /* 是否项目经理,0=否,1=是*/
public static final String COL_EXT_ID = "EXT_ID"; /* 外部系统主键ID*/
public static final String COL_ORG_ID = "ORG_ID"; /* 部门编码*/
public static final String COL_ORG_CNAME = "ORG_CNAME"; /* 部门名称*/
......@@ -79,6 +81,7 @@ public class HGWD003 extends DaoEPBase {
private String userName = " "; /* 用户姓名*/
private String remark = " "; /* 备注*/
private Integer isProjectManager = 0; /* 是否项目经理,0=否,1=是*/
private String extId = " "; /* 外部系统主键ID*/
private String orgId = " "; /* 部门编码*/
private String orgCname = " "; /* 部门名称*/
......@@ -149,6 +152,10 @@ public class HGWD003 extends DaoEPBase {
eiColumn.setDescName("是否项目经理");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EXT_ID);
eiColumn.setDescName("外部系统主键ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_ORG_ID);
eiColumn.setDescName("部门编码");
eiMetadata.addMeta(eiColumn);
......@@ -392,6 +399,14 @@ public class HGWD003 extends DaoEPBase {
this.isProjectManager = isProjectManager;
}
public String getExtId() {
return extId;
}
public void setExtId(String extId) {
this.extId = extId;
}
public String getOrgId() {
return orgId;
}
......@@ -431,6 +446,7 @@ public class HGWD003 extends DaoEPBase {
setUserName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_USER_NAME)), userName));
setRemark(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_REMARK)), remark));
setIsProjectManager(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PROJECT_MANAGER)), isProjectManager));
setExtId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EXT_ID)), extId));
setOrgId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_ID)), orgId));
setOrgCname(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ORG_CNAME)), orgCname));
}
......@@ -457,6 +473,7 @@ public class HGWD003 extends DaoEPBase {
map.put(FIELD_USER_NAME, StringUtils.toString(userName, eiMetadata.getMeta(FIELD_USER_NAME)));
map.put(FIELD_REMARK, StringUtils.toString(remark, eiMetadata.getMeta(FIELD_REMARK)));
map.put(FIELD_IS_PROJECT_MANAGER, StringUtils.toString(isProjectManager, eiMetadata.getMeta(FIELD_IS_PROJECT_MANAGER)));
map.put(FIELD_EXT_ID, StringUtils.toString(extId, eiMetadata.getMeta(FIELD_EXT_ID)));
map.put(FIELD_ORG_ID, StringUtils.toString(orgId, eiMetadata.getMeta(FIELD_ORG_ID)));
map.put(FIELD_ORG_CNAME, StringUtils.toString(orgCname, eiMetadata.getMeta(FIELD_ORG_CNAME)));
......
......@@ -19,6 +19,8 @@ import java.util.List;
import java.util.Map;
/**
* 文档预览
*
* @author:songx
* @date:2024/5/9,11:04
*/
......
......@@ -19,6 +19,8 @@ import java.util.List;
import java.util.Map;
/**
* 文档下载
*
* @author:songx
* @date:2024/5/9,11:04
*/
......
......@@ -5,8 +5,15 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.wd.constant.HgWdConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.tools.HGWDTools;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.*;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.ef.ui.tree.TreeService;
......@@ -169,24 +176,132 @@ public class ServiceHGWD001D extends TreeService {
}
public EiInfo searchNodePath(EiInfo inInfo) {
String leafName = (String)inInfo.get("leafName");
Map map = new HashMap();
List queryNodeList = this.dao.query("XSOG01.queryOrganiation", map);
List nodeList = new ArrayList();
Iterator var6 = queryNodeList.iterator();
while(var6.hasNext()) {
Object node = var6.next();
String parentId = (String)((HashMap)node).get("parentOrgId");
if (!"".equals(parentId.trim())) {
((HashMap)node).put("parentId", parentId);
nodeList.add(node);
}
}
ServiceXSTreeNode root = ServiceXSTreeNode.buildTree(nodeList);
List allPath = ServiceXSTreeNode.findAllPath(root, nodeList, leafName);
inInfo.set("allPath", allPath);
return inInfo;
String leafName = (String) inInfo.get("leafName");
Map map = new HashMap();
List queryNodeList = this.dao.query("XSOG01.queryOrganiation", map);
List nodeList = new ArrayList();
Iterator var6 = queryNodeList.iterator();
while (var6.hasNext()) {
Object node = var6.next();
String parentId = (String) ((HashMap) node).get("parentOrgId");
if (!"".equals(parentId.trim())) {
((HashMap) node).put("parentId", parentId);
nodeList.add(node);
}
}
ServiceXSTreeNode root = ServiceXSTreeNode.buildTree(nodeList);
List allPath = ServiceXSTreeNode.findAllPath(root, nodeList, leafName);
inInfo.set("allPath", allPath);
return inInfo;
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentId) {
List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>());
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
Map leafMap = buildLeaf(parentId, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P);
leafMap.put("projCode", dbSc001.getProjCode());
leafMap.put("projName", dbSc001.getProjName());
leafMap.put("ename", dbSc001.getProjCode());
leafMap.put("type", "1");
leafMap.put("leafLevel", "0");
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 查询叶子节点
*
* @param parentId
* @return
*/
public List queryChildNode(String parentId) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentId);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
Map leafMap = buildLeaf(parentId, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C);
leafMap.put("projCode", dbWd001.getProjCode());
leafMap.put("projName", dbWd001.getProjName());
leafMap.put("ename", dbWd001.getProjCode());
leafMap.put("type", dbWd001.getFileType());
leafMap.put("leafLevel", dbWd001.getLeafLevel());
results.add(leafMap);
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
*/
private void setTreeNodeLeaf(List<Map> nodes) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> 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);
}
}
/**
* 构建叶子节点
*
* @param parentId
* @param label
* @param text
*/
private HashMap buildLeaf(String parentId, String label, String text, String leafType) {
HashMap<String, String> leafMap = new HashMap();
leafMap.put("parentId", parentId);
leafMap.put("label", label);
leafMap.put("text", text);
leafMap.put("leafType", leafType);
return leafMap;
}
}
......@@ -73,69 +73,6 @@ public class ServiceHGWD003 extends ServiceEPBase {
}
/**
* 树节点查询
*
* @param inInfo
* @return
*/
public EiInfo queryTree(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String node = MapUtils.getString(queryMap, CommonConstant.Field.NODE);
if (CommonConstant.Field.ROOT.equals(node) || CommonConstant.Field.ROOT2.equals(node)) {
inInfo.addBlock(node).setRows(queryTopNode(node));
} else {
inInfo.addBlock(node).setRows(queryChildNode(node));
}
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询节点失败");
}
return inInfo;
}
/**
* 查询树根
*
* @return
*/
public List queryTopNode(String parentLabel) {
List<Map> results = new ArrayList();
List<HGSC001> dbSc001s = dao.query(HGSC001.QUERY, new HashMap<>());
if (CollectionUtils.isEmpty(dbSc001s)) {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 查询叶子节点
*
* @param parentLabel
* @return
*/
public List queryChildNode(String parentLabel) {
List<Map> results = new ArrayList();
Map queryMap = new HashMap();
queryMap.put("parentId", parentLabel);
List<HGWD001> dbWd001s = dao.query(HGWD001.QUERY, queryMap);
if (CollectionUtils.isEmpty(dbWd001s)) {
return results;
}
for (HGWD001 dbWd001 : dbWd001s) {
results.add(buildLeaf(parentLabel, dbWd001.getFileId(), dbWd001.getFileName(), HgWdConstant.LeafType.C));
}
// 设置叶子节点
setTreeNodeLeaf(results);
return results;
}
/**
* 搜索树节点
*
* @param inInfo
......@@ -247,21 +184,4 @@ public class ServiceHGWD003 extends ServiceEPBase {
return inInfo;
}
/**
* 设置叶子节点是否可以展开
*
* @param nodes
*/
private void setTreeNodeLeaf(List<Map> nodes) {
if (CollectionUtils.isEmpty(nodes)) {
return;
}
List<String> labels = ObjectUtils.listKey(nodes, "label");
Map<String, Integer> 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);
}
}
}
......@@ -51,7 +51,7 @@ public class ServiceHGWD003A extends ServiceEPBase {
}
/**
* 树节点查询
* 查询
*
* @param inInfo
* @return
......
package com.baosight.hggp.hg.wd.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
/**
* word预览
*
* @author:songx
* @date:2024/9/4,15:22
*/
public class ServiceHGWD098 extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@Override
@OperationLogAnnotation(operModul = "word预览", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
}
......@@ -84,13 +84,15 @@ public class ServiceHGWD099 extends ServiceEPBase {
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
HGWD001 hgwd001 = HGWDTools.HgWd001.get(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGWD001.FIELD_FILE_ID));
StringBuilder strFileName = new StringBuilder();
strFileName.append("本次上传文件名称:");
for (Map resultRow : resultRows) {
HGWD099 hgdm099 = new HGWD099();
hgdm099.fromMap(resultRow);
hgdm099.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HGWD099.INSERT, hgdm099);
//项目文件
HGWD001 hgwd001 =HGWDTools.HgWd001.get(hgdm099.getBizId());
strFileName.append(hgdm099.getDocName()).append(",");
if (hgwd001 != null) {
HGWD001A hgwd001a = new HGWD001A();
hgwd001a.setCompanyCode(hgwd001.getCompanyCode());
......@@ -107,9 +109,9 @@ public class ServiceHGWD099 extends ServiceEPBase {
hgwd001.setStatus(HgWdConstant.FileStatus.S_0);
HGWDTools.HgWd001.updateStatus(hgwd001);
}
interaction(hgwd001,hgdm099.getDocName());
}
HGWDTools.interaction(hgwd001,strFileName.substring(0, strFileName.length() - 1));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
......@@ -160,30 +162,4 @@ public class ServiceHGWD099 extends ServiceEPBase {
return inInfo;
}
/**
* 附件上传通知
* @param hgwd001 待变更的项目名称
* @param newName 变更后附件名称
*/
public void interaction(HGWD001 hgwd001,String newName){
try {
if (Objects.nonNull(hgwd001)){
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员
//当前登录用户是否是设计人员,是设计人员则通知项目经理
List<HGWD003> hgwd003s = listByFile.stream().filter(hgwd003 -> hgwd003.getUserId().equals(UserSessionUtils.getUserId()) && hgwd003.getIsProjectManager() == 0).collect(Collectors.toList());
if (hgwd003s.size()>0){
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<String> userIds = listByFile.stream().filter(hgwd003 -> hgwd003.getIsProjectManager() == 1).map(hgwd003 -> hgwd003.getUserId().replace(hgpz009.getLoginPrefix(),"")).distinct().collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(userIds)){
DcOpenApi.interactionAdd(
String.format("[%s]项目上传附件请审核发布", hgwd001.getProjName()),
String.format("上传附件名称[%s]",newName),String.join(",",userIds));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -16,7 +16,8 @@
A.FILE_ID as "fileId", <!-- 文件ID -->
A.USER_ID as "userId", <!-- 用户ID -->
A.REMARK as "remark", <!-- 备注 -->
A.IS_PROJECT_MANAGER as "isProjectManager" <!-- 是否项目经理,0=否,1=是 -->
A.IS_PROJECT_MANAGER as "isProjectManager", <!-- 是否项目经理,0=否,1=是 -->
A.EXT_ID as "extId" <!-- 外部系统ID -->
</sql>
<sql id="columnB">
......@@ -106,11 +107,12 @@
CREATED_NAME, <!-- 记录创建名称 -->
CREATED_TIME, <!-- 记录创建时间 -->
FILE_ID, <!-- 文件ID -->
USER_ID, <!-- 文件ID -->
REMARK <!-- 备注 -->
USER_ID, <!-- 用户ID -->
REMARK, <!-- 备注 -->
EXT_ID <!-- 外部系统ID -->
) VALUES (
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
#fileId#, #userId#, #remark#
#fileId#, #userId#, #remark#, #extId#
)
</insert>
......
......@@ -9,7 +9,8 @@
A.GENDER as "gender", <!-- 性别 -->
A.MOBILE as "mobile", <!-- 手机号 -->
A.EMAIL as "email", <!-- 邮箱 -->
A.ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
A.ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
A.EXT_ID as "extId" <!-- 外部系统主键ID -->
</sql>
<sql id="columnB">
......
......@@ -4,9 +4,13 @@ import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.constant.S3Constant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.extapp.decheng.api.DcOpenApi;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.cw.constant.HgCwSqlConstant;
import com.baosight.hggp.hg.cw.domain.HGCW999;
import com.baosight.hggp.hg.dm.domain.HGDM099;
import com.baosight.hggp.hg.pz.domain.HGPZ009;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.wd.constant.HgWdSqlConstant;
import com.baosight.hggp.hg.wd.domain.HGWD001;
import com.baosight.hggp.hg.wd.domain.HGWD001A;
......@@ -15,13 +19,12 @@ import com.baosight.hggp.hg.wd.domain.HGWD003;
import com.baosight.hggp.hg.wd.domain.HGWD099;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -246,5 +249,42 @@ public class HGWDTools {
return results;
}
public static List<HGWD099> queryByBiz(String bizType, String bizId) {
AssertUtils.isNull(bizType, "业务类型不能为空!");
AssertUtils.isNull(bizId, "业务ID不能为空!");
List<HGWD099> results = DaoBase.getInstance().query(HGWD099.QUERY,
new HashMap<String,Object>(){{put("bizType",bizType); put("bizId",bizId);}}
);
return results;
}
}
/**
* 附件上传通知
* @param hgwd001 待变更的项目名称
* @param changeContent 变更内容
*/
public static void interaction(HGWD001 hgwd001, String changeContent){
try {
if (Objects.nonNull(hgwd001)){
List<HGWD003> listByFile = HGWDTools.HgWd003.listByFile(hgwd001.getFileId()); //获取文件下的权限人员
HGPZ009 hgpz009 = HGPZTools.HgPz009.getByCode(hgwd001.getAccountCode());
List<String> userIds = listByFile.stream().filter(item -> !item.getUserId().equals(UserSessionUtils.getUserId()) && item.getIsProjectManager() == 1)
.map(HGWD003::getExtId)
.filter(ObjectUtils::isNotBlank).distinct().collect(Collectors.toList());
if (userIds.size()>0){
DcOpenApi.interactionAdd(
String.format("[%s]项目变更", hgwd001.getProjName()),
changeContent,
String.join(",",userIds));
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
......@@ -47,6 +47,7 @@ public class User extends DaoEPBase {
public static final String FIELD_DEP_NAME = "depName"; /* 部门名称*/
public static final String FIELD_ID_CODE = "idCode";
public static final String FIELD_ID_CARD = "idCard";
public static final String FIELD_EXT_ID = "extId";
public static final String COL_USER_ID = "USER_ID"; /* 用户ID*/
public static final String COL_LOGIN_NAME = "LOGIN_NAME";
......@@ -101,6 +102,7 @@ public class User extends DaoEPBase {
private String depName = ""; /* 部门名称*/
private String idCode = "";
private String idCard = "";
private String extId = "";
/**
* initialize the metadata.
*/
......@@ -207,6 +209,11 @@ public class User extends DaoEPBase {
eiColumn = new EiColumn(FIELD_ID_CARD);
eiColumn.setDescName("身份证号码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_EXT_ID);
eiColumn.setDescName("外部系统ID");
eiMetadata.addMeta(eiColumn);
}
/**
......@@ -589,6 +596,14 @@ public class User extends DaoEPBase {
this.idCard = idCard;
}
public String getExtId() {
return extId;
}
public void setExtId(String extId) {
this.extId = extId;
}
/**
* get the value from Map.
*
......@@ -622,6 +637,7 @@ public class User extends DaoEPBase {
setDepName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_DEP_NAME)), depName));
setIdCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CODE)), idCode));
setIdCard(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_ID_CARD)), idCard));
setExtId(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_EXT_ID)), extId));
}
/**
......@@ -656,6 +672,7 @@ public class User extends DaoEPBase {
map.put(FIELD_DEP_NAME, StringUtils.toString(depName, eiMetadata.getMeta(FIELD_DEP_NAME)));
map.put(FIELD_ID_CODE, StringUtils.toString(idCode, eiMetadata.getMeta(FIELD_ID_CODE)));
map.put(FIELD_ID_CARD, StringUtils.toString(idCard, eiMetadata.getMeta(FIELD_ID_CARD)));
map.put(FIELD_EXT_ID, StringUtils.toString(extId, eiMetadata.getMeta(FIELD_EXT_ID)));
return map;
}
......
......@@ -304,7 +304,7 @@ public class ServiceHGXSUser extends ServiceBase {
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
// 新增用户
HGXSTools.XsUser.addUser(dbPz009.getAccountCode(), userId, dcUser.getName(), dcUser.getSex(), dcUser.getEmail(),
dcUser.getCardid(), isLock);
dcUser.getCardid(), isLock, dcUserList.getOrd().toString());
// 新增用户和组织机构关系
Map addMap = new HashMap();
addMap.put("orgId", dbPz009.getLoginPrefix() + dcUser.getOrgsid());
......@@ -329,6 +329,7 @@ public class ServiceHGXSUser extends ServiceBase {
// -1:冻结用户,1:正常
String isLock = HGXSUtils.XsUser.convertIsLock(dcUserList.getStatus());
updateMap.put(User.FIELD_IS_LOCKED, isLock);
updateMap.put(User.FIELD_EXT_ID, dcUserList.getOrd());
updateMap.put(User.FIELD_REC_REVISOR, "System");
updateMap.put(User.FIELD_REC_REVISE_TIME, DateUtils.shortDateTime());
dao.update(HgXsSqlConstant.HgXsUser.UPDATE_DC_USER, updateMap);
......
......@@ -9,7 +9,8 @@
GENDER as "gender", <!-- 性别 -->
MOBILE as "mobile", <!-- 手机号 -->
EMAIL as "email", <!-- 邮箱 -->
ACCOUNT_CODE as "accountCode" <!-- 企业编码 -->
ACCOUNT_CODE as "accountCode", <!-- 企业编码 -->
EXT_ID as extId <!-- 外部系统主键ID -->
</sql>
<sql id="condition">
......@@ -124,6 +125,7 @@
EMAIL = #email#,
ID_CARD = #idCard#,
IS_LOCKED = #isLocked#,
EXT_ID = #extId#,
REC_REVISOR = #recRevisor#,
REC_REVISE_TIME = #recReviseTime#
WHERE LOGIN_NAME = #loginName#
......
......@@ -204,13 +204,25 @@ public class HGXSTools {
* @param accountCode
* @param userId
* @param userName
* @throws Exception
*/
public static void addUser(String accountCode, String userId, String userName) throws Exception {
addUser(accountCode, userId, userName, null, null, null, null, null);
}
/**
* 初始化新增用户
*
* @param accountCode
* @param userId
* @param userName
* @param gender
* @param mobile
* @param idCard
* @param isLock
*/
public static void addUser(String accountCode, String userId, String userName, String gender, String mobile,
String idCard, String isLock) throws Exception {
String idCard, String isLock, String extId) throws Exception {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("userId", userId);
inInfoRowMap.put("loginName", userId);
......@@ -223,6 +235,8 @@ public class HGXSTools {
inInfoRowMap.put("idCard", StringUtils.isBlank(idCard) ? " " : idCard);
inInfoRowMap.put("gender", HGXSUtils.XsUser.convertGender(gender));
inInfoRowMap.put("mobile", StringUtils.isBlank(mobile) ? " " : mobile);
inInfoRowMap.put("isLock", isLock);
inInfoRowMap.put("extId", extId);
inInfoRowMap.put("accountCode", accountCode);
EiInfo inInfo = new EiInfo();
inInfo.addBlock("details").addRow(inInfoRowMap);
......
......@@ -17,11 +17,12 @@ $(function () {
//排产
$("#BNT_SCHEDULE").on("click", schedule);
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete'
|| e.eiInfo.extAttr.methodName == 'update') {
query();
}
}
}
});
......@@ -41,28 +42,9 @@ $(window).load(function () {
* 排产
*/
function schedule() {
var planCode = $("#inqu_status-0-planCode").val();
IPLAT.confirm({
title: '提交',
message: '自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产?',
okFn: function () {
var inInfo = new EiInfo();
inInfo.set("inqu_status-0-planCode", planCode);
EiCommunicator.send("HGSC005A", "schedule", inInfo, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
$("#inqu_status-0-isSchedule").val('1');
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "schedule", true);
}
});
}
......@@ -492,6 +492,7 @@ $(function () {
let parentId = IPLATUI.EFTree.categoryTree.selectTreeNode.fileId;
let inEiInfo = new EiInfo();
inEiInfo.set("inqu_status-0-fileId", parentId);
$("#inqu_status-0-changeContent").val('');
//inEiInfo.set("inqu_status-0-isProjectManager", "1");
//inEiInfo.set("inqu_status-0-userId", $("#inqu_status-0-userId").val());
EiCommunicator.send("HGWD003", "query", inEiInfo, {
......@@ -918,14 +919,15 @@ function uploadFileCallback(data) {
inEiInfo.set("result-0-bizId", data.bizId);
inEiInfo.set("result-0-docId", data.docId);
inEiInfo.set("result-0-docName", data.docName);
inEiInfo.set("result-0-docType", data.docType);
inEiInfo.set("result-0-docType", isBlank(data.docType) ? "" : data.docType.substring(1));
inEiInfo.set("result-0-bizType", data.bizType);
inEiInfo.set("result-0-ndocId", data.ndocId);
inEiInfo.set("inqu_status-0-fileId", data.bizId);
let serviceName = data.operType == "add" ? "HGWD099" : "HGWD001";
let methodName = data.operType == "add" ? "insert" : "updateFile";
EiCommunicator.send(serviceName, methodName, inEiInfo, {
onSuccess(response) {
EiCommunicator.send(serviceName, methodName, inEiInfo, {
onSuccess(response) {
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
......@@ -975,6 +977,7 @@ function updateRelease() {
let inEiInfo = new EiInfo();
inEiInfo.addBlock(JSUtils.checkedRows2Block("result"));
inEiInfo.set("inqu_status-0-changeContent", changeContent);
inEiInfo.set("inqu_status-0-fileId", IPLATUI.EFTree.categoryTree.selectTreeNode.fileId);
EiCommunicator.send('HGWD001', 'updateRelease', inEiInfo, {
onSuccess(response) {
if (response.status != -1) {
......@@ -1052,8 +1055,7 @@ function changeResord() {
"&efParentFormEname=HGWD001",
title: "<div style='text-align: center;'>变更记录</div>",
width: "80%",
height: "80%",
callbackName: uploadFileCallback
height: "80%"
});
}
......
......@@ -31,7 +31,7 @@
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="categoryTree" ename="tree_name" textField="text" valueField="label"
hasChildren="leaf" pid="parentId"
serviceName="HGWD001D" methodName="query">
serviceName="HGWD001D" methodName="queryTree">
</EF:EFTree>
</div>
......@@ -65,16 +65,20 @@
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="附件详情" fitHeight="true">
<EF:EFGrid blockId="result" autoDraw="no" personal="true" serviceName="HGWD099" queryMethod="query" deleteMethod="delete">
<EF:EFGrid blockId="result" autoDraw="no" personal="true" serviceName="HGWD099" queryMethod="query"
deleteMethod="delete">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="180" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="180"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center" defaultValue="0" hidden="false">
<EF:EFColumn ename="docType" cname="文件类型" enable="false" width="110"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center"
defaultValue="0" hidden="false">
<EF:EFCodeOption codeName="hggp.hgwd.status"/>
</EF:EFComboColumn>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="140" align="center"/>
parseFormats="['yyyyMMddHHmmss']" editType="datetime"
dateFormat="yyyy-MM-dd HH:mm:ss"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
......
......@@ -263,21 +263,18 @@ let preview = function () {
message("请选择数据");
return;
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"预览\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGWD001B", "add", false,
function (res) {
if (res.status > -1) {
for (let i = 0; i < rows.length; i++) {
window.open(downloadHref(rows[i]['docId'], true), '_blank');
}
} else {
message(res.msg);
}
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);
}
}
});
);
}
/**
......
......@@ -40,7 +40,7 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" queryMethod="query" sort="setted">
<EF:EFGrid blockId="result" autoDraw="override" queryMethod="query" sort="setted" checkMode="row">
<EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="fileId" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="200" align="center" sort="false"
......
......@@ -18,7 +18,7 @@
<div id="menu" style="margin-top: 12px; margin-bottom: 8px">
<EF:EFTree bindId="docTree" ename="node" textField="text" valueField="label" hasChildren="leaf"
serviceName="HGWD003" methodName="queryTree">
serviceName="HGWD001D" methodName="queryTree">
</EF:EFTree>
</div>
</EF:EFRegion>
......
$(document).ready(function () {
let docId = $("#inqu_status-0-docId").val();
if (isBlank(docId)) {
message("文件ID不能为空");
return;
}
fetch(downloadHref(docId, true)).then(res => {
return res.arrayBuffer();
}).then(arrayBuffer => {
renderDocx(arrayBuffer);
});
});
/**
* 渲染word
*
* @param file
*/
function renderDocx(file) {
docx.renderAsync(file, document.getElementById("docx-container")).then((x) => {
console.log("docx: finished")
});
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<script src="${ctx}/common/docxjs/jszip.min.js"></script>
<script src="${ctx}/common/docxjs/docx-preview.js"></script>
<EF:EFPage title="WORD预览">
<EF:EFRegion id="result" title="展示区域" fitHeight="true">
<EF:EFInput cname="文件ID" ename="docId" blockId="inqu_status" row="0" type="hidden"/>
<div id="docx-container"></div>
</EF:EFRegion>
</EF:EFPage>
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -36,7 +36,7 @@ function isInteger(obj) {
* @returns {boolean}
*/
function isPositiveInteger(input) {
var pattern = /^[1-9]\d*$/; // 只能包含非零开头的数字
let pattern = /^[1-9]\d*$/; // 只能包含非零开头的数字
if (pattern.test(input)) {
return true;
} else {
......@@ -85,7 +85,7 @@ function message(msg) {
* @param title
* @param msg
*/
function message2(title,msg) {
function message2(title, msg) {
WindowUtil({
title: title,
content: "<div class='kendo-del-message'>" + msg + "</div>"
......@@ -109,6 +109,21 @@ function downloadHref(docId, isPreview) {
}
/**
* 预览
*
* @param 文件类型,例如:jpg/docx/pdf
* @param 文件ID
*/
function previewDoc(fileType, docId) {
if (!isBlank(fileType) && fileType.toLowerCase() == "docx") {
let url = "HGWD098?inqu_status-0-docId=" + docId;
window.open(url, '_blank');
} else {
window.open(downloadHref(docId, true), '_blank');
}
}
/**
* 获取窗口宽度
*
* @returns {number}
......
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