Parcourir la source

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang il y a 1 an
Parent
révision
be286bb972
5 fichiers modifiés avec 57 ajouts et 11 suppressions
  1. +31
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java
  3. +3
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java
  4. +5
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java
  5. +17
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java

+ 31
- 1
pmapi/src/main/java/com/ningdatech/pmapi/expert/manage/ExpertManage.java Voir le fichier

@@ -22,11 +22,16 @@ import com.ningdatech.pmapi.expert.service.ExpertInfoService;
import com.ningdatech.pmapi.expert.service.IExpertUserFullInfoService;
import com.ningdatech.pmapi.meta.constant.DictExpertInfoTypeEnum;
import com.ningdatech.pmapi.meta.model.ExpertRegionInfo;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -47,6 +52,7 @@ public class ExpertManage {
private final ExpertInfoCommonHelper expertInfoCommonHelper;
private final FileService fileService;
private final ExpertUserInfoAssembler expertUserInfoAssembler;
private final IUserInfoService iUserInfoService;


/**
@@ -56,8 +62,11 @@ public class ExpertManage {
*/
public void expertBasicInfoSubmit(ExpertUserBasicInfoSubmitRequest request) {
// 用户id
Long userId = LoginUserUtil.getUserId();
// Long userId = LoginUserUtil.getUserId();
ExpertBasicInfo basicInfo = request.getBasicInfo();
Long userId = generateOrGetUserId(basicInfo);


// 校验区域编码合法性 校验履职意向编码合法性
ExpertRegionInfo expertRegionInfo = basicInfo.getExpertRegionInfo();
expertManageHelper.expertRegionInfoCheck(expertRegionInfo);
@@ -137,4 +146,25 @@ public class ExpertManage {
List<AttachFileVo> attachFiles = fileService.getByIds(fileIdList);
return expertUserInfoAssembler.buildExpertFullInfoVO(attachFiles, expertUserFullInfoAll);
}

@Transactional(rollbackFor = Exception.class)
public Long generateOrGetUserId(ExpertBasicInfo basicInfo) {
String phoneNo = basicInfo.getPhoneNo();
UserInfo userInfo = iUserInfoService.getUserInfoByPhoneNo(phoneNo);
if (Objects.isNull(userInfo)) {
userInfo = UserInfo.builder()
// .accountId(dingEmployeeInfo.getAccountId())
.username(basicInfo.getName())
.realName(basicInfo.getName())
// .employeeCode(dingEmployeeInfo.getEmployeeCode())
.available(UserAvailableEnum.DISABLE.name())
.createBy(LoginUserUtil.getUserId())
.updateBy(LoginUserUtil.getUserId())
.createOn(LocalDateTime.now())
.updateOn(LocalDateTime.now())
.build();
iUserInfoService.save(userInfo);
}
return userInfo.getId();
}
}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/IRegionService.java Voir le fichier

@@ -1,8 +1,8 @@
package com.ningdatech.pmapi.sys.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.sys.model.entity.Region;
import com.ningdatech.pmapi.sys.model.dto.RegionDTO;
import com.ningdatech.pmapi.sys.model.entity.Region;

import java.util.List;



+ 3
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/service/impl/RegionServiceImpl.java Voir le fichier

@@ -52,9 +52,9 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
@Override
public Long getRegionIdByParentIdWithSameRegionCode(Long parentId, String regionCode) {
return baseMapper.selectOne(Wrappers.lambdaQuery(Region.class)
.eq(Region::getParentId, parentId)
.eq(Region::getRegionCode, regionCode)
.eq(Region::getDeleted, false))
.eq(Region::getParentId, parentId)
.eq(Region::getRegionCode, regionCode)
.eq(Region::getDeleted, false))
.getId();
}



+ 5
- 2
pmapi/src/main/java/com/ningdatech/pmapi/user/service/IUserInfoService.java Voir le fichier

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.user.service;

import com.ningdatech.pmapi.user.entity.UserInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;

import java.util.Map;
@@ -9,7 +9,7 @@ import java.util.Set;

/**
* <p>
* 服务类
* 服务类
* </p>
*
* @author Lierbao
@@ -19,4 +19,7 @@ public interface IUserInfoService extends IService<UserInfo> {
Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers);

ProcessInstanceUserDto getUserInfo(String userId);

UserInfo getUserInfoByPhoneNo(String phoneNo);

}

+ 17
- 4
pmapi/src/main/java/com/ningdatech/pmapi/user/service/impl/UserInfoServiceImpl.java Voir le fichier

@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.user.mapper.NdUserInfoMapper;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;
@@ -22,7 +23,7 @@ import java.util.stream.Collectors;

/**
* <p>
* 服务实现类
* 服务实现类
* </p>
*
* @author Lierbao
@@ -36,6 +37,7 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
private final IDingEmployeeInfoService dingEmployeeInfoService;

private final IDingOrganizationService dingOrganizationService;

@Override
public Map<String, ProcessInstanceUserDto> getUserMapByIds(Set<String> staterUsers) {
List<UserInfo> userInfos = userInfoMapper.selectBatchIds(staterUsers);
@@ -44,13 +46,13 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
userInfo.setUserId(String.valueOf(u.getId()));
userInfo.setUserName(u.getRealName());
Long accountId = u.getAccountId();
if (Objects.isNull(accountId)){
if (Objects.isNull(accountId)) {
throw new BizException("该用户没有录入浙政钉用户信息!");
}
// 根据浙政钉用户ID获取单位code
DingEmployeeInfo employeeInfo = dingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getAccountId, accountId)
.eq(DingEmployeeInfo::getMainJob,String.valueOf(Boolean.TRUE))
.eq(DingEmployeeInfo::getMainJob, String.valueOf(Boolean.TRUE))
.last("limit 1"));
String organizationCode = employeeInfo.getOrganizationCode();
// 根据 单位code获取单位名称
@@ -70,7 +72,7 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
processInstanceUserDto.setUserId(String.valueOf(userInfo.getId()));
processInstanceUserDto.setUserName(userInfo.getRealName());
Long accountId = userInfo.getAccountId();
if (Objects.isNull(accountId)){
if (Objects.isNull(accountId)) {
throw new BizException("该用户没有录入浙政钉用户信息!");
}
// 根据浙政钉用户ID获取部门code
@@ -85,4 +87,15 @@ public class UserInfoServiceImpl extends ServiceImpl<NdUserInfoMapper, UserInfo>
processInstanceUserDto.setOrgName(organizationName);
return processInstanceUserDto;
}

@Override
public UserInfo getUserInfoByPhoneNo(String phoneNo) {
if (StringUtils.isEmpty(phoneNo)) {
return null;
}
UserInfo userInfo = userInfoMapper
.selectOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getMobile, phoneNo));
return userInfo;
}
}

Chargement…
Annuler
Enregistrer