Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner

This commit is contained in:
苏竹红
2023-06-19 20:06:44 +08:00
63 changed files with 941 additions and 790 deletions

View File

@@ -1,11 +1,9 @@
package com.cool.store.service;
import com.cool.store.dto.buser.UserPositionAndUserScopeDTO;
import com.cool.store.entity.EnterpriseUserDO;
import com.cool.store.request.EnterpriseUserRequest;
import com.cool.store.vo.EnterpriseUserSingleInfoVO;
import com.cool.store.vo.buser.EnterpriseUserPageVO;
import java.util.List;
import java.util.Map;
/**
* @author zhangchenbiao
@@ -25,4 +23,16 @@ public interface EnterpriseUserService {
*/
List<EnterpriseUserSingleInfoVO> getInvestmentManagerList(String type,String userId,String keyword);
/**
* 获取用户角色已用户管辖的员工范围
* @param userId
* @return
*/
UserPositionAndUserScopeDTO getUserIdsByScope(String userId);
List<EnterpriseUserSingleInfoVO> getDevelopmentDirectorList(String wantShopArea);
}

View File

@@ -2,6 +2,7 @@ package com.cool.store.service;
import com.cool.store.exception.ApiException;
import com.cool.store.request.CreateQualifyVerifyReq;
import com.cool.store.request.QualificationCallbackReq;
/**
* @Author: young.yu
@@ -10,4 +11,6 @@ import com.cool.store.request.CreateQualifyVerifyReq;
*/
public interface FlowService {
void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException;
void qualificationCallback(QualificationCallbackReq request);
}

View File

@@ -14,7 +14,7 @@ public interface WechatMiniAppService {
PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param);
Boolean updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO);
PartnerUserInfoVO getUserInfo(String mobile, String openId);
}

View File

@@ -243,9 +243,20 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
break;
case DEPARTMENT_DELETED:
boolean leafNode = regionDAO.isLeafNode(departmentDetail.getId());
if(leafNode){
boolean isExistUser = enterpriseUserDAO.isExistDeptUser(departmentDetail.getId());
if(leafNode && !isExistUser){
//叶子节点的时候会删除部门
regionDAO.deleteRegionByRegionId(departmentDetail.getId());
//清除负责人信息
List<EnterpriseUserDO> leaderUserList = enterpriseUserDAO.getUserListByDeptLeader(departmentDetail.getId());
for (EnterpriseUserDO enterpriseUser : leaderUserList) {
List<String> existDeptIds = JSONObject.parseArray(enterpriseUser.getLeaderDeptIds()).stream().map(String::valueOf).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(existDeptIds)){
existDeptIds.remove(departmentDetail.getId());
}
enterpriseUser.setLeaderDeptIds(JSONObject.toJSONString(existDeptIds));
}
enterpriseUserDAO.batchInsertOrUpdate(leaderUserList);
}else{
syncAll();
}

View File

@@ -1,8 +1,13 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.buser.UserPositionAndUserScopeDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.UserPositionEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.EnterpriseUserService;
import com.cool.store.service.ZoneService;
import com.cool.store.vo.EnterpriseUserSingleInfoVO;
@@ -10,10 +15,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zhangchenbiao
@@ -31,11 +34,13 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
@Resource
private EnterpriseUserRoleDAO enterpriseUserRoleDAO;
@Resource
ZoneService zoneService;
private ZoneService zoneService;
@Resource
RegionDAO regionDAO;
private RegionDAO regionDAO;
@Resource
UserRegionMappingDAO userRegionMappingDAO;
private UserRegionMappingDAO userRegionMappingDAO;
@Resource
private HyIntendDevZoneInfoDAO hyIntendDevZoneInfoDAO;
@@ -87,4 +92,52 @@ public class EnterpriseUserServiceImpl implements EnterpriseUserService {
});
return enterpriseUserSingleInfoVOS;
}
@Override
public UserPositionAndUserScopeDTO getUserIdsByScope(String userId) {
EnterpriseUserDO userInfo = enterpriseUserDAO.getUserInfoById(userId);
if(Objects.isNull(userInfo)){
throw new ServiceException(ErrorCodeEnum.USER_NOT_EXIST);
}
UserPositionAndUserScopeDTO result = new UserPositionAndUserScopeDTO();
if(!userInfo.getIsLeader()){
result.setDevelopmentUserIds(Arrays.asList(userId));
result.setInvestmentUserIds(Arrays.asList(userId));
return result;
}
List<String> leadDeptIds = JSONObject.parseArray(userInfo.getLeaderDeptIds()).stream().map(String::valueOf).collect(Collectors.toList());
//获取这些区域的子节点
List<String> subRegionIds = regionDAO.getSubRegionIds(leadDeptIds);
//这些部门是否关联了意向区域
List<HyIntendDevZoneInfoDO> zoneInfoList = hyIntendDevZoneInfoDAO.getZoneInfoByRegionIds(subRegionIds);
if(CollectionUtils.isEmpty(zoneInfoList)){
result.setDevelopmentUserIds(Arrays.asList(userId));
result.setInvestmentUserIds(Arrays.asList(userId));
return result;
}
//意向区域
List<String> intendList = zoneInfoList.stream().filter(o -> "intent".equals(o.getType())).flatMap(o->JSONObject.parseArray(o.getAssociatedRegionId(), String.class).stream()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(intendList)){
//获取负责的区域
intendList.retainAll(subRegionIds);
List<String> userList = userRegionMappingDAO.getUserListByRegionIds(intendList);
userList.add(userId);
result.setInvestmentUserIds(userList);
}
//开发区域
List<String> developementList = zoneInfoList.stream().filter(o -> "developement".equals(o.getType())).flatMap(o->JSONObject.parseArray(o.getAssociatedRegionId(), String.class).stream()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(developementList)){
//获取负责的区域
developementList.retainAll(subRegionIds);
List<String> userList = userRegionMappingDAO.getUserListByRegionIds(developementList);
userList.add(userId);
result.setDevelopmentUserIds(userList);
}
return result;
}
@Override
public List<EnterpriseUserSingleInfoVO> getDevelopmentDirectorList(String wantShopArea) {
return null;
}
}

