Commit 2532f8b5 authored by tianbo's avatar tianbo

修改bug6259

parent 542a9b05
...@@ -116,14 +116,14 @@ public class OrgPersonController extends BaseController { ...@@ -116,14 +116,14 @@ public class OrgPersonController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/{id}", method = RequestMethod.PUT) @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新人员数据", notes = "更新人员数据") @ApiOperation(httpMethod = "PUT", value = "更新人员数据", notes = "更新人员数据")
public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto OrgPersonVo, public ResponseModel<?> updateByIdOrgUsr(HttpServletRequest request, @RequestBody OrgPersonDto orgPersonDto,
@PathVariable Long id) throws Exception { @PathVariable Long id) throws Exception {
OrgPersonVo.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); orgPersonDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
/*同步修改关联账号用户名 chenzhao*/ /*同步修改关联账号用户名 chenzhao*/
AgencyUserModel amosUser = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult(); AgencyUserModel amosUser = Privilege.agencyUserClient.queryByUserId(orgPersonDto.getAmosOrgId()).getResult();
OrgPersonVo.setAmosOrgCode(amosUser.getRealName()); orgPersonDto.setAmosOrgCode(amosUser.getRealName());
return ResponseHelper.buildResponse( iOrgUsrService.updateByIdOrgPerson(OrgPersonVo, id)); return ResponseHelper.buildResponse( iOrgUsrService.updateByIdOrgPerson(orgPersonDto, id));
} }
......
...@@ -667,15 +667,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -667,15 +667,14 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
@Override @Override
public void saveOrgUsr(OrgUsr orgUsr, OrgUsr oriOrgUsr) throws Exception { public void saveOrgUsr(OrgUsr orgUsr, OrgUsr oldOrgUsr) throws Exception {
if (oriOrgUsr.getParentId() != oriOrgUsr.getParentId()) { if (!orgUsr.getParentId().equals(oldOrgUsr.getParentId())) {
OrgUsr parent = getById(orgUsr.getParentId()); OrgUsr parent = getById(orgUsr.getParentId());
if (parent != null && !ObjectUtils.isEmpty(parent.getBizOrgCode())) { if (parent != null && !ObjectUtils.isEmpty(parent.getBizOrgCode())) {
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
} }
updateChildOrgCode(oriOrgUsr.getBizOrgCode(), orgUsr.getBizOrgCode()); updateChildOrgCode(oldOrgUsr.getBizOrgCode(), orgUsr.getBizOrgCode());
orgUsr.setParentId(oriOrgUsr.getParentId());
} }
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult(); AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
orgUsr.setRecDate(new Date()); orgUsr.setRecDate(new Date());
...@@ -1077,44 +1076,45 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1077,44 +1076,45 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
@Override @Override
public OrgPersonDto updateByIdOrgPerson(OrgPersonDto OrgPersonVo, Long id) throws Exception { public OrgPersonDto updateByIdOrgPerson(OrgPersonDto orgPersonDto, Long id) throws Exception {
try { try {
updatePersonNumber(id, OrgPersonVo); updatePersonNumber(id, orgPersonDto);
} catch (Exception e) { } catch (Exception e) {
logger.info("同步修改培训计划中的人员编号:---------------" + id); logger.info("同步修改培训计划中的人员编号:---------------" + id);
} }
// 修改人员信息 // 修改人员信息
OrgUsr orgUsr = new OrgUsr(); OrgUsr orgUsr = new OrgUsr();
OrgUsr oriOrgUsr = getById(id); OrgUsr oldOrgUsr = getById(id);
BeanUtils.copyProperties(OrgPersonVo, orgUsr); BeanUtils.copyProperties(orgPersonDto, orgUsr);
/* /*
* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 * Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召
* 开始 * 开始
*/ */
OrgUsr parent = getById(OrgPersonVo.getParentId()); // 下面saveOrgUsr有处理逻辑,这段代码多余
if (parent != null) { // OrgUsr parent = getById(OrgPersonVo.getParentId());
orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr()); // if (parent != null) {
} // orgUsr.setBizOrgCode(parent.getBizOrgCode() + getOrgCodeStr());
// }
/* /*
* Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召 * Bug 2647 编辑用户所属单位后按单位筛选人员结果错误 增加了 638 639 两行代码 根据修改的部门调整部门code 2021-09-03 陈召
* 结束 * 结束
*/ */
orgUsr.setSequenceNbr(id); orgUsr.setSequenceNbr(id);
if (!ObjectUtils.isEmpty(OrgPersonVo.getAmosOrgId())) { if (!ObjectUtils.isEmpty(orgPersonDto.getAmosOrgId())) {
AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(OrgPersonVo.getAmosOrgId()).getResult(); AgencyUserModel user = Privilege.agencyUserClient.queryByUserId(orgPersonDto.getAmosOrgId()).getResult();
// oriOrgUsr.setAmosOrgCode(user.getRealName()); 去掉AmosOrgCode by litw // oldOrgUsr.setAmosOrgCode(user.getRealName()); 去掉AmosOrgCode by litw
// 2021年9月10日 // 2021年9月10日
oriOrgUsr.setAmosOrgId(user.getUserId()); oldOrgUsr.setAmosOrgId(user.getUserId());
// orgUsr.setAmosOrgCode(user.getRealName()); 去掉AmosOrgCode by litw 2021年9月10日 // orgUsr.setAmosOrgCode(user.getRealName()); 去掉AmosOrgCode by litw 2021年9月10日
orgUsr.setAmosOrgId(user.getUserId()); orgUsr.setAmosOrgId(user.getUserId());
} }
saveOrgUsr(orgUsr, oriOrgUsr); saveOrgUsr(orgUsr, oldOrgUsr);
// 保存动态表单数据 // 保存动态表单数据
updateDynamicFormInstance(orgUsr.getSequenceNbr(), OrgPersonVo.getDynamicFormValue()); updateDynamicFormInstance(orgUsr.getSequenceNbr(), orgPersonDto.getDynamicFormValue());
if (orgUsr.getBizOrgCode() != null) { if (orgUsr.getBizOrgCode() != null) {
OrgPersonVo.setBizOrgCode(orgUsr.getBizOrgCode()); orgPersonDto.setBizOrgCode(orgUsr.getBizOrgCode());
} }
return OrgPersonVo; return orgPersonDto;
} }
void updatePersonNumber(Long id, OrgPersonDto OrgPersonVo) { void updatePersonNumber(Long id, OrgPersonDto OrgPersonVo) {
...@@ -2789,7 +2789,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2789,7 +2789,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public OrgUsr peopleSaveOrgUsr(PeopleBasicInfoDto peopleBasicInfoDto) { public OrgUsr peopleSaveOrgUsr(PeopleBasicInfoDto peopleBasicInfoDto) {
OrgUsr orgUsr = new OrgUsr(); OrgUsr orgUsr = new OrgUsr();
orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON); orgUsr.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
orgUsr.setBizOrgCode(peopleBasicInfoDto.getBizOrgCode()); if (ValidationUtil.isEmpty(peopleBasicInfoDto.getSequenceNbr())) { // 新增
// cb_org_user表biz_org_code表示该资源自己的编码,同一单位下唯一。只用父单位bizOrgCode会引起bug6259,遂改为父单位bizOrgCode + getOrgCodeStr()
orgUsr.setBizOrgCode(peopleBasicInfoDto.getBizOrgCode() + getOrgCodeStr());
} else { // 编辑
OrgUsr o = getById(peopleBasicInfoDto.getSequenceNbr());
orgUsr.setBizOrgCode(o.getBizOrgCode());
}
orgUsr.setAmosOrgId(peopleBasicInfoDto.getAmosUserId()); orgUsr.setAmosOrgId(peopleBasicInfoDto.getAmosUserId());
orgUsr.setAmosOrgCode(peopleBasicInfoDto.getAmosName()); orgUsr.setAmosOrgCode(peopleBasicInfoDto.getAmosName());
orgUsr.setBizOrgName(peopleBasicInfoDto.getName()); orgUsr.setBizOrgName(peopleBasicInfoDto.getName());
......
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