Commit 6d41ed2b by 宋祥

1.删除组织时逻辑错误修正

parent 67529a31
...@@ -12,6 +12,8 @@ import com.baosight.hpjx.hp.sc.tools.HPSCTools; ...@@ -12,6 +12,8 @@ import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.iplat4j.common.ed.domain.TEDCM01; import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import com.baosight.iplat4j.core.data.dao.DaoFactory; import com.baosight.iplat4j.core.data.dao.DaoFactory;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -197,12 +199,6 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -197,12 +199,6 @@ public class ServiceXSOG0801 extends ServiceBase {
for (int i = 0; i < deleteList.size(); ++i) { for (int i = 0; i < deleteList.size(); ++i) {
inInfo.getBlock(EiConstant.resultBlock).getRow(i).put("orgId", orgId); inInfo.getBlock(EiConstant.resultBlock).getRow(i).put("orgId", orgId);
// 清空组织机构下面人员的工人关系
Org org = HPXSTools.XsOrg.get(orgId);
// 校验是否存在进行中的任务
this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
// 清除用工关系
clearHp013(org.getOrgId(), org.getOrgType());
} }
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows()); call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
call.set(EiConstant.serviceId, "S_XS_91"); call.set(EiConstant.serviceId, "S_XS_91");
...@@ -327,39 +323,60 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -327,39 +323,60 @@ public class ServiceXSOG0801 extends ServiceBase {
return outInfo; return outInfo;
} }
/**
* 删除组织机构
*
* @param inInfo
* @return
*/
public EiInfo deleteOrgByEname(EiInfo inInfo) { public EiInfo deleteOrgByEname(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock); try {
List rows = block.getRows(); List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach((m) -> { rows.forEach((row) -> {
Map row = (Map)m;
row.put("recRevisor", UserSession.getLoginName()); row.put("recRevisor", UserSession.getLoginName());
String orgId = MapUtils.getString(row, "orgEname");
// 清空组织机构下面人员的工人关系
Org org = HPXSTools.XsOrg.get(orgId);
// 校验是否存在进行中的任务
this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
// 清除用工关系
clearHp013(org.getOrgId(), org.getOrgType());
}); });
EiInfo call = new EiInfo(); EiInfo call = new EiInfo();
call.set("list", rows); call.set("list", rows);
call.set(EiConstant.serviceId, "S_XS_88"); call.set(EiConstant.serviceId, "S_XS_88");
EiInfo result = XServiceManager.call(call); inInfo = XServiceManager.call(call);
if (result.getStatus() > 0) { if (inInfo.getStatus() > 0) {
for(int i = 0; i < rows.size(); ++i) { for (int i = 0; i < rows.size(); ++i) {
Map param = (Map)rows.get(i); Map param = (Map) rows.get(i);
List orgs = this.dao.query("XSOG01.queryOrgInfo", param); List orgs = this.dao.query("XSOG01.queryOrgInfo", param);
for(int j = 0; j < orgs.size(); ++j) { for (int j = 0; j < orgs.size(); ++j) {
Map memberMap = new HashMap(); Map memberMap = new HashMap();
memberMap.put("orgId", ((Map)orgs.get(j)).get("orgId")); memberMap.put("orgId", ((Map) orgs.get(j)).get("orgId"));
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap); this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
} }
} }
} }
} catch (Exception e) {
return result; LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
} }
/**
* 删除组织及子节点
*
* @param inInfo
* @return
*/
public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) { public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock); try {
List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map idMap = new HashMap(); Map idMap = new HashMap();
int sum = 0; int sum = 0;
for(int i = 0; i < block.getRowCount(); ++i) { for (int i = 0; i < rows.size(); ++i) {
String orgId = block.getCell(i, "orgId").toString(); String orgId = rows.get(i).get("orgId").toString();
Map orgIdMap = new HashMap(); Map orgIdMap = new HashMap();
orgIdMap.put("orgId", orgId); orgIdMap.put("orgId", orgId);
List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap); List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap);
...@@ -383,6 +400,9 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -383,6 +400,9 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
} }
inInfo.setMsg("删除[" + sum + "]条记录成功"); inInfo.setMsg("删除[" + sum + "]条记录成功");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo; return inInfo;
} }
......
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