Commit c51d0275 by 谢海旭

招聘管理:12月优化版本内容

1 parent 929c607d
......@@ -21,6 +21,12 @@ public class RecruitmentDemandDetailDTO extends RecruitmentDemand {
@ApiModelProperty(notes = "近一个月销售量")
private Integer salesVolume;
@ApiModelProperty(notes = "门店地址")
private String merchantAddress;
@ApiModelProperty(notes = "品牌")
private String brand;
@ApiModelProperty(notes = "招聘信息")
private List<RecruitmentResume> resumes;
......
......@@ -158,7 +158,10 @@ public class RecruitmentDemandRemoteImpl implements RecruitmentDemandRemote{
@Override
public RpcResponse<RecruitmentDemandDTO> recruitmentDemandAdd(RecruitmentDemandDTO dto) {
try{
return RpcResponse.success(recruitmentDemandService.recruitmentDemandAdd(dto));
RecruitmentDemandDTO result = recruitmentDemandService.recruitmentDemandAdd(dto);
// 异步推送企微消息
recruitmentDemandService.newDemandQWMessage(result);
return RpcResponse.success(result);
}catch(Exception e){
log.error(e.getMessage(),e);
return RpcResponse.error(e);
......
......@@ -80,19 +80,19 @@ public class MerchantService {
}
if (StringUtils.isNotBlank(carbrandResponse.getName())) {
if (mainBrand) {
brandNameBuilder.append(carbrandResponse.getName()).append(",");
brandNameBuilder.append(carbrandResponse.getName()).append("/");
continue;
}
if (CollectionUtils.isNotEmpty(carbrandResponse.getChilds())) {
String childBrandName = carbrandResponse.getChilds().stream()
.filter(o -> o != null && StringUtils.isNotBlank(o.getName()))
.map(o->carbrandResponse.getName()+"-"+o.getName()).collect(Collectors.joining(","));
brandNameBuilder.append(childBrandName).append(",");
.map(o->carbrandResponse.getName()+"-"+o.getName()).collect(Collectors.joining("/"));
brandNameBuilder.append(childBrandName).append("/");
}
}
}
String brandName = brandNameBuilder.toString();
if (brandName.endsWith(",")) {
if (brandName.endsWith("/")) {
brandName = brandName.substring(0, brandName.length() - 1);
}
if (StringUtils.isNotBlank(brandName)) {
......
package cn.com.glsx.dj.staff.service.common;
import cn.com.glsx.dj.staff.util.HttpUtil;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.request.SendWorkWechatMessageRequestDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.response.SendWorkWechatMessageResponseDTO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class QWManager {
@Autowired
private Environment environment;
public SendWorkWechatMessageResponseDTO sendMessage(
SendWorkWechatMessageRequestDTO sendWorkWechatMessageRequestDTO) {
log.info("发送企微应用消息:{}", JSON.toJSONString(sendWorkWechatMessageRequestDTO));
SendWorkWechatMessageResponseDTO responseDTO=null;
try {
String baseurl = environment.getProperty("wechat.base.path")+"/wechat/message/sendMessage";
responseDTO = HttpUtil.post(baseurl,JSONObject.parseObject(JSONObject.toJSONString(sendWorkWechatMessageRequestDTO)), SendWorkWechatMessageResponseDTO.class);
log.info("发送企微应用消息 ropResponse:{}", JSON.toJSONString(responseDTO));
} catch (Exception e) {
e.printStackTrace();
log.info("发送企微应用消息异常:", e);
}
return responseDTO;
}
/**
* 通过商户号+手机号查询企微员工标识
*
* @param merchantId 商户号
* @param mobile 手机号
* @return 企微userId
*/
public String getUserId(Integer merchantId, String mobile) {
log.info("查询企微员工标识, 商户号:{}, 手机号:{}", merchantId, mobile);
String userId = null;
try {
String baseurl = environment.getProperty("wechat.base.path") + "/wechat/oa/getuserid";
JSONObject requestBody = new JSONObject();
requestBody.put("merchantId", merchantId);
requestBody.put("mobile", mobile);
JSONObject responseDTO = HttpUtil.post(baseurl, requestBody, JSONObject.class);
log.info("查询企微员工标识 response:{}", JSON.toJSONString(responseDTO));
if (responseDTO != null && responseDTO.getBoolean("success")) {
userId = responseDTO.getString("userid");
}
} catch (Exception e) {
e.printStackTrace();
log.error("查询企微员工标识异常:", e);
}
return userId;
}
}
......@@ -14,6 +14,7 @@ import cn.com.glsx.dj.staff.enums.recruitment.RecruitmentDemandLogOperationTypeE
import cn.com.glsx.dj.staff.mapper.*;
import cn.com.glsx.dj.staff.model.*;
import cn.com.glsx.dj.staff.service.common.MerchantService;
import cn.com.glsx.dj.staff.service.common.QWManager;
import cn.com.glsx.dj.staff.util.CommonUtil;
import cn.com.glsx.entmicro.model.request.EntmicroStaffRequest;
import cn.com.glsx.entmicro.model.response.EntmicroStaffResponse;
......@@ -29,6 +30,7 @@ import cn.com.glsx.scrm.proxy.enums.AccountTypeEnum;
import cn.com.glsx.scrm.proxy.model.merchant.MerchantRopResponse;
import cn.com.glsx.scrm.proxy.remote.merchant.MerchantRemote;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.WorkWechatTextCardMessageDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.WorkWechatTextMessageDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.request.SendWorkWechatMessageRequestDTO;
import cn.com.glsx.scrm.wechat.dto.workwechat.message.response.SendWorkWechatMessageResponseDTO;
import cn.com.glsx.scrm.wechat.enums.WorkWechatAppMessageTypeEnum;
......@@ -99,6 +101,9 @@ public class RecruitmentDemandService {
@Autowired
private MerchantService merchantService;
@Autowired
private QWManager qwManager;
/**
* 招聘需求统计
*
......@@ -180,6 +185,42 @@ public class RecruitmentDemandService {
dto.setRecruiterPhone(relation.getHrbpPhone());
}
}
// 查询门店省市信息
String merchantId = dto.getMerchantId();
if (StringUtils.isNotBlank(merchantId)) {
RpcPagination<ListMerchantRequest> merchantPagination = new RpcPagination<>();
merchantPagination.setPageNum(1);
merchantPagination.setPageSize(1);
ListMerchantRequest condition = new ListMerchantRequest();
condition.setAccounttypeIdList(Arrays.asList(AccountTypeEnum.SHOP_4S.getValue(), AccountTypeEnum.YQ_SHOP.getValue(), AccountTypeEnum.VIRTUAL_YQ_SHOP.getValue()));
condition.setMerchantNoStrSet(merchantId);
condition.setStatus(String.valueOf(MerchantAccountStatusEnum.HAVE_PUBLISH.getValue()));
merchantPagination.setCondition(condition);
RpcResponse<RpcPagination<MerchantRopResponse>> merchantWithPageResp = merchantRemote.listMerchantWithPage(merchantPagination);
if (merchantWithPageResp.hasResult()) {
RpcPagination<MerchantRopResponse> merchantWithPage = merchantWithPageResp.getResult();
if (CollectionUtils.isNotEmpty(merchantWithPage.getList())) {
MerchantRopResponse merchant = merchantWithPage.getList().get(0);
if (Objects.nonNull(merchant)) {
// 保存省名称+市名称
String provinceCity = "";
if (StringUtils.isNotBlank(merchant.getProvinceName())) {
provinceCity = merchant.getProvinceName();
}
if (StringUtils.isNotBlank(merchant.getCityName())) {
provinceCity += merchant.getCityName();
}
if (StringUtils.isNotBlank(provinceCity)) {
dto.setProvinceCity(provinceCity);
}
}
}
}
}
Date now = new Date();
dto.setCreatedBy(dto.getUpdatedBy());
dto.setCreatedDate(now);
......@@ -316,6 +357,35 @@ public class RecruitmentDemandService {
detailDTO.setOnboardingPlans(plans);
detailDTO.setLogs(logs);
// 查询门店信息(地址)
String merchantId = demand.getMerchantId();
RpcPagination<ListMerchantRequest> merchantPagination = new RpcPagination<>();
merchantPagination.setPageNum(1);
merchantPagination.setPageSize(1);
ListMerchantRequest condition = new ListMerchantRequest();
condition.setAccounttypeIdList(Arrays.asList(AccountTypeEnum.SHOP_4S.getValue(), AccountTypeEnum.YQ_SHOP.getValue(), AccountTypeEnum.VIRTUAL_YQ_SHOP.getValue()));
condition.setMerchantNoStrSet(merchantId);
condition.setStatus(String.valueOf(MerchantAccountStatusEnum.HAVE_PUBLISH.getValue()));
merchantPagination.setCondition(condition);
RpcResponse<RpcPagination<MerchantRopResponse>> merchantWithPageResp = merchantRemote.listMerchantWithPage(merchantPagination);
if (merchantWithPageResp.hasResult()) {
RpcPagination<MerchantRopResponse> merchantWithPage = merchantWithPageResp.getResult();
if (CollectionUtils.isNotEmpty(merchantWithPage.getList())) {
MerchantRopResponse merchant = merchantWithPage.getList().get(0);
if (Objects.nonNull(merchant)) {
detailDTO.setMerchantAddress(merchant.getMerchantAddress());
}
}
}
// 查询门店主营品牌信息
Map<Integer, String> merchantBrandMap = merchantService.getMerchantBrandMap(Arrays.asList(Integer.parseInt(merchantId)), true);
if (CollectionUtil.isNotEmpty(merchantBrandMap)) {
detailDTO.setBrand(merchantBrandMap.get(Integer.parseInt(merchantId)));
}
return detailDTO;
}
......@@ -454,6 +524,55 @@ public class RecruitmentDemandService {
}
/**
* 新增招聘需求推送企微应用消息
* 广联赛讯-嘀加企微管家
*
* @param dto
*/
@Async
public void newDemandQWMessage(RecruitmentDemandDTO dto) {
try {
String phone = dto.getRecruiterPhone();
if (StringUtils.isBlank(phone)) {
log.warn("招聘负责人手机号为空,无法推送企微消息");
return;
}
Integer merchantId = env.getProperty("new.demand.qw.message.merchant.id", Integer.class, 44211276);
String agentId = env.getProperty("new.demand.qw.message.agentId");
if (merchantId == null || StringUtils.isBlank(agentId)) {
log.error("新增招聘需求推送企微消息参数缺失");
return;
}
String qwUserId = qwManager.getUserId(merchantId, phone);
if (StringUtils.isBlank(qwUserId)) {
log.error("查询招聘负责人企微标识为空,手机号:{}", phone);
return;
}
SendWorkWechatMessageRequestDTO sendWorkWechatMessageRequestDTO = new SendWorkWechatMessageRequestDTO();
sendWorkWechatMessageRequestDTO.setToUser(qwUserId);
sendWorkWechatMessageRequestDTO.setMerchantId(merchantId);
sendWorkWechatMessageRequestDTO.setMsgType(WorkWechatAppMessageTypeEnum.TEXT.getValue());
sendWorkWechatMessageRequestDTO.setAgentId(StringUtils.isBlank(agentId)? "1000136": agentId);
WorkWechatTextMessageDTO text = new WorkWechatTextMessageDTO();
text.setContent("新增招聘需求提醒\n您有新的招聘需求待跟进,请及时前往saas+增值业务运营平台查看处理。");
sendWorkWechatMessageRequestDTO.setText(text);
SendWorkWechatMessageResponseDTO response = qwManager.sendMessage(sendWorkWechatMessageRequestDTO);
if (response != null && response.isSuccess()) {
log.info("新增招聘需求推送企微消息成功,招聘需求ID:{}, 招聘负责人:{}", dto.getId(), dto.getRecruiterName());
} else {
log.error("新增招聘需求推送企微消息失败,招聘需求ID:{}, response:{}", dto.getId(), JSON.toJSONString(response));
}
} catch (Exception e) {
log.error("发送新增招聘需求企微应用消息异常", e);
}
}
/**
* 新增简历推送企微应用消息
*
* @param dto
......
......@@ -256,6 +256,8 @@ public class RecruitmentResumeService {
Byte oldInterviewResult = oldResume.getInterviewResult();
String oldDescription = oldResume.getDescription();
Byte oldProcessResult = oldResume.getProcessResult();
String oldChannelType = oldResume.getChannelType();
String oldRecommendedReason = oldResume.getRecommendedReason();
String personName = resume.getPersonName();
String phoneNumber = resume.getPhoneNumber();
......@@ -264,6 +266,8 @@ public class RecruitmentResumeService {
Byte interviewResult = resume.getInterviewResult();
String description = resume.getDescription();
Byte processResult = resume.getProcessResult();
String channelType = resume.getChannelType();
String recommendedReason = resume.getRecommendedReason();
if (!Objects.equals(personName, oldPersonName)
|| !Objects.equals(phoneNumber, oldPhoneNumber)
......@@ -271,7 +275,10 @@ public class RecruitmentResumeService {
|| !Objects.equals(interviewTime, oldInterviewTime)
|| !Objects.equals(interviewResult, oldInterviewResult)
|| !Objects.equals(description, oldDescription)
|| !Objects.equals(processResult, oldProcessResult)) {
|| !Objects.equals(processResult, oldProcessResult)
|| !Objects.equals(channelType, oldChannelType)
|| !Objects.equals(recommendedReason, oldRecommendedReason)
) {
return true;
} else {
return false;
......
package cn.com.glsx.dj.staff.util;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
/**
* @author chizw
* @version ver.1.0.0
* @Description http工具
* @create 2024/4/12 16:06
*/
@Slf4j
public class HttpUtil {
private static String tokenString = "";
private static String AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED";
private static CloseableHttpClient httpClient = null;
private final static String appKey = "48e5e13229b82c1b4e6e8c96151f0637";
private final static String secret = "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b";
private final static String ROBOT_URL_PRE = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=";
private final static RestTemplate restTemplate = new RestTemplate();
private static void addBaseParam(MultiValueMap<String, String> paramsMap, String method) {
paramsMap.add("v", "1.0.0");
paramsMap.add("method", method);
paramsMap.add("name", "zhouhb");
}
public static MultiValueMap<String, String> getSysParams() {
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(16);
params.add("appKey", appKey);
params.add("format", "json");
return params;
}
public static <T> T post(String url, JSONObject json, Class<T> responseType) throws Exception {
RestTemplate restTemplate = new RestTemplate();
//创建请求头
HttpHeaders httpHeaders = new HttpHeaders();
//添加到添加进去
httpHeaders.add("Content-Type", "application/json");
HttpEntity<Object> htttpentity = new HttpEntity<>(json, httpHeaders);
//远程调用,
return restTemplate.postForObject(url, htttpentity, responseType);
}
public static <T> T post(String url, MultiValueMap<String, Object> map, Class<T> responseType, HttpHeaders httpHeaders) {
RestTemplate restTemplate = new RestTemplate();
List<HttpMessageConverter<?>> messageConverters = restTemplate.getMessageConverters();
for (int i = 0; i < messageConverters.size(); i++) {
if (messageConverters.get(i) instanceof StringHttpMessageConverter) {
StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(
StandardCharsets.UTF_8
);
messageConverters.set(i, stringConverter);
break;
}
}
restTemplate.setMessageConverters(messageConverters);
HttpEntity<Object> htttpentity = new HttpEntity<>(map, httpHeaders);
//远程调用,
return restTemplate.postForObject(url, htttpentity, responseType);
}
public static void main(String[] args) {
String url = "http://192.168.1.144:8087/reportExport/importExcel";
String filePath = "D:\\360MoveData\\Users\\chizw\\Desktop\\驻店打卡月汇总表(2025年3月份).xlsx";
RestTemplate restTemplate = new RestTemplate();
// 准备文件
FileSystemResource fileResource = new FileSystemResource(new File(filePath));
// 构造请求体
MultiValueMap<String, Object> body = new LinkedMultiValueMap<>();
body.add("file", fileResource);
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
// 构造请求
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
// 发送请求
ResponseEntity<String> response = restTemplate.postForEntity(url, requestEntity, String.class);
HttpEntity<Object> htttpentity = new HttpEntity<>(body, headers);
restTemplate.postForObject(url, htttpentity, String.class);
// 打印结果
System.out.println("Response: " + response.getBody());
}
public static <T> T doPost(String url, JSONObject json, Class<T> responseType) {
if (null == httpClient) {
httpClient = HttpClientBuilder.create().build();
}
HttpPost httpPost = new HttpPost(url);
// if (null != tokenString && tokenString.equals("")) {
// tokenString = getToken();
// }
//api_gateway_auth_token自定义header头,用于token验证使用
// httpPost.addHeader("api_gateway_auth_token", tokenString);
// httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36");
try {
StringEntity se = new StringEntity(json.toString());
se.setContentEncoding("UTF-8");
//发送json数据需要设置contentType
se.setContentType("application/json");
//设置请求参数
httpPost.setEntity(se);
HttpResponse response = httpClient.execute(httpPost);
log.info("response:{}", response.getEntity());
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
//返回json格式
String res = EntityUtils.toString(response.getEntity());
log.info("res:{}", res);
return new ObjectMapper().readValue(res, new TypeReference<T>() {
});
// return res;
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return null;
}
}
......@@ -51,7 +51,7 @@
<select id="listRecruitmentResume" resultMap="DTOResultMap">
select
dclrr.id, dclrr.demand_id, dclrr.mix_result, dclrr.status, dclrr.person_name, dclrr.phone_number, dclrr.resume_url, dclrr.process_result,
dclrr.interview_time, dclrr.interview_result, dclrr.description, dclrr.processor_name, dclrr.process_time,
dclrr.interview_time, dclrr.interview_result, dclrr.description, dclrr.processor_name, dclrr.process_time, dclrr.recommended_reason,
dclrr.created_by, dclrr.created_date, dclrr.updated_by, dclrr.updated_date, dclrr.deleted_flag
from dj_car_life_recruitment_resume dclrr
<include refid="list_condition"/>
......
......@@ -97,4 +97,12 @@ public class RecruitmentDemandServiceTest extends BaseServiceTest {
public void testRecruitmentDemandDetailWeb() {
recruitmentDemandService.recruitmentDemandDetailWeb(86);
}
@Test
public void testNewDemandQWMessage() {
RecruitmentDemandDTO dto = new RecruitmentDemandDTO();
dto.setRecruiterPhone("13603070903");
dto.setRecruiterName("xiehx");
recruitmentDemandService.newDemandQWMessage(dto);
}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!