|
|
@ -2,6 +2,7 @@ package com.ccsens.experiment.service; |
|
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.cloudutil.bean.tall.dto.ProjectDto; |
|
|
|
import com.ccsens.cloudutil.feign.Tall3FeignClient; |
|
|
|
import com.ccsens.experiment.bean.dto.OrganizationDto; |
|
|
|
import com.ccsens.experiment.bean.po.OrganizationMember; |
|
|
@ -12,6 +13,7 @@ import com.ccsens.experiment.persist.mapper.OrganizationMemberMapper; |
|
|
|
import com.ccsens.experiment.util.ExperimentCodeError; |
|
|
|
import com.ccsens.experiment.util.ExperimentConstant; |
|
|
|
import com.ccsens.util.JsonResponse; |
|
|
|
import com.ccsens.util.PropUtil; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Repository; |
|
|
@ -20,7 +22,11 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author 逗 |
|
|
|
*/ |
|
|
@ -67,6 +73,24 @@ public class OrganizationService implements IOrganizationService { |
|
|
|
//TODO 机构信息
|
|
|
|
|
|
|
|
organizationMemberMapper.insertSelective(member); |
|
|
|
//所有成员都能看到项目
|
|
|
|
saveUserIdProject(experimentId); |
|
|
|
} |
|
|
|
|
|
|
|
private void saveUserIdProject(Long experimentId) { |
|
|
|
//查找项目下所有成员的userId
|
|
|
|
List<Long> userIdList = organizationDao.getUserIdByExperimentId(experimentId); |
|
|
|
Set<Long> userIdSet = new HashSet<>(userIdList); |
|
|
|
|
|
|
|
ProjectDto.SaveProjectDto saveProjectDto = new ProjectDto.SaveProjectDto(); |
|
|
|
saveProjectDto.setId(experimentId); |
|
|
|
saveProjectDto.setUserIdList(userIdSet); |
|
|
|
JsonResponse jsonResponse = tall3FeignClient.saveProjectList(saveProjectDto); |
|
|
|
if (null == jsonResponse){ |
|
|
|
throw new BaseException(ExperimentCodeError.FEIGN_ERROR); |
|
|
|
}else if(!jsonResponse.getCode().equals(ExperimentCodeError.SUCCESS.getCode())){ |
|
|
|
throw new BaseException(ExperimentCodeError.FEIGN_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
@ -79,6 +103,10 @@ public class OrganizationService implements IOrganizationService { |
|
|
|
if(ObjectUtil.isNotNull(param.getPhone())){ |
|
|
|
member.setPhone(param.getPhone()); |
|
|
|
// TODO 修改userID
|
|
|
|
//根据手机号获取userId
|
|
|
|
JsonResponse<Long> userIdByPhone = tall3FeignClient.getUserIdByPhone(param.getPhone()); |
|
|
|
log.info("通过tall3获取手机号对应的userId:{}",userIdByPhone); |
|
|
|
member.setUserId(userIdByPhone.getData()); |
|
|
|
} |
|
|
|
organizationMemberMapper.updateByPrimaryKeySelective(member); |
|
|
|
} |
|
|
@ -91,6 +119,7 @@ public class OrganizationService implements IOrganizationService { |
|
|
|
} |
|
|
|
member.setRecStatus((byte) 2); |
|
|
|
organizationMemberMapper.updateByPrimaryKeySelective(member); |
|
|
|
saveUserIdProject(member.getExperimentId()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|