Commit ffac3607 by zhangxingmin

push

parent 95c37c45
...@@ -103,6 +103,9 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService { ...@@ -103,6 +103,9 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService {
private IAgentManageRelationService iAgentManageRelationService; private IAgentManageRelationService iAgentManageRelationService;
@Resource @Resource
private IAgentAccumulatedFycService iAgentAccumulatedFycService;
@Resource
private ITeamService iTeamService; private ITeamService iTeamService;
@Resource @Resource
...@@ -446,6 +449,9 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService { ...@@ -446,6 +449,9 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService {
/** /**
* 编辑-人员信息 * 编辑-人员信息
* 编辑说明:
* 1、由于老数据的原因,详情返回的人员信息,初始化等级和所属团队,根据返回的数据,来决定是只读还是能修改。返回有数据只读,返回无数据可以修改。其他基础信息字段可以修改。
* 2、银行信息和组织信息不能修改,只读状态。
* @param request * @param request
* @return * @return
*/ */
...@@ -463,6 +469,7 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService { ...@@ -463,6 +469,7 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService {
if (csfClientUser == null) { if (csfClientUser == null) {
throw new BusinessException("人员信息不存在"); throw new BusinessException("人员信息不存在");
} }
String teamBizId = csfClientUser.getTeamBizId();
BeanUtils.copyProperties(userDTO,csfClientUser); BeanUtils.copyProperties(userDTO,csfClientUser);
//校验入参的所属团队和一级管理人所属团队是否匹配 //校验入参的所属团队和一级管理人所属团队是否匹配
...@@ -492,6 +499,43 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService { ...@@ -492,6 +499,43 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService {
.atZone(ZoneId.of("GMT+8")) .atZone(ZoneId.of("GMT+8"))
.toLocalDateTime() : null); .toLocalDateTime() : null);
//校验是否需要初始化等级
//查询积分总表记录,校验是否初始化了等级,没有就新增,有就无需处理。
AgentAccumulatedFyc agentAccumulatedFyc = iAgentAccumulatedFycService.lambdaQuery()
.eq(AgentAccumulatedFyc::getAgentId,csfClientUser.getClientUserBizId())
.last(" limit 1 ").one();
if (agentAccumulatedFyc == null) {
//没有初始化过等级,必须传值初始化
//根据初始化职级,fyc表(业务员累计积分表 - 存储业务员的累计FYC积分和当前等级信息)新增初始化记录
ApiInitAgentAccumulatedFycRequest fycRequest = new ApiInitAgentAccumulatedFycRequest();
fycRequest.setAgentId(csfClientUser.getClientUserBizId());
fycRequest.setAgentName(csfClientUser.getName());
fycRequest.setInitGrade(userDTO.getInitGradeCode());
apiAgentAccumulatedFycService.initAgentAccumulatedFyc(fycRequest);
}else {
//积分总表的初始等级和当前等级回写更新到人员信息表中
csfClientUser.setInitGradeCode(agentAccumulatedFyc.getInitGrade());
csfClientUser.setCurrentGradeCode(agentAccumulatedFyc.getCurrentGradeCode());
}
//查询当前人员的管理关系数据
AgentManageRelation agentManageRelation = iAgentManageRelationService.lambdaQuery()
.eq(AgentManageRelation::getAgentId,csfClientUser.getClientUserBizId())
.last(" limit 1 ")
.one();
//处理所属团队数据=>如果之前老数据中没有所属团队并且管理关系处于最高节点。那么就生成团队表数据,回写更新。
if (StringUtils.isBlank(teamBizId) && (agentManageRelation != null && agentManageRelation.getPid() == null)) {
//新增团队信息
Team team = new Team();
team.setTeamName(userDTO.getTeamName());
team.setPid("0");
team.setTeamBizId(RandomStringGenerator.generateBizId16(CommonEnum.UID_TYPE_TEAM.getCode()));
//团队长
team.setTeamLeaderId(csfClientUser.getClientUserBizId());
team.setTeamLevel(1);
iTeamService.saveOrUpdate(team);
csfClientUser.setTeamBizId(team.getTeamBizId());
}
csfClientUserService.saveOrUpdate(csfClientUser); csfClientUserService.saveOrUpdate(csfClientUser);
//根据绑定的基本法配置,新增基本法绑定表记录 //根据绑定的基本法配置,新增基本法绑定表记录
...@@ -785,7 +829,7 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService { ...@@ -785,7 +829,7 @@ public class ApiCsfClientUserServiceImpl implements ApiCsfClientUserService {
manageRelation.setAgentId(csfClientUser.getClientUserBizId()); manageRelation.setAgentId(csfClientUser.getClientUserBizId());
manageRelation.setManageId(agentManageRelation.getAgentId()); manageRelation.setManageId(agentManageRelation.getAgentId());
//二级管理人ID => 根据需求,如果一级管理人没有上级,那么二级就是默认是一级管理人作为二级 //二级管理人ID => 根据需求,如果一级管理人没有上级,那么二级就是默认是一级管理人作为二级
manageRelation.setSManageId(agentManageRelation.getSManageId()); manageRelation.setSManageId(agentManageRelation.getAgentId());
manageRelation.setPid(agentManageRelation.getAgentId()); manageRelation.setPid(agentManageRelation.getAgentId());
manageRelation.setIsActive(1); manageRelation.setIsActive(1);
iAgentManageRelationService.saveOrUpdate(manageRelation); iAgentManageRelationService.saveOrUpdate(manageRelation);
......
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