Merge remote-tracking branch 'origin/cc_20230520_partner' into cc_20230520_partner
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package com.cool.store.http;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cool.store.dto.response.ResultDTO;
|
||||
import com.cool.store.dto.wx.CodeSessionDTO;
|
||||
import com.cool.store.dto.wx.PhoneInfoDTO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
@@ -15,7 +13,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
@@ -44,18 +41,22 @@ public class WechatRest {
|
||||
|
||||
|
||||
public CodeSessionDTO miniProgramJsCodeSession(String appId, String secret, String jsCode){
|
||||
log.info("WechatRest#miniProgramJsCodeSession, jsCode:{}", jsCode);
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
HashMap requestMap = new HashMap();
|
||||
requestMap.put("appid", appId);
|
||||
requestMap.put("secret", secret);
|
||||
requestMap.put("js_code", jsCode);
|
||||
requestMap.put("grant_type","authorization_code");
|
||||
CodeSessionDTO codeSessionDTO = null;
|
||||
try {
|
||||
codeSessionDTO = httpRestTemplateService.getForObject(url, CodeSessionDTO.class, requestMap);
|
||||
log.info("WechatRest#miniProgramJsCodeSession, url:{}, response:{}", url, JSONObject.toJSONString(codeSessionDTO));
|
||||
String responseStr = httpRestTemplateService.getForObject(url, String.class ,requestMap);
|
||||
log.info("WechatRest#miniProgramJsCodeSession, url:{}, response:{}", url, responseStr);
|
||||
if(StringUtils.isNotBlank(responseStr)){
|
||||
return JSONObject.parseObject(responseStr, CodeSessionDTO.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("调用微信服务异常", e);
|
||||
log.info("调用微信服务异常{}", e);
|
||||
throw new ServiceException(ErrorCodeEnum.WX_SERVICE_ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -69,13 +70,12 @@ public class WechatRest {
|
||||
String reqUrl = String.format(ACCESS_TOKEN, appId, secret);
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
jsonObject = httpRestTemplateService.getForObject(reqUrl, JSONObject.class, null);
|
||||
jsonObject = httpRestTemplateService.getForObject(reqUrl, JSONObject.class, new HashMap());
|
||||
log.info("WechatRest#getAccessToken, reqUrl:{}, response:{}", reqUrl, JSONObject.toJSONString(jsonObject));
|
||||
String token = jsonObject.getString("access_token");
|
||||
if (StringUtils.isBlank(token)) {
|
||||
throw new ServiceException(ErrorCodeEnum.GET_ACCESSTOKEN_ERROR);
|
||||
}
|
||||
|
||||
redisUtilPool.setString(cacheAccessToken, token, 7000);
|
||||
accessToken = token;
|
||||
} catch (Exception e) {
|
||||
@@ -89,14 +89,17 @@ public class WechatRest {
|
||||
String reqUrl = String.format(GET_USERPHONENUMBER, accessToken);
|
||||
HashMap requestMap = new HashMap();
|
||||
requestMap.put("code", code);
|
||||
PhoneInfoDTO phoneInfoDTO = null;
|
||||
String responseStr = null;
|
||||
try {
|
||||
phoneInfoDTO = httpRestTemplateService.postForObject(reqUrl, requestMap, PhoneInfoDTO.class);
|
||||
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, JSONObject.toJSONString(phoneInfoDTO));
|
||||
responseStr = httpRestTemplateService.postForObject(reqUrl, requestMap, String.class);
|
||||
log.info("WechatRest#getUserPhoneNumber, reqUrl:{}, response:{}", reqUrl, responseStr);
|
||||
if(StringUtils.isNotBlank(responseStr)){
|
||||
return JSONObject.parseObject(responseStr, PhoneInfoDTO.class);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取手机号异常", e);
|
||||
}
|
||||
return phoneInfoDTO;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ import com.cool.store.dto.dept.DepartmentEventDTO;
|
||||
*/
|
||||
public interface EnterpriseSyncService {
|
||||
|
||||
/**
|
||||
* 全量同步
|
||||
*/
|
||||
void syncAll();
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,8 +18,8 @@ public interface InterviewService {
|
||||
List<InterviewVO> getInterviewList(GetInterviewListReq request);
|
||||
|
||||
/**
|
||||
* 根据面试会议id查询面试信息
|
||||
* @param interviewId
|
||||
* 根据面试会议计划id查询面试信息
|
||||
* @param interviewPlanId
|
||||
* @return
|
||||
*/
|
||||
InterviewVO getInterviewInfo(String interviewPlanId);
|
||||
@@ -62,4 +62,6 @@ public interface InterviewService {
|
||||
* @return
|
||||
*/
|
||||
void approveAppointment(ApproveAppointmentReq request) throws ApiException;
|
||||
void reInterview(ReInterviewReq request) throws ApiException;
|
||||
void rejectInterview(RejectInterviewReq request) throws ApiException;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,10 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步组织架构
|
||||
* @return
|
||||
*/
|
||||
private Pair<List<RegionDO>, Multimap<String, String>> syncRegion(){
|
||||
//同步部门
|
||||
List<SysDepartmentDTO> departments = isvHttpRequest.getSubDepartments(CommonConstants.ROOT_DEPT_ID_STR, true);
|
||||
@@ -239,13 +242,23 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
|
||||
dealUserLeaderDept(updateLeaderDeptMap);
|
||||
break;
|
||||
case DEPARTMENT_DELETED:
|
||||
syncAll();
|
||||
boolean leafNode = regionDAO.isLeafNode(departmentDetail.getId());
|
||||
if(leafNode){
|
||||
//叶子节点的时候会删除部门
|
||||
regionDAO.deleteRegionByRegionId(departmentDetail.getId());
|
||||
}else{
|
||||
syncAll();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理用户负责部门信息
|
||||
* @param leaderDeptMap
|
||||
*/
|
||||
public void dealUserLeaderDept(Multimap<String, String> leaderDeptMap){
|
||||
if(leaderDeptMap.isEmpty()){
|
||||
return;
|
||||
|
||||
@@ -97,14 +97,11 @@ public class FeiShuServiceImpl implements FeiShuService {
|
||||
|
||||
for (UserFreeBusyInfoDTO userFreeBusyInfoDTO : UserFreeBusyInfoList) {
|
||||
//如果查询结果中的开始时间和结束时间在时间段内,则设置为忙碌
|
||||
if ((startTimeLong > userFreeBusyInfoDTO.getStartTime() && startTimeLong < userFreeBusyInfoDTO.getStartTime())
|
||||
|| (endTimeLong > userFreeBusyInfoDTO.getStartTime() && endTimeLong < userFreeBusyInfoDTO.getStartTime())) {
|
||||
if (( userFreeBusyInfoDTO.getStartTime()>startTimeLong && userFreeBusyInfoDTO.getStartTime() < endTimeLong)
|
||||
|| (userFreeBusyInfoDTO.getEndTime() > startTimeLong && userFreeBusyInfoDTO.getEndTime() < endTimeLong)) {
|
||||
freeBusyInfo.setFree(false);
|
||||
break;
|
||||
}
|
||||
if (endTimeLong <= userFreeBusyInfoDTO.getStartTime()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,10 @@ public class InterviewServiceImpl implements InterviewService {
|
||||
@Override
|
||||
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("");
|
||||
//查询面试官和记录人信息
|
||||
EnterpriseUserBaseInfoVO interviewerInfo = hyPartnerInterviewPlanMapper.getEnterpriseUserBaseInfo(vo.getInterviewerId());
|
||||
vo.setInterviewerName(interviewerInfo.getName());
|
||||
@@ -279,6 +283,16 @@ public class InterviewServiceImpl implements InterviewService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reInterview(ReInterviewReq request) throws ApiException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejectInterview(RejectInterviewReq request) throws ApiException {
|
||||
|
||||
}
|
||||
|
||||
public String generateFeiShuInterviewMsg(String partnerName, String partnerMobile, String interviewTime){
|
||||
//"您有一个【面试预约申请】待处理,预约人【姓名】手机号【13xxxxxxxxx】,预约面试时间【YYYY年MM月DD日 hh:mm】,请及时处理】"
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.cool.store.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.HyPartnerLineInfoDAO;
|
||||
@@ -62,6 +63,7 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
|
||||
@Override
|
||||
public PartnerUserInfoVO miniProgramLogin(MiniProgramLoginDTO param) {
|
||||
log.info("miniProgramLogin #param {}", JSONObject.toJSONString(param));
|
||||
PartnerUserInfoVO userInfoVO = new PartnerUserInfoVO();
|
||||
String jsCode = param.getJsCode();
|
||||
String lockKey = "codeSession:" + wxAppId + CommonConstants.MOSAICS + jsCode;
|
||||
@@ -76,12 +78,12 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
String unionId = codeSession.getUnionId();
|
||||
log.info("小程序登录:{}", unionId);
|
||||
log.info("sessionKey {}", codeSession.getSessionKey());
|
||||
String decryptUser = AesUtil.decryptWechat(codeSession.getSessionKey(), param.getEncryptedData(), param.getIvStr());
|
||||
/* String decryptUser = AesUtil.decryptWechat(codeSession.getSessionKey(), param.getEncryptedData(), param.getIvStr());
|
||||
log.info("解密用户信息:{}", decryptUser);
|
||||
MiniProgramUserVO miniProgramUser = JSON.parseObject(decryptUser, MiniProgramUserVO.class);
|
||||
if (Objects.isNull(miniProgramUser)) {
|
||||
throw new ServiceException(ErrorCodeEnum.GET_WECHAT_USER_INFO_FAIL);
|
||||
}
|
||||
}*/
|
||||
// 获取小程序token
|
||||
String accessToken = wechatRest.getAccessToken(wxAppId, wxAppSecret);
|
||||
// 获取手机号码
|
||||
@@ -91,8 +93,10 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
|
||||
if(hyPartnerUserInfoDO == null){
|
||||
hyPartnerUserInfoDO = new HyPartnerUserInfoDO();
|
||||
hyPartnerUserInfoDO.setMobile(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
||||
hyPartnerUserInfoDO.setUsername(miniProgramUser.getNickName());
|
||||
// hyPartnerUserInfoDO.setUsername(phoneInfoDTO.getPhoneInfo().getPhoneNumber());
|
||||
hyPartnerUserInfoDO.setPartnerId(UUIDUtils.get32UUID());
|
||||
hyPartnerUserInfoDO.setAcceptAdjustType(0);
|
||||
hyPartnerUserInfoDO.setIsWritePartnerKnow(0);
|
||||
hyPartnerUserInfoDAO.insertSelective(hyPartnerUserInfoDO);
|
||||
// 生成一条线索 也可在提交加盟信息时插入
|
||||
HyPartnerLineInfoDO hyPartnerLineInfoDO = new HyPartnerLineInfoDO();
|
||||
|
||||
Reference in New Issue
Block a user