Commit 03041e56 by 江和松

物料清单附件详情功能修改

parent afb96ac9
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.tools.EDTools;
import com.baosight.hggp.hg.ds.domain.HGDS002;
import com.baosight.hggp.hg.sc.domain.HGSC099;
import com.baosight.hggp.hg.sj.domain.HGSJ003;
import com.baosight.hggp.util.FileUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author wwl
* @Date 2024/5/6 19:48
*/
public class ServiceHGSC004B extends ServiceEPBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC099().eiMetadata);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
try {
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
List<Map<String, Object>> EDCM01List = EDTools.EdCm01.list("hggp.sc.bizType");
if(!CollectionUtils.isEmpty(EDCM01List)){
List<String> bizTypes = new ArrayList<>();
for(Map<String, Object> map : EDCM01List){
bizTypes.add(map.get("itemCode").toString());
}
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, "bizTypes",bizTypes);
}
if (CommonConstant.projectEnv.RUN.equalsIgnoreCase(projectEnv)) {
inInfo = super.query(inInfo, "HGSC099.queryRun", new HGSC099());
} else {
inInfo = super.query(inInfo, "HGSC099.queryDev", new HGSC099());
}
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 新增操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGSC099 hgsc099 = new HGSC099();
hgsc099.fromMap(resultRows.get(i));
DaoUtils.insert(HGSC099.INSERT, hgsc099);
}
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据新增成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < resultRows.size(); i++) {
HGSC099 hgsc099 = new HGSC099();
hgsc099.fromMap(resultRows.get(i));
DaoUtils.update(HGSC099.DELETE, hgsc099);
if (!hgsc099.getDocId().isEmpty()) {
this.delectDoc(hgsc099.getDocId());
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
/**
* 删除文件
* @param docId 文件ID
*/
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<HGDS002> list = this.dao.query(HGDS002.QUERY,map);
if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
// 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo queryInfo = new EiInfo();
queryInfo.set(HGSC099.FIELD_doc_id,list.get(0).getDocId());
//获取文档信息
queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}
}else {
FileUtils.deleteFile(realPath);
}
this.dao.delete(HGDS002.DELETE,map);
}
}
}
package com.baosight.hggp.hg.sc.service;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
/**
*
*/
public class ServiceHGSC004C extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
return inInfo;
}
/**
* 附件上传.
*/
public EiInfo form(EiInfo inInfo) {
return inInfo;
}
}
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
Version : 1.0 Version : 1.0
schema : hggp schema : hggp
tableName : HGSC099 tableName : HGSC099
id BIGINT NOT NULL primarykey, id BIGINT NOT NULL primarykey,
account_code VARCHAR NOT NULL, account_code VARCHAR NOT NULL,
mat_id BIGINT, mat_id BIGINT,
doc_id VARCHAR, doc_id VARCHAR,
created_by VARCHAR, created_by VARCHAR,
created_name VARCHAR, created_name VARCHAR,
created_time VARCHAR, created_time VARCHAR,
updated_by VARCHAR, updated_by VARCHAR,
updated_name VARCHAR, updated_name VARCHAR,
updated_time VARCHAR, updated_time VARCHAR,
biz_type VARCHAR biz_type VARCHAR
--> -->
<sqlMap namespace="HGSC099"> <sqlMap namespace="HGSC099">
...@@ -72,6 +72,9 @@ ...@@ -72,6 +72,9 @@
<isNotEmpty prepend=" AND " property="matId"> <isNotEmpty prepend=" AND " property="matId">
A.MAT_ID = #matId# A.MAT_ID = #matId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="bizTypes">
A.BIZ_TYPE IN <iterate close=")" open="(" conjunction="," property="bizTypes">#bizTypes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docId"> <isNotEmpty prepend=" AND " property="docId">
A.DOC_ID = #docId# A.DOC_ID = #docId#
</isNotEmpty> </isNotEmpty>
......
...@@ -233,7 +233,7 @@ function showDetail(id,companyCode,projCode) { ...@@ -233,7 +233,7 @@ function showDetail(id,companyCode,projCode) {
*/ */
function showUploadFile(id) { function showUploadFile(id) {
JSColorbox.open({ JSColorbox.open({
href: "HGSC099?methodName=initLoad&inqu_status-0-bizType=WLQD&inqu_status-0-matId=" + id, href: "HGSC004B?methodName=initLoad&inqu_status-0-matId=" + id,
title: "<div style='text-align: center;'>附件详情</div>", title: "<div style='text-align: center;'>附件详情</div>",
width: "80%", width: "80%",
height: "80%", height: "80%",
......
...@@ -52,7 +52,7 @@ var query = function (e) { ...@@ -52,7 +52,7 @@ var query = function (e) {
*/ */
function uploadFile(id) { function uploadFile(id) {
JSColorbox.open({ JSColorbox.open({
href: "HGSC099A?methodName=initLoad&inqu_status-0-bizType="+$("#inqu_status-0-bizType").val()+"&inqu_status-0-matId="+$("#inqu_status-0-matId").val(), href: "HGSC004C?methodName=initLoad&inqu_status-0-matId="+$("#inqu_status-0-matId").val(),
title: "<div style='text-align: center;'>附件上传</div>", title: "<div style='text-align: center;'>附件上传</div>",
width: "60%", width: "60%",
height: "50%", height: "50%",
...@@ -65,12 +65,12 @@ function uploadFile(id) { ...@@ -65,12 +65,12 @@ function uploadFile(id) {
* *
* @param docId * @param docId
*/ */
function uploadFileCallback(docId) { function uploadFileCallback(docId,bizType) {
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
inEiInfo.set("result-0-matId", $("#inqu_status-0-matId").val()); inEiInfo.set("result-0-matId", $("#inqu_status-0-matId").val());
inEiInfo.set("result-0-docId", docId); inEiInfo.set("result-0-docId", docId);
inEiInfo.set("result-0-bizType", $("#inqu_status-0-bizType").val()); inEiInfo.set("result-0-bizType", bizType);
EiCommunicator.send('HGSC099', 'insert', inEiInfo, { EiCommunicator.send('HGSC004B', 'insert', inEiInfo, {
onSuccess(response) { onSuccess(response) {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
}, },
...@@ -93,7 +93,7 @@ function deleteFunc() { ...@@ -93,7 +93,7 @@ function deleteFunc() {
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作?", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGSC099", "delete", true); JSUtils.submitGridsData("result", "HGSC004B", "delete", true);
} }
}) })
} }
...@@ -8,8 +8,11 @@ ...@@ -8,8 +8,11 @@
<EF:EFPage title="附件清单"> <EF:EFPage title="附件清单">
<EF:EFRegion id="inqu" title="查询区域" type="query"> <EF:EFRegion id="inqu" title="查询区域" type="query">
<EF:EFInput cname="主表ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="主表ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row"> <div class="row">
<EF:EFSelect cname="文件类型" ename="inqu_status-0-bizType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.sc.bizType" />
</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" />
</div> </div>
</EF:EFRegion> </EF:EFRegion>
...@@ -19,6 +22,9 @@ ...@@ -19,6 +22,9 @@
<EF:EFColumn ename="id" cname="ID" hidden="true"/> <EF:EFColumn ename="id" cname="ID" hidden="true"/>
<EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/> <EF:EFColumn ename="docId" cname="文件ID" enable="false" width="150"/>
<EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/> <EF:EFColumn ename="docName" cname="文件名称" enable="false" width="150"/>
<EF:EFComboColumn ename="bizType" cname="文件类型" width="80" align="center" enable="false" required="false">
<EF:EFCodeOption codeName="hggp.sc.bizType" />
</EF:EFComboColumn>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/> parseFormats="['yyyyMMddHHmmss']" editType="datetime" dateFormat="yyyy-MM-dd HH:mm:ss"/>
<EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/> <EF:EFColumn ename="operator" cname="操作" enable="false" width="200" align="center"/>
......
...@@ -13,7 +13,7 @@ $(function () { ...@@ -13,7 +13,7 @@ $(function () {
console.log($("#fileDocId").val()) console.log($("#fileDocId").val())
saveTemp(e); saveTemp(e);
try { try {
parent.JSColorbox.setValueCallback(docId); parent.JSColorbox.setValueCallback(docId,$("#inqu_status-0-bizType").val());
} catch (e){ } catch (e){
} }
}, },
......
...@@ -7,7 +7,10 @@ ...@@ -7,7 +7,10 @@
<EF:EFPage title="附件上传"> <EF:EFPage title="附件上传">
<EF:EFInput cname="主表ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/> <EF:EFInput cname="主表ID" ename="matId" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="业务类型" ename="bizType" blockId="inqu_status" row="0" type="hidden"/> <EF:EFSelect cname="业务类型" ename="inqu_status-0-bizType" colWidth="3" filter="contains">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hggp.sc.bizType" />
</EF:EFSelect>
<EF:EFRegion id="result"> <EF:EFRegion id="result">
<EF:EFUpload blockId="result" ename="uploadFile" docTag="hk_file11" path="HGSC"/> <EF:EFUpload blockId="result" ename="uploadFile" docTag="hk_file11" path="HGSC"/>
</EF:EFRegion> </EF:EFRegion>
......
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