|
|
@@ -14,6 +14,7 @@ import com.goldenwater.common.core.domain.entity.SysOrganizationExt;
|
|
|
import com.goldenwater.common.core.domain.vo.SysOrganizationInfoVO;
|
|
|
import com.goldenwater.common.utils.SecurityUtils;
|
|
|
import com.goldenwater.common.utils.StringUtils;
|
|
|
+import com.goldenwater.common.utils.uuid.IdUtils;
|
|
|
import com.goldenwater.slaj.hidd.domain.AttOrgBase;
|
|
|
import com.goldenwater.slaj.hidd.domain.AttOrgExt;
|
|
|
import com.goldenwater.slaj.hidd.service.IAttOrgBaseService;
|
|
|
@@ -147,7 +148,7 @@ public class OrgUnifiedCompositeService
|
|
|
return;
|
|
|
}
|
|
|
SysOrganizationExt orgExt = new SysOrganizationExt();
|
|
|
- orgExt.setGuid(deptId);
|
|
|
+ orgExt.setGuid(IdUtils.fastSimpleUUID());
|
|
|
orgExt.setOrgGuid(deptId);
|
|
|
orgExt.setCreateUser(SecurityUtils.getUserId());
|
|
|
orgExt.setCreateTime(nowText());
|
|
|
@@ -249,34 +250,54 @@ public class OrgUnifiedCompositeService
|
|
|
private void insertLegacyByType(String deptId, SysOrganizationInfoVO vo)
|
|
|
{
|
|
|
String orgType = resolveOrgType(vo);
|
|
|
+ String extGuid = resolveExtGuid(deptId);
|
|
|
if (OrgTypeConst.WATER.equals(orgType))
|
|
|
{
|
|
|
insertWaterBase(deptId, vo);
|
|
|
- attOrgExtService.insertAttOrgExt(buildWaterExt(deptId, vo, true));
|
|
|
+ attOrgExtService.insertAttOrgExt(buildWaterExt(extGuid, deptId, vo, true));
|
|
|
}
|
|
|
else if (OrgTypeConst.UWAT.equals(orgType))
|
|
|
{
|
|
|
insertUwatBase(deptId, vo);
|
|
|
- attOrgUwatExtService.insertAttOrgUwatExt(buildUwatExt(deptId, vo, true));
|
|
|
+ attOrgUwatExtService.insertAttOrgUwatExt(buildUwatExt(extGuid, deptId, vo, true));
|
|
|
}
|
|
|
else if (OrgTypeConst.WSUB.equals(orgType))
|
|
|
{
|
|
|
insertUwatBase(deptId, vo);
|
|
|
AttOrgWsub wsub = new AttOrgWsub();
|
|
|
- wsub.setGuid(deptId);
|
|
|
+ wsub.setGuid(extGuid);
|
|
|
wsub.setOrgGuid(deptId);
|
|
|
wsub.setWiunWsubName(vo.getDeptName());
|
|
|
wsub.setSocCreCode(vo.getCode());
|
|
|
+ wsub.setContrQualGrad(vo.getContrQualGrad());
|
|
|
wsub.setLegPers(vo.getLegPers());
|
|
|
wsub.setLegPersTel(vo.getLegPersTel());
|
|
|
+ wsub.setSafePers(vo.getSafePers());
|
|
|
+ wsub.setSafeProdLiceCode(vo.getSafeProdLiceCode());
|
|
|
wsub.setCollTime(new Date());
|
|
|
attOrgWsubService.insertAttOrgWsub(wsub);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 扩展表主键(E)与 dept_id 相互独立:新增时在 sys_organization_ext 上生成,
|
|
|
+ * 其余扩展表(att_org_ext / att_org_uwat_ext / att_org_wsub)沿用同一 E。
|
|
|
+ * 旧数据中 E 已存在,更新时必须复用,绝不能用 dept_id 覆盖。
|
|
|
+ */
|
|
|
+ private String resolveExtGuid(String deptId)
|
|
|
+ {
|
|
|
+ SysOrganizationExt existing = sysOrganizationExtMapper.selectByOrgGuid(deptId);
|
|
|
+ if (existing != null && StringUtils.isNotEmpty(existing.getGuid()))
|
|
|
+ {
|
|
|
+ return existing.getGuid();
|
|
|
+ }
|
|
|
+ return IdUtils.fastSimpleUUID();
|
|
|
+ }
|
|
|
+
|
|
|
private void syncLegacyByType(String deptId, SysOrganizationInfoVO vo)
|
|
|
{
|
|
|
String orgType = resolveOrgType(vo);
|
|
|
+ String extGuid = resolveExtGuid(deptId);
|
|
|
if (OrgTypeConst.WATER.equals(orgType))
|
|
|
{
|
|
|
AttOrgBase base = attOrgBaseService.selectAttOrgBaseByGuid(deptId);
|
|
|
@@ -286,6 +307,7 @@ public class OrgUnifiedCompositeService
|
|
|
up.setGuid(deptId);
|
|
|
up.setOrgName(vo.getDeptName());
|
|
|
up.setStatus(vo.getStatus());
|
|
|
+ up.setOrgType(vo.getType());
|
|
|
up.setModifier(SecurityUtils.getUserId());
|
|
|
attOrgBaseService.updateAttOrgBase(up);
|
|
|
}
|
|
|
@@ -296,13 +318,13 @@ public class OrgUnifiedCompositeService
|
|
|
AttOrgExt ext = attOrgExtService.selectAttOrgExtByOrgGuid(deptId);
|
|
|
if (ext != null)
|
|
|
{
|
|
|
- AttOrgExt up = buildWaterExt(deptId, vo, false);
|
|
|
+ AttOrgExt up = buildWaterExt(extGuid, deptId, vo, false);
|
|
|
up.setGuid(ext.getGuid());
|
|
|
attOrgExtService.updateAttOrgExt(up);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- attOrgExtService.insertAttOrgExt(buildWaterExt(deptId, vo, true));
|
|
|
+ attOrgExtService.insertAttOrgExt(buildWaterExt(extGuid, deptId, vo, true));
|
|
|
}
|
|
|
}
|
|
|
else if (OrgTypeConst.UWAT.equals(orgType))
|
|
|
@@ -314,6 +336,16 @@ public class OrgUnifiedCompositeService
|
|
|
up.setGuid(deptId);
|
|
|
up.setOrgName(vo.getDeptName());
|
|
|
up.setStatus(vo.getStatus());
|
|
|
+ up.setOrgType(vo.getType());
|
|
|
+ up.setOrgCode(vo.getOrgCode());
|
|
|
+ up.setOrgLevel(vo.getOrgLevel());
|
|
|
+ up.setOrdernum(vo.getOrderNum() == null ? null : vo.getOrderNum().longValue());
|
|
|
+ up.setAdCode(vo.getAdCode());
|
|
|
+ up.setJurd(vo.getJurd());
|
|
|
+ up.setAreaType(vo.getAreaType());
|
|
|
+ up.setNodeCode(vo.getNodeCode());
|
|
|
+ up.setOrgGrad(vo.getOrgGrad());
|
|
|
+ up.setNote(vo.getNote());
|
|
|
up.setModifier(SecurityUtils.getUserId());
|
|
|
attOrgUwatBaseService.updateAttOrgUwatBase(up);
|
|
|
}
|
|
|
@@ -326,13 +358,13 @@ public class OrgUnifiedCompositeService
|
|
|
List<AttOrgUwatExt> exts = attOrgUwatExtService.selectAttOrgUwatExtList(extQuery);
|
|
|
if (exts != null && !exts.isEmpty())
|
|
|
{
|
|
|
- AttOrgUwatExt up = buildUwatExt(deptId, vo, false);
|
|
|
+ AttOrgUwatExt up = buildUwatExt(extGuid, deptId, vo, false);
|
|
|
up.setGuid(exts.get(0).getGuid());
|
|
|
attOrgUwatExtService.updateAttOrgUwatExt(up);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- attOrgUwatExtService.insertAttOrgUwatExt(buildUwatExt(deptId, vo, true));
|
|
|
+ attOrgUwatExtService.insertAttOrgUwatExt(buildUwatExt(extGuid, deptId, vo, true));
|
|
|
}
|
|
|
}
|
|
|
else if (OrgTypeConst.WSUB.equals(orgType))
|
|
|
@@ -344,6 +376,16 @@ public class OrgUnifiedCompositeService
|
|
|
up.setGuid(deptId);
|
|
|
up.setOrgName(vo.getDeptName());
|
|
|
up.setStatus(vo.getStatus());
|
|
|
+ up.setOrgType(vo.getType());
|
|
|
+ up.setOrgCode(vo.getOrgCode());
|
|
|
+ up.setOrgLevel(vo.getOrgLevel());
|
|
|
+ up.setOrdernum(vo.getOrderNum() == null ? null : vo.getOrderNum().longValue());
|
|
|
+ up.setAdCode(vo.getAdCode());
|
|
|
+ up.setJurd(vo.getJurd());
|
|
|
+ up.setAreaType(vo.getAreaType());
|
|
|
+ up.setNodeCode(vo.getNodeCode());
|
|
|
+ up.setOrgGrad(vo.getOrgGrad());
|
|
|
+ up.setNote(vo.getNote());
|
|
|
up.setModifier(SecurityUtils.getUserId());
|
|
|
attOrgUwatBaseService.updateAttOrgUwatBase(up);
|
|
|
}
|
|
|
@@ -361,19 +403,25 @@ public class OrgUnifiedCompositeService
|
|
|
up.setOrgGuid(deptId);
|
|
|
up.setWiunWsubName(vo.getDeptName());
|
|
|
up.setSocCreCode(vo.getCode());
|
|
|
+ up.setContrQualGrad(vo.getContrQualGrad());
|
|
|
up.setLegPers(vo.getLegPers());
|
|
|
up.setLegPersTel(vo.getLegPersTel());
|
|
|
+ up.setSafePers(vo.getSafePers());
|
|
|
+ up.setSafeProdLiceCode(vo.getSafeProdLiceCode());
|
|
|
attOrgWsubService.updateAttOrgWsub(up);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
AttOrgWsub wsub = new AttOrgWsub();
|
|
|
- wsub.setGuid(deptId);
|
|
|
+ wsub.setGuid(extGuid);
|
|
|
wsub.setOrgGuid(deptId);
|
|
|
wsub.setWiunWsubName(vo.getDeptName());
|
|
|
wsub.setSocCreCode(vo.getCode());
|
|
|
+ wsub.setContrQualGrad(vo.getContrQualGrad());
|
|
|
wsub.setLegPers(vo.getLegPers());
|
|
|
wsub.setLegPersTel(vo.getLegPersTel());
|
|
|
+ wsub.setSafePers(vo.getSafePers());
|
|
|
+ wsub.setSafeProdLiceCode(vo.getSafeProdLiceCode());
|
|
|
wsub.setCollTime(new Date());
|
|
|
attOrgWsubService.insertAttOrgWsub(wsub);
|
|
|
}
|
|
|
@@ -385,31 +433,61 @@ public class OrgUnifiedCompositeService
|
|
|
AttOrgBase base = new AttOrgBase();
|
|
|
base.setGuid(deptId);
|
|
|
base.setPguid(vo.getParentId());
|
|
|
- base.setOrgCode(StringUtils.isEmpty(vo.getCode()) ? "" : vo.getCode());
|
|
|
+ base.setOrgCode(StringUtils.isEmpty(vo.getOrgCode()) ? "" : vo.getOrgCode());
|
|
|
base.setOrgName(vo.getDeptName());
|
|
|
+ base.setOrgLevel(vo.getOrgLevel());
|
|
|
base.setOrgType(StringUtils.isEmpty(vo.getType()) ? "1" : vo.getType());
|
|
|
base.setStatus(StringUtils.isEmpty(vo.getStatus()) ? "1" : vo.getStatus());
|
|
|
+ base.setOrdernum(vo.getOrderNum() == null ? null : vo.getOrderNum().longValue());
|
|
|
+ base.setAdCode(vo.getAdCode());
|
|
|
+ base.setJurd(vo.getJurd());
|
|
|
+ base.setAreaType(vo.getAreaType());
|
|
|
+ base.setNodeCode(vo.getNodeCode());
|
|
|
+ base.setOrgGrad(vo.getOrgGrad());
|
|
|
+ base.setNote(vo.getNote());
|
|
|
base.setModifier(SecurityUtils.getUserId());
|
|
|
base.setFromDate(new Date());
|
|
|
attOrgBaseService.insertAttOrgBase(base);
|
|
|
}
|
|
|
|
|
|
- private AttOrgExt buildWaterExt(String deptId, SysOrganizationInfoVO vo, boolean withCollTime)
|
|
|
+ private AttOrgExt buildWaterExt(String extGuid, String deptId, SysOrganizationInfoVO vo, boolean withCollTime)
|
|
|
{
|
|
|
AttOrgExt ext = new AttOrgExt();
|
|
|
+ ext.setGuid(extGuid);
|
|
|
ext.setOrgGuid(deptId);
|
|
|
ext.setWiunName(vo.getDeptName());
|
|
|
ext.setSocCreCode(vo.getCode());
|
|
|
+ ext.setOrgClienType(vo.getOrgClienType());
|
|
|
+ ext.setOrgLevel(vo.getOrgLevel());
|
|
|
+ ext.setWiunCode(vo.getWiunCode());
|
|
|
+ ext.setRegName(vo.getRegName());
|
|
|
+ ext.setLegRep(vo.getLegRep());
|
|
|
+ ext.setWiunProp(vo.getWiunProp());
|
|
|
+ ext.setIfWateEnte(vo.getIfWateEnte());
|
|
|
+ ext.setIsLegEnti(vo.getIsLegEnti());
|
|
|
+ ext.setIfMiniDire(vo.getIfMiniDire());
|
|
|
+ ext.setContrQualGrad(vo.getContrQualGrad());
|
|
|
+ ext.setContrCertNum(vo.getContrCertNum());
|
|
|
+ ext.setSupQualGrad(vo.getSupQualGrad());
|
|
|
ext.setAddr(vo.getAddr());
|
|
|
ext.setRegLoc(vo.getRegLoc());
|
|
|
ext.setStanGrad(vo.getStanGrad());
|
|
|
+ ext.setStanCertCode(vo.getStanCertCode());
|
|
|
+ ext.setSafeProdLiceCode(vo.getSafeProdLiceCode());
|
|
|
ext.setFundSour(vo.getFundSour());
|
|
|
+ ext.setEstDate(vo.getEstDate());
|
|
|
+ if (vo.getRegiCapi() != null)
|
|
|
+ {
|
|
|
+ ext.setRegiCapi(vo.getRegiCapi().longValue());
|
|
|
+ }
|
|
|
ext.setLegPers(vo.getLegPers());
|
|
|
ext.setLegPersTel(vo.getLegPersTel());
|
|
|
ext.setSafetyLegPers(vo.getSafetyLegPers());
|
|
|
ext.setSafetyLegPersTel(vo.getSafetyLegPersTel());
|
|
|
ext.setSafeProdConta(vo.getSafeProdConta());
|
|
|
ext.setSafeProdContaTel(vo.getSafeProdContaTel());
|
|
|
+ ext.setNote(vo.getNote());
|
|
|
+ ext.setProOrgGuid(vo.getParentId());
|
|
|
if (vo.getWorkPopNum() != null)
|
|
|
{
|
|
|
ext.setWorkPopNum(vo.getWorkPopNum().longValue());
|
|
|
@@ -426,32 +504,67 @@ public class OrgUnifiedCompositeService
|
|
|
AttOrgUwatBase base = new AttOrgUwatBase();
|
|
|
base.setGuid(deptId);
|
|
|
base.setPguid(vo.getParentId());
|
|
|
- base.setOrgCode(StringUtils.isEmpty(vo.getCode()) ? "" : vo.getCode());
|
|
|
+ base.setOrgCode(StringUtils.isEmpty(vo.getOrgCode()) ? "" : vo.getOrgCode());
|
|
|
base.setOrgName(vo.getDeptName());
|
|
|
+ base.setOrgLevel(vo.getOrgLevel());
|
|
|
base.setOrgType(StringUtils.isEmpty(vo.getType()) ? "3" : vo.getType());
|
|
|
base.setStatus(StringUtils.isEmpty(vo.getStatus()) ? "1" : vo.getStatus());
|
|
|
+ base.setOrdernum(vo.getOrderNum() == null ? null : vo.getOrderNum().longValue());
|
|
|
+ base.setAdCode(vo.getAdCode());
|
|
|
+ base.setJurd(vo.getJurd());
|
|
|
+ base.setAreaType(vo.getAreaType());
|
|
|
+ base.setNodeCode(vo.getNodeCode());
|
|
|
+ base.setOrgGrad(vo.getOrgGrad());
|
|
|
+ base.setNote(vo.getNote());
|
|
|
base.setModifier(SecurityUtils.getUserId());
|
|
|
base.setFromDate(new Date());
|
|
|
attOrgUwatBaseService.insertAttOrgUwatBase(base);
|
|
|
}
|
|
|
|
|
|
- private AttOrgUwatExt buildUwatExt(String deptId, SysOrganizationInfoVO vo, boolean withCollTime)
|
|
|
+ private AttOrgUwatExt buildUwatExt(String extGuid, String deptId, SysOrganizationInfoVO vo, boolean withCollTime)
|
|
|
{
|
|
|
AttOrgUwatExt ext = new AttOrgUwatExt();
|
|
|
- ext.setGuid(deptId);
|
|
|
+ ext.setGuid(extGuid);
|
|
|
ext.setOrgGuid(deptId);
|
|
|
ext.setWiunName(vo.getDeptName());
|
|
|
ext.setSocCreCode(vo.getCode());
|
|
|
+ ext.setOrgClienType(vo.getOrgClienType());
|
|
|
+ ext.setOrgLevel(vo.getOrgLevel());
|
|
|
+ ext.setWiunCode(vo.getWiunCode());
|
|
|
+ ext.setRegName(vo.getRegName());
|
|
|
+ ext.setLegRep(vo.getLegRep());
|
|
|
+ ext.setWiunProp(vo.getWiunProp());
|
|
|
+ ext.setIfWateEnte(vo.getIfWateEnte());
|
|
|
+ ext.setAdminWiunGuid(vo.getAdminWiunGuid());
|
|
|
+ ext.setProOrgGuid(vo.getParentId());
|
|
|
+ ext.setIsLegEnti(vo.getIsLegEnti());
|
|
|
+ ext.setIfMiniDire(vo.getIfMiniDire());
|
|
|
+ ext.setContrQualGrad(vo.getContrQualGrad());
|
|
|
+ ext.setContrCertNum(vo.getContrCertNum());
|
|
|
+ ext.setSupQualGrad(vo.getSupQualGrad());
|
|
|
ext.setAddr(vo.getAddr());
|
|
|
ext.setRegLoc(vo.getRegLoc());
|
|
|
ext.setStanGrad(vo.getStanGrad());
|
|
|
+ ext.setStanCertCode(vo.getStanCertCode());
|
|
|
+ ext.setSafeProdLiceCode(vo.getSafeProdLiceCode());
|
|
|
ext.setFundSour(vo.getFundSour());
|
|
|
+ ext.setEstDate(vo.getEstDate());
|
|
|
+ ext.setRegiCapi(vo.getRegiCapi());
|
|
|
ext.setLegPers(vo.getLegPers());
|
|
|
ext.setLegPersTel(vo.getLegPersTel());
|
|
|
ext.setSafetyLegPers(vo.getSafetyLegPers());
|
|
|
ext.setSafetyLegPersTel(vo.getSafetyLegPersTel());
|
|
|
ext.setSafeProdConta(vo.getSafeProdConta());
|
|
|
ext.setSafeProdContaTel(vo.getSafeProdContaTel());
|
|
|
+ ext.setNote(vo.getNote());
|
|
|
+ if ("3".equals(vo.getType()))
|
|
|
+ {
|
|
|
+ ext.setOrgType("1");
|
|
|
+ }
|
|
|
+ else if ("4".equals(vo.getType()))
|
|
|
+ {
|
|
|
+ ext.setOrgType("2");
|
|
|
+ }
|
|
|
if (vo.getWorkPopNum() != null)
|
|
|
{
|
|
|
ext.setWorkPopNum(vo.getWorkPopNum().longValue());
|