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,62 +323,86 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -327,62 +323,86 @@ 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");
}); // 清空组织机构下面人员的工人关系
EiInfo call = new EiInfo(); Org org = HPXSTools.XsOrg.get(orgId);
call.set("list", rows); // 校验是否存在进行中的任务
call.set(EiConstant.serviceId, "S_XS_88"); this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
EiInfo result = XServiceManager.call(call); // 清除用工关系
if (result.getStatus() > 0) { clearHp013(org.getOrgId(), org.getOrgType());
for(int i = 0; i < rows.size(); ++i) { });
Map param = (Map)rows.get(i); EiInfo call = new EiInfo();
List orgs = this.dao.query("XSOG01.queryOrgInfo", param); call.set("list", rows);
call.set(EiConstant.serviceId, "S_XS_88");
for(int j = 0; j < orgs.size(); ++j) { inInfo = XServiceManager.call(call);
Map memberMap = new HashMap(); if (inInfo.getStatus() > 0) {
memberMap.put("orgId", ((Map)orgs.get(j)).get("orgId")); for (int i = 0; i < rows.size(); ++i) {
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap); Map param = (Map) rows.get(i);
List orgs = this.dao.query("XSOG01.queryOrgInfo", param);
for (int j = 0; j < orgs.size(); ++j) {
Map memberMap = new HashMap();
memberMap.put("orgId", ((Map) orgs.get(j)).get("orgId"));
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
}
} }
} }
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
} }
return inInfo;
return result;
} }
/**
* 删除组织及子节点
*
* @param inInfo
* @return
*/
public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) { public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock); try {
Map idMap = new HashMap(); List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
int sum = 0; Map idMap = new HashMap();
for(int i = 0; i < block.getRowCount(); ++i) { int sum = 0;
String orgId = block.getCell(i, "orgId").toString(); for (int i = 0; i < rows.size(); ++i) {
Map orgIdMap = new HashMap(); String orgId = rows.get(i).get("orgId").toString();
orgIdMap.put("orgId", orgId); Map orgIdMap = new HashMap();
List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap); orgIdMap.put("orgId", orgId);
for (int j = 0; j < orgIdChildList.size(); ++j) { List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap);
Map childMap = ((Map) orgIdChildList.get(j)); for (int j = 0; j < orgIdChildList.size(); ++j) {
String childOrgId = childMap.get("ORG_ID").toString(); Map childMap = ((Map) orgIdChildList.get(j));
String childOrgName = childMap.get("ORG_CNAME").toString(); String childOrgId = childMap.get("ORG_ID").toString();
String childOrgType = childMap.get("ORG_TYPE").toString(); String childOrgName = childMap.get("ORG_CNAME").toString();
// 校验是否存在进行中的任务 String childOrgType = childMap.get("ORG_TYPE").toString();
this.checkExistsTask(childOrgId, childOrgName, childOrgType); // 校验是否存在进行中的任务
idMap.put("orgId", childOrgId); this.checkExistsTask(childOrgId, childOrgName, childOrgType);
idMap.put("recRevisor", UserSession.getLoginName()); idMap.put("orgId", childOrgId);
idMap.put("recReviseTime", DateUtils.curDateTimeStr14()); idMap.put("recRevisor", UserSession.getLoginName());
this.dao.update("XSOG01.deleteOrg", idMap); idMap.put("recReviseTime", DateUtils.curDateTimeStr14());
Map memberMap = new HashMap(); this.dao.update("XSOG01.deleteOrg", idMap);
memberMap.put("orgId", ((Map) orgIdChildList.get(j)).get("ORG_ID")); Map memberMap = new HashMap();
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap); memberMap.put("orgId", ((Map) orgIdChildList.get(j)).get("ORG_ID"));
// 清除用工关系 this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
clearHp013(childOrgId, childOrgType); // 清除用工关系
++sum; clearHp013(childOrgId, childOrgType);
++sum;
}
} }
inInfo.setMsg("删除[" + sum + "]条记录成功");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
} }
inInfo.setMsg("删除[" + sum + "]条记录成功");
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