View File

@@ -96,9 +96,8 @@ public class FeiShuServiceImpl implements FeiShuService {
long endTimeLong = DateUtil.parse(endStr).getTime();
for (UserFreeBusyInfoDTO userFreeBusyInfoDTO : UserFreeBusyInfoList) {
//如果查询结果中的开始时间和结束时间在时间段内,则设置为忙碌
if (( userFreeBusyInfoDTO.getStartTime()>startTimeLong && userFreeBusyInfoDTO.getStartTime() < endTimeLong)
|| (userFreeBusyInfoDTO.getEndTime() > startTimeLong && userFreeBusyInfoDTO.getEndTime() < endTimeLong)) {
//比较两个时间段是否有重叠
if(!(endTimeLong <= userFreeBusyInfoDTO.getStartTime() || startTimeLong >= userFreeBusyInfoDTO.getEndTime())){
freeBusyInfo.setFree(false);
break;
}

View File

@@ -2,13 +2,14 @@ package com.cool.store.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.cool.store.dao.EnterpriseUserDAO;
import com.cool.store.dto.login.UserIdInfoDTO;
import com.cool.store.dto.mdm.AccessTokenDTO;
import com.cool.store.dto.response.MDMResultDTO;
import com.cool.store.entity.*;
import com.cool.store.enums.DataSourceEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.WorkflowStatusEnum;
import com.cool.store.exception.ApiException;
@@ -17,18 +18,28 @@ import com.cool.store.mapper.DingdingUserMapper;
import com.cool.store.mapper.HyPartnerCertificationInfoMapper;
import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.mapper.HyPartnerLineInfoMapper;
import com.cool.store.oss.OSSServer;
import com.cool.store.request.CreateQualifyVerifyReq;
import com.cool.store.request.QualificationCallbackReq;
import com.cool.store.request.RpcCreateQualifyVerfyReq;
import com.cool.store.request.RpcGetMdmTokenReq;
import com.cool.store.service.FlowService;
import com.cool.store.utils.PDFUtils;
import com.cool.store.utils.PassLetterUtils;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.RestTemplateUtil;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -63,7 +74,11 @@ public class FlowServiceImpl implements FlowService {
@Autowired
private HyPartnerCertificationInfoMapper hyPartnerCertificationInfoMapper;
@Autowired
private OSSServer ossServer;
@Override
@Transactional
public void createQualifyVerify(CreateQualifyVerifyReq request) throws ApiException {
//1.发起加盟商资质审核
RpcCreateQualifyVerfyReq rpcRequest = new RpcCreateQualifyVerfyReq();
@@ -96,7 +111,8 @@ public class FlowServiceImpl implements FlowService {
rpcRequest.setIntendedSigner(request.getIntentionSignerUsername());
rpcRequest.setIntendedSignerTel(request.getIntentionSignerMobile());
String qualifyVerifyId = createQualifyVerify(rpcRequest);
//通过 rpc 请求审核系统获取返回数据
Map<String, String> qualifyVerifyRespData = JSON.parseObject(createQualifyVerify(rpcRequest), new TypeReference<HashMap<String,String>>() {});
//2.更新审核信息
HyPartnerCertificationInfoDO partnerCertificationInfoDO = new HyPartnerCertificationInfoDO();
partnerCertificationInfoDO.setPartnerId(request.getPartnerId());
@@ -118,6 +134,10 @@ public class FlowServiceImpl implements FlowService {
partnerCertificationInfoDO.setSignerRealControlRelationCert(request.getSignerRealControlRelationCert());
partnerCertificationInfoDO.setCreateTime(new Date());
partnerCertificationInfoDO.setUpdateTime(new Date());
//set 资质审核流程id
partnerCertificationInfoDO.setQualifyVerifyId(qualifyVerifyRespData.get("id"));
//set 意向合同编号
partnerCertificationInfoDO.setIntentionContractNo(qualifyVerifyRespData.get("sequenceNo"));
hyPartnerCertificationInfoMapper.updateByPrimaryKeySelective(partnerCertificationInfoDO);
//3.更新面试信息
//根据面试id获取面试信息
@@ -125,7 +145,6 @@ public class FlowServiceImpl implements FlowService {
if (Objects.isNull(hyPartnerInterviewDO)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
}
hyPartnerInterviewDO.setQualifyVerifyId(qualifyVerifyId);
hyPartnerInterviewDO.setUpdateTime(new Date());
//更新
hyPartnerInterviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_4.getCode()));
@@ -133,15 +152,59 @@ public class FlowServiceImpl implements FlowService {
}
@Override
@Transactional
public void qualificationCallback(QualificationCallbackReq request) {
//1. 信息是否完整
if (null == request.getSequenceStatus() || "".equals(request.getSequenceStatus())) {
log.error("MDM回调入参缺失request{}", JSON.toJSONString(request));
throw new ServiceException("MDM回调错误");
}
//根据审核流程 id 获取面试会议 id
String interviewId = hyPartnerCertificationInfoMapper.getInterviewIdByQualifyVerifyId(request.getInstanceId());
if (StringUtils.isEmpty(interviewId)) {
throw new ServiceException(ErrorCodeEnum.INTERVIEW_NOT_EXIST);
}
HyPartnerInterviewDO interviewDO = new HyPartnerInterviewDO();
interviewDO.setId(Long.parseLong(interviewId));
//审核通过
if ("FINISHED".equals(request.getSequenceStatus())) {
interviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_6.getCode()));
//2. 准备需要的信息
String partnerName = request.getIntendedSigner();
String verifyCity = hyPartnerInterviewMapper.getVerifyCityByInterviewId(interviewId);
String[] split = verifyCity.split("/");
//根据长度来取市级行政区域
if (split.length == 2) {
verifyCity = split[1];
} else if (split.length == 3) {
verifyCity = split[1];
} else if (split.length == 4) {
verifyCity = split[2];
} else {
throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
}
// TODO pass_reason 暂无
Date passDate = new Date(request.getModifiedTime());
//3. 生成通过函并修改数据库相关信息
genPassLetterAndUpdateDB(partnerName, verifyCity, passDate, interviewId);
//审核未通过
} else if ("CANCELED".equals(request.getSequenceStatus())) {
interviewDO.setStatus(Integer.valueOf(WorkflowStatusEnum.INTERVIEW_7.getCode()));
}
hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO);
}
public String createQualifyVerify(RpcCreateQualifyVerfyReq rpcRequest) throws ApiException{
String url = mdmBaseUrl + "/api/openapi/runtime/form/startFraQualExam";
String url = mdmBaseUrl + "/api/openapi/runtime/form/startFraQualExamWithData";
ResponseEntity<MDMResultDTO> responseEntity = null;
try {
RpcGetMdmTokenReq rpcGetMDMTokenReq = new RpcGetMdmTokenReq();
// TODO set appKey 与 appSecret
Map<String, String> headers = new HashMap<>();
headers.put("Authorization", getMdmAccessToken(rpcGetMDMTokenReq));
responseEntity = RestTemplateUtil.post(url, headers,rpcRequest, MDMResultDTO.class);
responseEntity = RestTemplateUtil.post(url, headers, rpcRequest, MDMResultDTO.class);
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
if (Objects.nonNull(responseEntity.getBody()) && responseEntity.getBody().isSuccess()) {
return JSONObject.toJSONString(responseEntity.getBody().getData());
@@ -185,4 +248,41 @@ public class FlowServiceImpl implements FlowService {
String prefix = jobNumber + DateUtil.format(new Date(), "yyyyMMdd");
return prefix + redisUtilPool.incrby(prefix, 1, 60 * 60 * 25);
}
/**
* 生成通知函上传 OSS 和修改数据库相应数据
* @return passCode
*/
private void genPassLetterAndUpdateDB(String partnerName, String verifyCity, Date passTime, String interviewId) {
try {
String passCode = PassLetterUtils.genPassCode(passTime);
//生成的 pdf 通过函内存输出流
ByteArrayOutputStream pdfOut = PassLetterUtils.genPassLetter(partnerName, passCode, verifyCity, passTime);
//生成的 pdf 通过函内存输入流
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
String passPdfUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".pdf");
//转换为图片
inputStream.reset();
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
inputStream = new ByteArrayInputStream(imageOut.toByteArray());
//上传 OSS
String passImageUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".png");
//计算有效期截止日期
DateTime expiryDate = DateUtil.offsetDay(passTime, 60);
HyPartnerInterviewDO interviewDO = new HyPartnerInterviewDO();
interviewDO.setId(Long.parseLong(interviewId));
interviewDO.setPassCode(passCode);
interviewDO.setPassTime(passTime);
interviewDO.setExpiryDate(expiryDate);
interviewDO.setPassPdfUrl(passPdfUrl);
interviewDO.setPassImageUrl(passImageUrl);
hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO);
inputStream.close();
pdfOut.close();
imageOut.close();
} catch (Exception e) {
log.error("资格面试通过函生成失败 e{}", e.getMessage());
throw new ServiceException("通过函生成失败!");
}
}
}

View File

@@ -33,6 +33,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Arrays;
import java.util.Date;
@@ -74,9 +75,11 @@ public class InterviewServiceImpl implements InterviewService {
public InterviewVO getInterviewInfo(String interviewPlanId) {
InterviewVO vo = hyPartnerInterviewPlanMapper.getInterviewInfo(interviewPlanId);
//将 processInfo 解析为 List
List<String> split = Arrays.asList(vo.getProcessInfo().split(","));
vo.setProcessInfoList(split);
vo.setProcessInfo("");
if (!StringUtils.isEmpty(vo.getProcessInfo())) {
List<String> split = Arrays.asList(vo.getProcessInfo().split(","));
vo.setVedioList(split);
vo.setProcessInfo("");
}
//查询面试官和记录人信息
EnterpriseUserBaseInfoVO interviewerInfo = hyPartnerInterviewPlanMapper.getEnterpriseUserBaseInfo(vo.getInterviewerId());
vo.setInterviewerName(interviewerInfo.getName());

View File

@@ -3,9 +3,6 @@ package com.cool.store.service.impl;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.cool.store.dto.calendar.UpdateCalendarEventDTO;
import com.cool.store.dto.calendar.UserCalendarsEventDTO;
import com.cool.store.dto.partner.EnterInterviewDto;
import com.cool.store.entity.HyPartnerInterviewPlanDO;
import com.cool.store.enums.ErrorCodeEnum;
@@ -14,27 +11,23 @@ import com.cool.store.exception.ApiException;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.HyPartnerInterviewMapper;
import com.cool.store.mapper.HyPartnerInterviewPlanMapper;
import com.cool.store.oss.OSSServer;
import com.cool.store.request.ModifyInterviewTimeReq;
import com.cool.store.service.PartnerInterviewService;
import com.cool.store.utils.PDFUtils;
import com.cool.store.utils.PassLetterUtils;
import com.cool.store.utils.TRTCUtils;
import com.cool.store.vo.EnterInterviewVO;
import com.cool.store.vo.PartnerInterviewInfoVO;
import com.cool.store.vo.PartnerPassLetterDetailVO;
import com.cool.store.vo.interview.InterviewVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.util.Date;
import static com.cool.store.utils.PDFUtils.pdf2Img;
@Service
@Slf4j
public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired
@@ -43,9 +36,6 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
@Autowired
private HyPartnerInterviewPlanMapper interviewPlanMapper;
@Autowired
private OSSServer ossServer;
@Value("${trtc.sdkAppId}")
private Long sdkAppId;
@@ -110,17 +100,8 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
} else if (split.length == 4) {
vo.setVerifyCity(split[2]);
} else {
System.out.println("wrong");
throw new ServiceException(ErrorCodeEnum.INTENT_INFO_NOT_EXIST);
}
verifyCity = vo.getVerifyCity();
// 调用生成通过函和修改数据库数据的方法
String passCode = genPassLetterAndUpdateDB(vo, interviewPlanId);
//再查一次 vo
vo = interviewMapper.getPassLetterDetail(interviewPlanId);
//有效期为审批通过次日起第 60 天的 23:59:59由此倒推 createTime
DateTime expiryDate = DateUtil.parseDate(vo.getExpiryDate());
DateTime createTime = DateUtil.offsetDay(expiryDate, -60);
vo.setCreateTime(DateUtil.format(createTime, "yyyy-MM-dd"));
vo.setVerifyCity((verifyCity));
return vo;
}
@@ -143,37 +124,4 @@ public class PartnerInterviewServiceImpl implements PartnerInterviewService {
interviewPlanMapper.updateByPrimaryKeySelective(record);
}
/**
* 生成通知函上传 OSS 和修改数据库相应数据
* @return passCode
*/
private String genPassLetterAndUpdateDB(PartnerPassLetterDetailVO passLetterDetail, String interviewId) {
//已经有文件 URL 的话就不要再生成了,默认上游全部数据都正确
if (ObjectUtil.isEmpty(passLetterDetail.getPassPdfUrl()) || ObjectUtil.isEmpty(passLetterDetail.getPassImageUrl())) {
try {
DateTime createTime = DateUtil.date();
String code = passLetterDetail.getPassCode() == null ? PassLetterUtils.genPassCode(createTime) : passLetterDetail.getPassCode();
//生成的 pdf 通过函内存输出流
ByteArrayOutputStream pdfOut = PassLetterUtils.genPassLetter(passLetterDetail.getPartnerName(), code, passLetterDetail.getVerifyCity(), createTime);
//生成的 pdf 通过函内存输入流
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
String passPdfUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + code + ".pdf");
//转换为图片
inputStream.reset();
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
inputStream = new ByteArrayInputStream(imageOut.toByteArray());
//上传 OSS
String passImageUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + code + ".png");
//计算有效期截止日期
DateTime expiryDate = DateUtil.offsetDay(createTime, 60);
String expiryDateStr = DateUtil.format(expiryDate, "yyyy-MM-dd") + " 23:59:59";
interviewMapper.updatePassLetterInfo(code, passPdfUrl, passImageUrl, expiryDateStr, interviewId);
inputStream.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return passLetterDetail.getPassCode();
}
}

View File

@@ -120,7 +120,8 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
}
@Override
public Boolean updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO) {
public String updateUserPhoneNumber(MobileUpdateRequest request, PartnerUserInfoVO userInfoVO) {
String newMobile = "";
HyPartnerUserInfoDO oldUserInfo = hyPartnerUserInfoDAO.selectByMobile(userInfoVO.getMobile());
if (oldUserInfo == null) {
throw new ServiceException(ErrorCodeEnum.PARTNER_USER_NOT_EXIST);
@@ -130,19 +131,26 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
// 获取手机号码
PhoneInfoDTO phoneInfoDTO = wechatRest.getUserPhoneNumber(request.getMobileCode(), accessToken);
if(phoneInfoDTO != null && phoneInfoDTO.getPhoneInfo() != null && StringUtils.isNotBlank(phoneInfoDTO.getPhoneInfo().getPhoneNumber())){
HyPartnerUserInfoDO newUserInfo = hyPartnerUserInfoDAO.selectByMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
newMobile = phoneInfoDTO.getPhoneInfo().getPhoneNumber();
HyPartnerUserInfoDO newUserInfo = hyPartnerUserInfoDAO.selectByMobile(newMobile);
if (newUserInfo != null) {
throw new ServiceException(ErrorCodeEnum.NEW_MOBILE_HAS_EXIST);
}
oldUserInfo.setMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
oldUserInfo.setMobile(newMobile);
hyPartnerUserInfoDAO.updateByPrimaryKeySelective(oldUserInfo);
}
return true;
return newMobile;
}
@Override
public PartnerUserInfoVO getUserInfo(String mobile, String openId) {
PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
if(CommonConstants.FIX_MOBILE_OPENID_TEST.equals(mobile) || CommonConstants.FIX_MOBILE_OPENID_ONLINE.equals(mobile) ){
userInfoVO.setMobile(mobile);
userInfoVO.setOpenid(mobile);
userInfoVO.setPartnerId("");
return userInfoVO;
}
HyPartnerUserInfoDO hyPartnerUserInfoDO = hyPartnerUserInfoDAO.selectByMobile(mobile);
BeanUtil.copyProperties(hyPartnerUserInfoDO, userInfoVO);
HyPartnerUserPlatformBindDO hyPartnerUserPlatformBindDO = hyPartnerUserPlatformBindDAO.getByPartnerId(hyPartnerUserInfoDO.getPartnerId());