'feat():完成HPSC001与HPSC002的数据交互'

parent 47a6907d
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.hp.sc.domain.THPSC002;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.hpjx.hp.sc.domain.THPSC001;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.*;
/**
*
......@@ -18,7 +19,6 @@ import java.util.Map;
public class ServiceHPSC001 extends ServiceBase {
/**
* 画面初始化.
*/
......@@ -110,8 +110,8 @@ public class ServiceHPSC001 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
this.dao.delete("HPPZ001.delete", hpsc001.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
......@@ -126,4 +126,67 @@ public class ServiceHPSC001 extends ServiceBase {
return eiInfo;
}
/**
* 审核 反审.
*/
public EiInfo check(EiInfo eiInfo) {
THPSC001 hpsc001 = new THPSC001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
this.dao.update("HPSC001.check", hpsc001.toMap());
if(hpsc001.getStatus() == 1){
Map sqlMap = new HashMap();
sqlMap.put("id",hpsc001.getId());
List<Map> rows = this.dao.query("HPSC001.query",sqlMap);
eiInfo.getBlock(EiConstant.resultBlock).setRows(rows);
this.buildHPSC002(eiInfo);
}
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
public void buildHPSC002(EiInfo eiInfo) {
THPSC001 hpsc001 = new THPSC001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
List rows = new ArrayList();
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
Map hpsc002 = new HashMap();
hpsc002.put("companyCode", hpsc001.getCompanyCode());
hpsc002.put("deptCode", hpsc001.getDepCode());
hpsc002.put("projCode", hpsc001.getProjCode());
hpsc002.put("projName", hpsc001.getProjName());
hpsc002.put("parentPrdtCode", "root"); //固定写死
hpsc002.put("parentPrdtName", hpsc001.getProjName());
hpsc002.put("type", "");
hpsc002.put("leaf", "0");
hpsc002.put("sort", "");
hpsc002.put("icon", "");
hpsc002.put("prdtCode", hpsc001.getProjCode());
hpsc002.put("prdtName", hpsc001.getProjName());
rows.add(hpsc002);
}
eiBlock.setRows(rows);
eiInfo.set(EiConstant.serviceName, "HPSC002");
eiInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
}
......@@ -192,13 +192,6 @@ public class ServiceHPSC002 extends ServiceBase {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
Map sqlMap = new HashMap();
sqlMap.put("id",hppz002.getId());
if(hppz002.getStatus() == 0){
sqlMap.put("status",1);
}else{
sqlMap.put("status",0);
}
this.dao.update("HPSC002.check", hppz002.toMap());
}
} catch (PlatException e) {
......
......@@ -163,5 +163,8 @@
</isNotEmpty>
ORDER BY PROJ_CODE
</select>
<update id="check">
UPDATE hpjx.t_hpsc001 SET status = #status# WHERE ID = #id#
</update>
</sqlMap>
\ No newline at end of file
......@@ -11,5 +11,41 @@ $(function () {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',1)" >审核</a>';
} else {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',0)" >反审</a>';
}
return template;
}
}
],
}
});
\ No newline at end of file
});
function check(id, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", auditStatus);
EiCommunicator.send('HPSC001', 'check', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
......@@ -35,7 +35,7 @@
<EF:EFOption label="已审核" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -44,4 +44,4 @@
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/PZ/HPSC001.js"></script>
\ No newline at end of file
<script src="${ctx}/HP/SC/HPSC001.js"></script>
\ No newline at end of file
......@@ -50,7 +50,7 @@ $(function () {
result: {
pageable: {
pageSize: 10,
pageSizes: [10, 20, 50, 70, 100],
pageSizes: [10, 20, 50, 100,200],
},
loadComplete: function (grid) { // 在Grid加载完成后,才能给Grid上的按钮绑定事件
$("#SC02").on("click", function () {
......@@ -218,24 +218,6 @@ function openUploadFile(id) {
rowId = id;
}
function donwloadFile(id, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", auditStatus);
EiCommunicator.send('HPZL001', 'operator', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
function check(id, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
......
......@@ -60,7 +60,7 @@
<EF:EFOption label="" value="1"></EF:EFOption>
<EF:EFOption label="删除" value="0"></EF:EFOption>
</EF:EFComboColumn>
<EF:EFColumn ename="operator" cname="操作" width="200" readonly="false"/>
<EF:EFColumn ename="operator" cname="操作" width="200" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
......
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