Commit 071dbd33 authored by chenyuxi's avatar chenyuxi

feat: 瓜子交互任务

parent b8d58f64
......@@ -66,14 +66,14 @@ public class TGzOfferInfo extends BaseEntity {
/**
* Offer状态
* (3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,
* (3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,
* 12:候选人信息审核,13:待签署,8:合同审核通过,99:已归档,98:信息待收集,97:候选人审核通过)
*/
@ExcelAttribute(name = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)", isNotEmpty = true, errorInfo = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能为空", maxLength = 2)
@NotBlank(message = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能为空")
@Length(max = 2, message = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能超过2个字符")
@ExcelProperty("Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)")
@Schema(description = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)")
@ExcelAttribute(name = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)", isNotEmpty = true, errorInfo = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能为空", maxLength = 2)
@NotBlank(message = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能为空")
@Length(max = 2, message = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)不能超过2个字符")
@ExcelProperty("Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)")
@Schema(description = "Offer状态(3:待发送Offer,4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署,8:合同审核通过。99:已归档)")
private String offerStatus;
/**
* Offer短信通知状态( 0:已发送;1:未发送)
......
......@@ -60,13 +60,13 @@ public class TGzPushEntry extends BaseEntity {
@Schema(description = "流程ID(瓜子推过来的主键)")
private String bizId;
/**
* 交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)
* 交互任务类型(4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)
*/
@ExcelAttribute(name = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)", isNotEmpty = true, errorInfo = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)不能为空", maxLength = 2)
@NotBlank(message = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)不能为空")
@ExcelAttribute(name = "交互任务类型(4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)", isNotEmpty = true, errorInfo = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)不能为空", maxLength = 2)
@NotBlank(message = "交互任务类型(4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)不能为空")
@Length(max = 2, message = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)不能超过2个字符")
@ExcelProperty("交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)")
@Schema(description = "交互任务类型(4:待接受Offer,5:拒绝Offer,7:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)")
@ExcelProperty("交互任务类型(4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)")
@Schema(description = "交互任务类型(4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,97:档案信息推送,13:待签署,8:合同信息推送,99:合同附件推送)")
private String taskType;
/**
* 推送状态(0:推送成功1:推送失败2:待推送)
......
......@@ -7,6 +7,7 @@ import com.google.gson.Gson;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpContactInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.yifu.cloud.plus.v1.yifu.archives.utils.GZSign;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoPushGzAttaVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoPushGzContractVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzEmpInfoPushGzFileVo;
......@@ -25,6 +26,7 @@ import org.springframework.http.MediaType;
import org.springframework.web.client.RestTemplate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -85,8 +87,15 @@ public class GzConfig {
return false;
}
public boolean updateGzOfferStatus(RestTemplate restTemplate, Map<String, Object> params, String sortedParams) {
String gzBankUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/update-status?"+ sortedParams;
public Map<String,String> updateGzOfferStatus(RestTemplate restTemplate, Map<String, Object> params) {
// 签名
Map<String, Object> authParams = new HashMap<>();
authParams.put("appsecret", this.getAppsecret());
authParams.put("tid", this.getTid());
GZSign.addSignature(authParams, this.getAppkey(), this.getAppsecret());
String sortedParams = GZSign.getEncodeString(authParams);
String gzUpdateStatusUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/update-status?"+ sortedParams;
// 创建请求头并添加Authorization
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
......@@ -96,23 +105,37 @@ public class GzConfig {
Gson gson = new Gson();
// 创建HttpEntity,包含headers(GET请求没有body,所以为null)
HttpEntity<String> entity = new HttpEntity<>(gson.toJson(params), headers);
// 发送GET请求
String result = restTemplate.exchange(gzBankUrl, HttpMethod.POST, entity, String.class).getBody();
Map<String,String> returnMap = new HashMap<>();
returnMap.put("pushData", gson.toJson(params));
// 发送POST请求
String result = restTemplate.exchange(gzUpdateStatusUrl, HttpMethod.POST, entity, String.class).getBody();
returnMap.put("responseData", result);
System.out.println(result);
if (result != null && result.contains("code") && result.contains("data")) {
JSONObject resultObject = JSON.parseObject(result);
String code = resultObject.getString("code");
if (Common.isNotNull(code) && "S00000".equals(code)) {
System.out.println("成功");
return true;
if (Common.isNotNull(code)) {
returnMap.put("responseCode", code);
}
String message = resultObject.getString("message");
if (Common.isNotNull(message)) {
returnMap.put("responseMessage", message);
}
}
return false;
return returnMap;
}
public boolean pushGzEmpInfo(RestTemplate restTemplate, TGzEmpInfoPushGzVo a, String sortedParams) {
String gzBankUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/person-info?"+ sortedParams;
public Map<String,String> pushGzEmpInfo(RestTemplate restTemplate, TGzEmpInfoPushGzVo a) {
// 签名
Map<String, Object> params = new HashMap<>();
params.put("appsecret", this.getAppsecret());
params.put("tid", this.getTid());
GZSign.addSignature(params, this.getAppkey(), this.getAppsecret());
String sortedParams = GZSign.getEncodeString(params);
String gzEmpInfoUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/person-info?"+ sortedParams;
// 创建请求头并添加Authorization
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
......@@ -122,23 +145,36 @@ public class GzConfig {
Gson gson = new Gson();
// 创建HttpEntity,包含headers(GET请求没有body,所以为null)
HttpEntity<String> entity = new HttpEntity<>(gson.toJson(a), headers);
// 发送GET请求
String result = restTemplate.exchange(gzBankUrl, HttpMethod.POST, entity, String.class).getBody();
Map<String,String> returnMap = new HashMap<>();
returnMap.put("pushData", gson.toJson(a));
// 发送POST请求
String result = restTemplate.exchange(gzEmpInfoUrl, HttpMethod.POST, entity, String.class).getBody();
returnMap.put("responseData", result);
System.out.println(result);
if (result != null && result.contains("code") && result.contains("data")) {
JSONObject resultObject = JSON.parseObject(result);
String code = resultObject.getString("code");
if (Common.isNotNull(code) && "S00000".equals(code)) {
System.out.println("成功");
return true;
if (Common.isNotNull(code)) {
returnMap.put("responseCode", code);
}
String message = resultObject.getString("message");
if (Common.isNotNull(message)) {
returnMap.put("responseMessage", message);
}
}
return false;
return returnMap;
}
public boolean pushGzEmpContract(RestTemplate restTemplate, TGzEmpInfoPushGzContractVo a, String sortedParams) {
String gzBankUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/person-contract?"+ sortedParams;
public Map<String,String> pushGzEmpContract(RestTemplate restTemplate, TGzEmpInfoPushGzContractVo a) {
Map<String, Object> authParams = new HashMap<>();
authParams.put("appsecret", this.getAppsecret());
authParams.put("tid", this.getTid());
GZSign.addSignature(authParams, this.getAppkey(), this.getAppsecret());
String sortedParams = GZSign.getEncodeString(authParams);
String gzContractUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/person-contract?"+ sortedParams;
// 创建请求头并添加Authorization
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
......@@ -148,19 +184,26 @@ public class GzConfig {
Gson gson = new Gson();
// 创建HttpEntity,包含headers(GET请求没有body,所以为null)
HttpEntity<String> entity = new HttpEntity<>(gson.toJson(a), headers);
// 发送GET请求
String result = restTemplate.exchange(gzBankUrl, HttpMethod.POST, entity, String.class).getBody();
Map<String,String> returnMap = new HashMap<>();
returnMap.put("pushData", gson.toJson(a));
// 发送POST请求
String result = restTemplate.exchange(gzContractUrl, HttpMethod.POST, entity, String.class).getBody();
returnMap.put("responseData", result);
System.out.println(result);
if (result != null && result.contains("code") && result.contains("data")) {
JSONObject resultObject = JSON.parseObject(result);
String code = resultObject.getString("code");
if (Common.isNotNull(code) && "S00000".equals(code)) {
System.out.println("成功");
return true;
if (Common.isNotNull(code)) {
returnMap.put("responseCode", code);
}
String message = resultObject.getString("message");
if (Common.isNotNull(message)) {
returnMap.put("responseMessage", message);
}
}
return false;
return returnMap;
}
public boolean pushGzEmpContractFile(RestTemplate restTemplate, TEmpContactInfo a, String sortedParams) {
......@@ -196,7 +239,13 @@ public class GzConfig {
* @Date: 2025/7/10 17:44
* @return: boolean
**/
public String pushGzFile(RestTemplate restTemplate, TGzEmpInfoPushGzFileVo a, String sortedParams) {
public String pushGzFile(RestTemplate restTemplate, TGzEmpInfoPushGzFileVo a) {
Map<String, Object> authParams = new HashMap<>();
authParams.put("appsecret", this.getAppsecret());
authParams.put("tid", this.getTid());
GZSign.addSignature(authParams, this.getAppkey(), this.getAppsecret());
String sortedParams = GZSign.getEncodeString(authParams);
String fileId = null;
String gzBankUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/file/upload?"+ sortedParams;
// 创建请求头并添加Authorization
......@@ -230,8 +279,14 @@ public class GzConfig {
* @Date: 2025/7/10 17:50
* @return: boolean
**/
public String pushGzAttach(RestTemplate restTemplate, TGzEmpInfoPushGzAttaVo a, String sortedParams) {
String gzBankUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/attach?"+ sortedParams;
public Map<String,String> pushGzAttach(RestTemplate restTemplate, TGzEmpInfoPushGzAttaVo a) {
Map<String, Object> authParams = new HashMap<>();
authParams.put("appsecret", this.getAppsecret());
authParams.put("tid", this.getTid());
GZSign.addSignature(authParams, this.getAppkey(), this.getAppsecret());
String sortedParams = GZSign.getEncodeString(authParams);
String gzAttachUrl = appUrl + "/eim-hr-induction/api/hr/induction/open/offer/attach?"+ sortedParams;
// 创建请求头并添加Authorization
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
......@@ -241,21 +296,27 @@ public class GzConfig {
Gson gson = new Gson();
// 创建HttpEntity,包含headers(GET请求没有body,所以为null)
HttpEntity<String> entity = new HttpEntity<>(gson.toJson(a), headers);
// 发送GET请求
String result = restTemplate.exchange(gzBankUrl, HttpMethod.POST, entity, String.class).getBody();
Map<String,String> returnMap = new HashMap<>();
returnMap.put("pushData", gson.toJson(a));
// 发送POST请求
String result = restTemplate.exchange(gzAttachUrl, HttpMethod.POST, entity, String.class).getBody();
returnMap.put("responseData", result);
System.out.println(result);
if (result != null && result.contains("code") && result.contains("data")) {
JSONObject resultObject = JSON.parseObject(result);
String code = resultObject.getString("code");
if (Common.isNotNull(code)) {
returnMap.put("responseCode", code);
}
String message = resultObject.getString("message");
if (Common.isNotNull(code) && "S00000".equals(code)) {
return "成功";
} else {
return message;
if (Common.isNotNull(message)) {
returnMap.put("responseMessage", message);
}
}
return "失败";
return returnMap;
}
}
......@@ -148,7 +148,7 @@ public class TGzController {
* @return: boolean
**/
@GetMapping("/updateGzOfferStatus")
public boolean updateGzOfferStatus(@RequestParam String bizId, @RequestParam Integer status
public Map<String,String> updateGzOfferStatus(@RequestParam String bizId, @RequestParam Integer status
, @RequestParam(required = false) String phone, @RequestParam(required = false) String email
, @RequestParam(required = false) String entryDate) {
Map<String, Object> params = new HashMap<>();
......@@ -163,7 +163,7 @@ public class TGzController {
params.put("email", email);
params.put("entryDate", entryDate);
return gzConfig.updateGzOfferStatus(restTemplate, params, sortedParams);
return gzConfig.updateGzOfferStatus(restTemplate, params);
}
/**
......@@ -173,7 +173,7 @@ public class TGzController {
* @return: boolean
**/
@GetMapping("/pushGzEmpInfo")
public boolean pushGzEmpInfo(@RequestParam(required = false) String gzEmpId) {
public Map<String,String> pushGzEmpInfo(@RequestParam(required = false) String gzEmpId) {
Map<String, Object> params = new HashMap<>();
params.put("appsecret", gzConfig.getAppsecret());
params.put("tid", gzConfig.getTid());
......@@ -184,7 +184,7 @@ public class TGzController {
gzEmpId = "1942036120125800449";
}
TGzEmpInfoPushGzVo a = tGzEmpInfoService.getGzEmpInfoToPushGzById(gzEmpId);
return gzConfig.pushGzEmpInfo(restTemplate, a, sortedParams);
return gzConfig.pushGzEmpInfo(restTemplate, a);
}
/**
* @Description: 3、合同信息回推接口;
......@@ -193,7 +193,7 @@ public class TGzController {
* @return: boolean
**/
@GetMapping("/pushGzEmpContract")
public boolean pushGzEmpContract(@RequestParam(required = false) String gzEmpId) {
public Map<String,String> pushGzEmpContract(@RequestParam(required = false) String gzEmpId) {
Map<String, Object> params = new HashMap<>();
params.put("appsecret", gzConfig.getAppsecret());
params.put("tid", gzConfig.getTid());
......@@ -204,7 +204,7 @@ public class TGzController {
gzEmpId = "1942036120125800449";
}
TGzEmpInfoPushGzContractVo a = tGzEmpInfoService.getGzEmpInfoToPushGzByIdContract(gzEmpId);
return gzConfig.pushGzEmpContract(restTemplate, a, sortedParams);
return gzConfig.pushGzEmpContract(restTemplate, a);
}
/**
* @Description: 4.2.3、员工文件信息上传接口
......@@ -244,7 +244,7 @@ public class TGzController {
vo.setFileName(a.getAttaName());
// 文件数据 Base64
vo.setFileData(base64String);
returnMap.put(a.getId(), gzConfig.pushGzFile(restTemplate, vo, sortedParams));
returnMap.put(a.getId(), gzConfig.pushGzFile(restTemplate, vo));
} catch (Exception e) {
log.info("瓜子附件推送失败!");
} finally {
......@@ -302,14 +302,17 @@ public class TGzController {
vo.setFileName(a.getAttaName());
// 文件数据 Base64
vo.setFileData(base64String);
fileId = gzConfig.pushGzFile(restTemplate, vo, sortedParams);
fileId = gzConfig.pushGzFile(restTemplate, vo);
attaVo = new TGzEmpInfoPushGzAttaVo();
attaVo.setBizId(bizId);
attaVo.setFileId(fileId);
attaVo.setAttachType(a.getRelationType());
attaVo.setFileName(a.getAttaName());
returnMap.put(a.getId(), gzConfig.pushGzAttach(restTemplate, attaVo, sortedParams));
gzConfig.pushGzAttach(restTemplate, attaVo);
//returnMap.put(a.getId(), gzConfig.pushGzAttach(restTemplate, attaVo));
} catch (Exception e) {
log.info("瓜子附件推送失败!");
} finally {
......
......@@ -27,6 +27,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
/**
......@@ -54,4 +55,16 @@ public class TGzPushEntryController {
public R<IPage<TGzPushEntrySearchVo>> getTGzPushEntryPage(Page<TGzPushEntry> page, TGzPushEntrySearchVo tGzPushEntry) {
return new R<>(tGzPushEntryService.getTGzPushEntryPage(page,tGzPushEntry));
}
/**
* 任务推送重试
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return R
*/
@Operation(summary = "任务推送重试")
@SysLog("任务推送重试" )
@PostMapping("/retry")
public R<String> retryPushEntry(@RequestBody TGzPushEntry tGzPushEntry) {
return tGzPushEntryService.retryPushEntry(tGzPushEntry);
}
}
......@@ -37,4 +37,13 @@ public interface TGzContractService {
*/
void saveContractInfoToGzEmpInfo(TEmployeeContractInfo contractInfo, Integer offerId, String workLocation, String workLocationDescr);
/**
* 存合同附件到瓜子档案里
* chenyx
*
* @param offerId offerId
* @param contractId 合同ID
*/
void saveContractAtta(Integer offerId, String contractId);
}
......@@ -22,6 +22,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzPushEntry;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzPushEntrySearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
/**
* 瓜子系统交互任务跟进表
......@@ -36,4 +37,19 @@ public interface TGzPushEntryService extends IService<TGzPushEntry> {
* @return
*/
IPage<TGzPushEntrySearchVo> getTGzPushEntryPage(Page<TGzPushEntry> page, TGzPushEntrySearchVo tGzPushEntry);
/**
* 任务推送重试
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return R
*/
R<String> retryPushEntry(TGzPushEntry tGzPushEntry);
/**
* 新增推送任务(异步)
* @param tGzPushEntry 瓜子系统交互任务跟进表
*/
void addPushEntry(TGzPushEntry tGzPushEntry);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzPushEntry;
/**
* 瓜子系统交互任务处理异步任务类
*
* @author chenyuxi
* @date 2025-07-11
* @since 1.7.13
*/
public interface TGzPushHandleService {
/**
* 处理异步的推送任务
* @param tGzPushEntry 瓜子系统交互任务跟进表
*/
void handlePushEntry(TGzPushEntry tGzPushEntry);
}
......@@ -112,6 +112,10 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private final TGzContractService tGzContractService;
private final TGzPushEntryService tGzPushEntryService;
private final TGzEmpInfoMapper tGzEmpInfoMapper;
/**
* 员工合同信息表简单分页查询
*
......@@ -2297,10 +2301,36 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tGzContractService.saveContractInfoToGzEmpInfo(contractInfo, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation(),gzOfferInfo.getWorkLocationDescr());
}
// 1.7.13: updStatus == 99:存合同附件到瓜子档案里
if(CommonConstants.NINETY_NINE.equals(updStatus)){
// 查档案ID
TGzEmpInfo gzEmpInfo = tGzEmpInfoMapper.getInfoByOfferId(gzOfferInfo.getId());
if(Common.isNotNull(gzEmpInfo)){
// 获取合同归档附件
List<TAttaInfo> contractAttas = tAttaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId,contractInfo.getId()));
if (Common.isNotNull(contractAttas)) {
for (TAttaInfo attaInfo : contractAttas) {
// 附件赋值
TAttaInfo gzContractAtta = new TAttaInfo();
BeanUtils.copyProperties(attaInfo, gzContractAtta);
gzContractAtta.setDomainId(gzEmpInfo.getId());
gzContractAtta.setRelationType("CONTRACT");
gzContractAtta.setId(null);
gzContractAtta.setCreateBy(userId);
gzContractAtta.setCreateName(nickname);
gzContractAtta.setCreateTime(LocalDateTime.now());
tAttaInfoService.save(gzContractAtta);
}
}
}
}
// 瓜子状态变更增加操作日志
// 13:待签署,8:合同审核通过,99:已归档
// 9:发起合同申请10:合同审核通过;11:合同归档;
String recordFrom = "";
switch (updStatus) {
case "13":
recordFrom = "9";
......@@ -2313,6 +2343,16 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
break;
}
// 1.7.13: 推送瓜子
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(userId);
tGzPushEntry.setCreateName(nickname);
tGzPushEntry.setBizId(gzOfferInfo.getBizId());
tGzPushEntry.setTaskType(updStatus);
tGzPushEntry.setName(gzOfferInfo.getName());
tGzPushEntry.setNationalId(gzOfferInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
LGuaziOfferRecordVo lGuaziOfferRecordVo = new LGuaziOfferRecordVo();
// 存变更前后的状态到 状态数组里
List<String> changeStatusList = new ArrayList<>();
......
......@@ -141,6 +141,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
private final TGzContractService tGzContractService;
private final TGzPushEntryService tGzPushEntryService;
@Autowired
private OSSUtil ossUtil;
......@@ -2636,6 +2638,15 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
// 合同审核通过 生成瓜子档案里的合同信息
tGzContractService.saveContractInfoToGzEmpInfo(c, gzOfferInfo.getId(), gzOfferInfo.getWorkLocation(),gzOfferInfo.getWorkLocationDescr());
// 1.7.13: 合同审核通过:推送瓜子 合同信息
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(vo.getCreateBy());
tGzPushEntry.setCreateName(vo.getCreateName());
tGzPushEntry.setBizId(gzOfferInfo.getBizId());
tGzPushEntry.setTaskType(CommonConstants.EIGHT_STRING);
tGzPushEntry.setName(gzOfferInfo.getName());
tGzPushEntry.setNationalId(gzOfferInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
// 瓜子状态变更增加操作日志
LGuaziOfferRecordVo lGuaziOfferRecordVo = new LGuaziOfferRecordVo();
......@@ -2773,6 +2784,16 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
gzOfferInfo.setOfferStatus(CommonConstants.THIRTEEN_STRING);
gzOfferInfoMapper.updateById(gzOfferInfo);
// 1.7.13: 合同提交申请:推送瓜子 更新状态
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(contract.getCreateBy());
tGzPushEntry.setCreateName(contract.getCreateName());
tGzPushEntry.setBizId(gzOfferInfo.getBizId());
tGzPushEntry.setTaskType(CommonConstants.THIRTEEN_STRING);
tGzPushEntry.setName(gzOfferInfo.getName());
tGzPushEntry.setNationalId(gzOfferInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
// 瓜子状态变更增加操作日志
LGuaziOfferRecordVo lGuaziOfferRecordVo = new LGuaziOfferRecordVo();
// 存变更前后的状态到 状态数组里
......
......@@ -16,19 +16,25 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TAttaInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzEmpInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzEmpInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TAttaInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzContractService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.List;
/**
* 瓜子合同提取方法
......@@ -43,6 +49,8 @@ public class TGzContractServiceImpl implements TGzContractService {
private final TGzEmpInfoMapper tGzEmpInfoMapper;
private final TAttaInfoService tAttaInfoService;
/**
* 生成瓜子档案里的合同信息
* chenyx
......@@ -107,4 +115,33 @@ public class TGzContractServiceImpl implements TGzContractService {
}
}
/**
* 存合同附件到瓜子档案里
* chenyx
*
* @param offerId offerId
* @param contractId 合同ID
*/
@Override
public void saveContractAtta(Integer offerId, String contractId) {
TGzEmpInfo gzEmpInfo = tGzEmpInfoMapper.getInfoByOfferId(offerId);
if(Common.isNotNull(gzEmpInfo)){
// 获取合同归档附件
List<TAttaInfo> contractAttas = tAttaInfoService.list(Wrappers.<TAttaInfo>query().lambda().eq(TAttaInfo::getDomainId, contractId));
if (Common.isNotNull(contractAttas)) {
for (TAttaInfo attaInfo : contractAttas) {
// 附件赋值
TAttaInfo gzContractAtta = new TAttaInfo();
BeanUtils.copyProperties(attaInfo, gzContractAtta);
gzContractAtta.setDomainId(gzEmpInfo.getId());
gzContractAtta.setRelationType("CONTRACT");
gzContractAtta.setId(null);
gzContractAtta.setCreateBy("1");
gzContractAtta.setCreateName("系统");
gzContractAtta.setCreateTime(LocalDateTime.now());
tAttaInfoService.save(gzContractAtta);
}
}
}
}
}
......@@ -43,6 +43,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.security.core.GrantedAuthority;
......@@ -113,6 +114,8 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
// 员工家庭信息表
private final TEmpFamilyService tEmpFamilyService;
private final TGzPushEntryService tGzPushEntryService;
/**
* 瓜子档案表简单分页查询
......@@ -507,6 +510,26 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
// 记录状态变更的offer操作日志 记录来源: 6:(系统触发)C端采集提交
this.saveOfferStatusRecord(gzOfferInfo.getId(),CommonConstants.SIX_STRING,
CommonConstants.NINE_STRING,gzOfferInfo.getOfferStatus(),"0","系统触发");
// 1.7.13: 同一个流程ID推送过12:候选人信息审核,之前没推送过这个状态的,才触发推送
TGzPushEntry findFailInfo = tGzPushEntryService.getOne(Wrappers.<TGzPushEntry>query().lambda()
.eq(TGzPushEntry::getBizId, gzOfferInfo.getBizId())
.eq(TGzPushEntry::getTaskType, "12")
.eq(TGzPushEntry::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(findFailInfo)) {
// 推送状态给瓜子
if(!CommonConstants.ZERO_STRING.equals(gzOfferInfo.getBizId())){
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(gzOfferInfo.getBizId());
tGzPushEntry.setTaskType("12");
tGzPushEntry.setName(gzOfferInfo.getName());
tGzPushEntry.setNationalId(gzOfferInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
}
}
String gzEmpId = tGzEmpInfoVo.getId();
......@@ -841,22 +864,33 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
@Override
public TGzEmpInfoPushGzVo getGzEmpInfoToPushGzById(String gzEmpId) {
TGzEmpInfoPushGzVo vo = baseMapper.getGzEmpInfoToPushGzById(gzEmpId);
TGzEmpInfoPushGzVoAdress adress = baseMapper.getGzEmpInfoToPushGzByIdAdress(gzEmpId);
TGzEmpInfoPushGzVoAdress address = baseMapper.getGzEmpInfoToPushGzByIdAdress(gzEmpId);
TGzEmpInfoPushGzVoBank bank = baseMapper.getGzEmpInfoToPushGzByIdBank(gzEmpId);
List<TGzEmpInfoPushGzVoFamily> family = baseMapper.getGzEmpInfoToPushGzByIdFamily(gzEmpId);
List<TGzEmpInfoPushGzVoContact> contact = baseMapper.getGzEmpInfoToPushGzByIdContact(gzEmpId);
List<TGzEmpInfoPushGzVoWork> work = baseMapper.getGzEmpInfoToPushGzByIdWork(gzEmpId);
List<TGzEmpInfoPushGzVoEducation> education = baseMapper.getGzEmpInfoToPushGzByIdEducation(gzEmpId);
List<TGzEmpInfoPushGzVoSkill> skill = baseMapper.getGzEmpInfoToPushGzByIdSkill(gzEmpId);
List<TGzEmpInfoPushGzVoAtta> atta = baseMapper.getGzEmpInfoToPushGzByIdAtta(gzEmpId);
vo.setAddress(adress);
String[] directlyCityArr = {"110000", "120000", "310000", "500000"};
// 特殊处理: 是4个直辖市的,市编码和省编码一致
if (ArrayUtils.contains(directlyCityArr, vo.getHukouProvince())) {
vo.setHukouCity(vo.getHukouProvince());
}
if (ArrayUtils.contains(directlyCityArr, address.getStateId())) {
address.setCityId(address.getStateId());
}
//List<TGzEmpInfoPushGzVoAtta> atta = baseMapper.getGzEmpInfoToPushGzByIdAtta(gzEmpId);
vo.setAddress(address);
vo.setBankAccount(bank);
vo.setFamily(family);
vo.setEmergContact(contact);
vo.setWorkExp(work);
vo.setEduExp(education);
vo.setSkill(skill);
vo.setAttach(atta);
//vo.setAttach(atta);
return vo;
}
......
......@@ -31,9 +31,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzOfferInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TRegisteWarningEmployee;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.EmployeeRegistrationPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzOfferInfoMapper;
......@@ -51,6 +49,7 @@ import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -86,9 +85,6 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
// 瓜子合同信息提取方法————因为循环调用了
private final TGzContractService tGzContractService;
@Autowired
private UpmsDaprUtils upmsDaprUtils;
// 禁止手动变更的状态:3:待发送Offer,9:候选人填写信息,12:候选人信息审核,13:待签署,8:合同审核通过,99:已归档,97:候选人审核通过
private final String[] forbidStatusArr = {"3", "9", "12", "13", "8","99","97"};
......@@ -100,6 +96,8 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
private final TGzEmpInfoService tGzEmpInfoService;
private final TGzPushEntryService tGzPushEntryService;
/**
* 瓜子offer信息接收表简单分页查询
* @param tGzOfferInfo 瓜子offer信息接收表
......@@ -242,6 +240,18 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
this.saveOfferStatusRecord(tGzOfferInfo.getId(),CommonConstants.ONE_STRING,
findInfo.getOfferStatus(),tGzOfferInfo.getOfferStatus(),user.getId(),user.getNickname());
// 1.7.13:推送状态给瓜子
if(!CommonConstants.ZERO_STRING.equals(findInfo.getBizId())){
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(findInfo.getBizId());
tGzPushEntry.setTaskType(tGzOfferInfo.getOfferStatus());
tGzPushEntry.setName(findInfo.getName());
tGzPushEntry.setNationalId(findInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
return R.ok(CommonConstants.RESULT_DATA_SUCESS);
}
......@@ -285,6 +295,18 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
return saveEmpInfoR;
}
// 1.7.13:推送档案信息给瓜子
if(!CommonConstants.ZERO_STRING.equals(findInfo.getBizId())){
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(findInfo.getBizId());
tGzPushEntry.setTaskType("97");
tGzPushEntry.setName(findInfo.getName());
tGzPushEntry.setNationalId(findInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
// 2、检查 该项目该人员是否有在途或审核通过或已归档的状态为“可用”的合同,
// 若有则根据当前状态更新Offer状态,合同未审核通过:存【13:待签署】;合同审核通过:存【8:合同审核通过】;合同已归档:存【99:已归档】,
// 存合同信息;
......@@ -304,6 +326,12 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
this.saveOfferStatusRecord(findInfo.getId(),CommonConstants.SEVEN_STRING,
findInfo.getOfferStatus(),tGzOfferInfo.getOfferStatus(),user.getId(),user.getNickname());
// 1.7.13 变更到合同相关的状态,推合同信息给瓜子
if(CommonConstants.THIRTEEN_STRING.equals(tGzOfferInfo.getOfferStatus())
|| CommonConstants.EIGHT_STRING.equals(tGzOfferInfo.getOfferStatus()) || "99".equals(tGzOfferInfo.getOfferStatus())){
this.pushContractData(findInfo, user, tGzOfferInfo.getOfferStatus());
}
return R.ok(CommonConstants.RESULT_DATA_SUCESS);
}
......@@ -324,11 +352,14 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
.eq(TEmployeeContractInfo::getEmpIdcard, nationalId)
.last(CommonConstants.LAST_ONE_SQL));
if(Common.isNotNull(contractInfo)){
// 合同已归档
// 合同已归档,多存一个合同归档附件
if(CommonConstants.ZERO_STRING.equals(contractInfo.getIsFile())
&& CommonConstants.ZERO_STRING.equals(contractInfo.getInUse())){
// 生成瓜子档案里的合同信息
tGzContractService.saveContractInfoToGzEmpInfo(contractInfo, offerId, workLocation, workLocationDescr);
// 1.7.13: 存合同附件
tGzContractService.saveContractAtta(offerId, contractInfo.getId());
return "99";
}
// 合同审核通过
......@@ -347,6 +378,64 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
return changeStatus;
}
/**
* 1.7.13 推合同信息
* @param findInfo offer信息
* @param user 登录用户
* @param offerStatus offer状态
*/
private void pushContractData(TGzOfferInfo findInfo,YifuUser user, String offerStatus){
if(!CommonConstants.ZERO_STRING.equals(findInfo.getBizId())){
// 推送 瓜子状态 待签署
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(findInfo.getBizId());
tGzPushEntry.setTaskType(CommonConstants.THIRTEEN_STRING);
tGzPushEntry.setName(findInfo.getName());
tGzPushEntry.setNationalId(findInfo.getNationalId());
// 推合同信息
TGzPushEntry tGzPushEntry1 = new TGzPushEntry();
tGzPushEntry1.setCreateBy(user.getId());
tGzPushEntry1.setCreateName(user.getNickname());
tGzPushEntry1.setBizId(findInfo.getBizId());
tGzPushEntry1.setTaskType(CommonConstants.EIGHT_STRING);
tGzPushEntry1.setName(findInfo.getName());
tGzPushEntry1.setNationalId(findInfo.getNationalId());
// 推合同附件信息
TGzPushEntry tGzPushEntry2 = new TGzPushEntry();
tGzPushEntry2.setCreateBy(user.getId());
tGzPushEntry2.setCreateName(user.getNickname());
tGzPushEntry2.setBizId(findInfo.getBizId());
tGzPushEntry2.setTaskType("99");
tGzPushEntry2.setName(findInfo.getName());
tGzPushEntry2.setNationalId(findInfo.getNationalId());
// offer状态是待签署,只推状态
if(CommonConstants.THIRTEEN_STRING.equals(offerStatus)){
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
// offer状态是合同审核通过 ,推待签署状态 + 推合同信息
if(CommonConstants.EIGHT_STRING.equals(offerStatus)){
// 先推 瓜子状态 待签署
tGzPushEntryService.addPushEntry(tGzPushEntry);
// 推合同信息
tGzPushEntryService.addPushEntry(tGzPushEntry1);
}
// offer状态是已归档 ,推待签署状态 + 推合同信息 + 推合同附件
if("99".equals(offerStatus)){
// 先推 瓜子状态 待签署
tGzPushEntryService.addPushEntry(tGzPushEntry);
// 推合同信息
tGzPushEntryService.addPushEntry(tGzPushEntry1);
// 推合同附件信息
tGzPushEntryService.addPushEntry(tGzPushEntry2);
}
}
}
/**
* 获取当前状态下,允许更新的状态列表
*
......@@ -363,13 +452,13 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
}
// 4:待接受Offer
if (CommonConstants.FOUR_STRING.equals(orgStatus)) {
// 可更新为:5:拒绝Offer、7:接受offer、10:取消offer
// 可更新为:5:拒绝Offer、7->6:接受offer、10:取消offer
allowUpdateStatusList.add(CommonConstants.FIVE_STRING);
allowUpdateStatusList.add(CommonConstants.SEVEN_STRING);
allowUpdateStatusList.add(CommonConstants.SIX_STRING);
allowUpdateStatusList.add(CommonConstants.TEN_STRING);
}
// 7:接受Offer
if (CommonConstants.SEVEN_STRING.equals(orgStatus)) {
// 7->6:接受Offer
if (CommonConstants.SIX_STRING.equals(orgStatus)) {
// 可更新为:98:信息待收集、10:取消offer
allowUpdateStatusList.add("98");
allowUpdateStatusList.add(CommonConstants.TEN_STRING);
......@@ -605,6 +694,18 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
// 更新前状态是 98:信息待收集,短信发送成功后,记录状态变更
if("98".equals(sendVo.getOfferStatus())){
changeOfferIds.add(sendVo.getId());
// 1.7.13:推送状态[候选人填写信息]给瓜子
if(!CommonConstants.ZERO_STRING.equals(sendVo.getBizId())){
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(sendVo.getBizId());
tGzPushEntry.setTaskType("9");
tGzPushEntry.setName(sendVo.getName());
tGzPushEntry.setNationalId(sendVo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
}
// 记录发送短信成功的offerId 到集合
successOfferIds.add(sendVo.getId());
......@@ -1016,6 +1117,18 @@ public class TGzOfferInfoServiceImpl extends ServiceImpl<TGzOfferInfoMapper, TGz
// 记录状态变更的offer操作日志 记录来源: 手动更新状态
this.saveOfferStatusRecord(findInfo.getId(),CommonConstants.ONE_STRING,
findInfo.getOfferStatus(),tGzOfferInfo.getOfferStatus(),user.getId(),user.getNickname());
// 1.7.13:推送状态给瓜子
if(!CommonConstants.ZERO_STRING.equals(findInfo.getBizId())){
TGzPushEntry tGzPushEntry = new TGzPushEntry();
tGzPushEntry.setCreateBy(user.getId());
tGzPushEntry.setCreateName(user.getNickname());
tGzPushEntry.setBizId(findInfo.getBizId());
tGzPushEntry.setTaskType(tGzOfferInfo.getOfferStatus());
tGzPushEntry.setName(findInfo.getName());
tGzPushEntry.setNationalId(findInfo.getNationalId());
tGzPushEntryService.addPushEntry(tGzPushEntry);
}
}
if(Common.isEmpty(updateFailOfferList)){
......
......@@ -16,17 +16,28 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzPushEntry;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzPushEntryMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzPushEntryService;
import com.yifu.cloud.plus.v1.yifu.archives.utils.DoJointTask;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzPushEntrySearchVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.time.LocalDateTime;
/**
* 瓜子系统交互任务跟进表
*
......@@ -37,13 +48,86 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@Service
@RequiredArgsConstructor
public class TGzPushEntryServiceImpl extends ServiceImpl<TGzPushEntryMapper, TGzPushEntry> implements TGzPushEntryService {
/**
* 瓜子系统交互任务跟进表简单分页查询
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return
*/
@Override
public IPage<TGzPushEntrySearchVo> getTGzPushEntryPage(Page<TGzPushEntry> page, TGzPushEntrySearchVo tGzPushEntry){
return baseMapper.getTGzPushEntryPage(page,tGzPushEntry);
}
@Autowired
@Lazy
private DoJointTask doJointTask;
/**
* 瓜子系统交互任务跟进表简单分页查询
*
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return
*/
@Override
public IPage<TGzPushEntrySearchVo> getTGzPushEntryPage(Page<TGzPushEntry> page, TGzPushEntrySearchVo tGzPushEntry) {
return baseMapper.getTGzPushEntryPage(page, tGzPushEntry);
}
/**
* 任务推送重试
*
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return R
*/
@Override
public R<String> retryPushEntry(TGzPushEntry tGzPushEntry) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (Common.isEmpty(tGzPushEntry.getId())) {
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
// 获取推送失败的数据信息
TGzPushEntry findInfo = this.getOne(Wrappers.<TGzPushEntry>query().lambda()
.eq(TGzPushEntry::getId, tGzPushEntry.getId())
.eq(TGzPushEntry::getPushStatus, CommonConstants.ONE_STRING)
.eq(TGzPushEntry::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(findInfo)) {
return R.failed(CommonConstants.ERROR_NO_DOMAIN);
}
findInfo.setUpdateBy(user.getId());
// 改为异步处理
doJointTask.handleGzPushEntry(findInfo);
return R.ok("已发起重新推送,正在后台推送中...稍后请刷新页面查看结果");
}
/**
* 新增推送任务
*
* @param tGzPushEntry 瓜子系统交互任务跟进表
*/
@Override
public void addPushEntry(TGzPushEntry tGzPushEntry) {
// offer状态是 7 的,改为推送 6
if(CommonConstants.SEVEN_STRING.equals(tGzPushEntry.getTaskType())){
tGzPushEntry.setTaskType(CommonConstants.SIX_STRING);
}
// 新建任务,先存为"待推送"
tGzPushEntry.setPushStatus(CommonConstants.TWO_STRING);
tGzPushEntry.setCreateTime(LocalDateTime.now());
tGzPushEntry.setDelFlag(CommonConstants.NOT_DELETE_FLAG);
this.save(tGzPushEntry);
// 除了本次任务,获取是否有【推送失败、待推送】的任务,有的话本次不推送,存为“待推送”就结束
TGzPushEntry findBizFailInfo = this.getOne(Wrappers.<TGzPushEntry>query().lambda()
.eq(TGzPushEntry::getBizId, tGzPushEntry.getBizId())
.ne(TGzPushEntry::getId, tGzPushEntry.getId())
.in(TGzPushEntry::getPushStatus, CommonConstants.ONE_STRING, CommonConstants.TWO_STRING)
.eq(TGzPushEntry::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(findBizFailInfo)) {
return;
}
tGzPushEntry.setUpdateBy(tGzPushEntry.getCreateBy());
// 改为异步处理
doJointTask.handleGzPushEntry(tGzPushEntry);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.config.GzConfig;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzEmpInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.time.LocalDateTime;
import java.util.*;
/**
* 瓜子系统交互任务处理异步任务类
*
* @author chenyuxi
* @date 2025-07-11
* @since 1.7.13
*/
@Log4j2
@Service
@RequiredArgsConstructor
public class TGzPushHandleServiceImpl implements TGzPushHandleService {
private final TGzPushEntryService tGzPushEntryService;
private final TGzEmpInfoMapper tGzEmpInfoMapper;
private final TGzEmpInfoService tGzEmpInfoService;
private final TAttaInfoService tAttaInfoService;
@Autowired
private GzConfig gzConfig;
@Autowired
private OSSUtil ossUtil;
private RestTemplate restTemplate = new RestTemplate();
// 任务类型是改状态的: 4:待接受Offer,5:拒绝Offer,6:接受offer,9:候选人填写信息,10:取消offer,12:候选人信息审核,13:待签署
private final String[] taskTypeArr = {"4", "5", "6", "9", "10", "12", "13"};
/**
* 处理异步的推送任务
*
* @param tGzPushEntry 瓜子系统交互任务跟进表
*/
@Override
public void handlePushEntry(TGzPushEntry tGzPushEntry) {
// 判断推送任务: 如果任务类型是改状态的,直接获取任务记录里的数据推送
if (ArrayUtils.contains(taskTypeArr, tGzPushEntry.getTaskType())) {
// 状态推送任务
this.pushStatusTask(tGzPushEntry);
} else {
// 97:档案信息推送,8:合同信息推送,99:合同附件推送
if("97".equals(tGzPushEntry.getTaskType())){
this.pushEmpTask(tGzPushEntry);
}
if("8".equals(tGzPushEntry.getTaskType())){
this.pushContractTask(tGzPushEntry);
}
if("99".equals(tGzPushEntry.getTaskType())){
this.pushContractAttaTask(tGzPushEntry);
}
}
tGzPushEntry.setUpdateTime(LocalDateTime.now());
tGzPushEntryService.updateById(tGzPushEntry);
// 如果推送结果是成功,再获取【同一个流程ID最早一个未推送状态的数据】进行推送,
// 推送成功更新数据,继续获取【同一个流程ID最早一个未推送状态的数据】
if(CommonConstants.ZERO_STRING.equals(tGzPushEntry.getPushStatus())){
this.pushWaitEntry(tGzPushEntry);
}
}
/**
* 判断是否继续推 待推送
*
* @param tGzPushEntry 瓜子系统交互任务跟进表
* @return R
*/
private void pushWaitEntry(TGzPushEntry tGzPushEntry) {
// 获取下一个待推送的数据
TGzPushEntry findWaitInfo = tGzPushEntryService.getOne(Wrappers.<TGzPushEntry>query().lambda()
.eq(TGzPushEntry::getBizId, tGzPushEntry.getBizId())
.eq(TGzPushEntry::getPushStatus, CommonConstants.TWO_STRING)
.eq(TGzPushEntry::getDelFlag, CommonConstants.ZERO_STRING)
.orderByAsc(TGzPushEntry::getCreateTime)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(findWaitInfo)) {
return;
}
// 如果任务类型是改状态的,直接获取任务记录里的数据推送
if (ArrayUtils.contains(taskTypeArr, findWaitInfo.getTaskType())) {
// 更新推送信息
this.pushStatusTask(findWaitInfo);
} else {
// 如果任务类型是:推数据,重新获取档案里的数据推送
// 97:档案信息推送,8:合同信息推送,99:合同附件推送
if("97".equals(findWaitInfo.getTaskType())){
this.pushEmpTask(findWaitInfo);
}
if("8".equals(findWaitInfo.getTaskType())){
this.pushContractTask(findWaitInfo);
}
if("99".equals(findWaitInfo.getTaskType())){
this.pushContractAttaTask(findWaitInfo);
}
}
findWaitInfo.setUpdateBy(tGzPushEntry.getUpdateBy());
findWaitInfo.setUpdateTime(LocalDateTime.now());
tGzPushEntryService.updateById(findWaitInfo);
// 推送成功更新数据,继续获取【同一个流程ID最早一个未推送状态的数据】
if(CommonConstants.ZERO_STRING.equals(findWaitInfo.getPushStatus())){
this.pushWaitEntry(findWaitInfo);
}
}
/**
* 对接瓜子-进行状态任务推送
*
* @param pushInfo 瓜子系统交互任务跟进表
*/
private void pushStatusTask(TGzPushEntry pushInfo) {
// 赋值传参
Map<String, Object> params = new HashMap<>();
params.put("bizId", pushInfo.getBizId());
params.put("status", pushInfo.getTaskType());
// 调瓜子接口
Map<String,String> returnMap = gzConfig.updateGzOfferStatus(restTemplate, params);
// 公共处理瓜子返回的信息
this.handlePushReturnCommon(pushInfo, returnMap);
}
/**
* 对接瓜子-档案推送
*
* @param pushInfo 瓜子系统交互任务跟进表
*/
private void pushEmpTask(TGzPushEntry pushInfo) {
// 根据流程ID获取档案信息
TGzEmpInfo findEmpInfo = this.getEmpInfoCommon(pushInfo.getBizId());
if (Common.isNotNull(findEmpInfo)) {
// 调瓜子接口:获取档案附件,先上传档案附件给瓜子,再推档案信息
// 1、获取档案附件
List<TGzEmpInfoPushGzVoAtta> gzEmpAttaList = new ArrayList<>();
List<TAttaInfo> aList = tAttaInfoService.list(Wrappers.<TAttaInfo>query().lambda()
.eq(TAttaInfo::getDomainId, findEmpInfo.getId())
.notIn(TAttaInfo::getRelationType, "41","42","43","CONTRACT"));
if(Common.isNotNull(aList)){
TGzEmpInfoPushGzFileVo vo;
TGzEmpInfoPushGzVoAtta attaVo;
String bizId = pushInfo.getBizId();
String fileId;
URL url;
InputStream inStream = null;
String base64String;
for (TAttaInfo a : aList) {
// 2、上传档案附件给瓜子
if (Common.isNotNull(a.getAttaSrc())) {
url = ossUtil.getObjectUrl(null, a.getAttaSrc());
try {
inStream = url.openStream();
base64String = Base64.getEncoder().encodeToString(IOUtils.toByteArray(inStream));
vo = new TGzEmpInfoPushGzFileVo();
vo.setBizId(bizId);
vo.setFileName(a.getAttaName());
// 文件数据 Base64
vo.setFileData(base64String);
// 调瓜子上传附件接口,得到瓜子存储附件的ID
fileId = gzConfig.pushGzFile(restTemplate, vo);
// 组装档案附件列表
attaVo = new TGzEmpInfoPushGzVoAtta();
attaVo.setFileId(fileId);
attaVo.setAttachType(a.getRelationType());
attaVo.setFileName(a.getAttaName());
gzEmpAttaList.add(attaVo);
} catch (Exception e) {
log.error("瓜子档案附件推送失败!", e);
} finally {
if (null != inStream) {
try {
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
}
// 3、获取档案信息
TGzEmpInfoPushGzVo gzPushEmpInfo = tGzEmpInfoService.getGzEmpInfoToPushGzById(findEmpInfo.getId());
gzPushEmpInfo.setAttach(gzEmpAttaList);
// 4、推送瓜子档案
Map<String,String> returnMap = gzConfig.pushGzEmpInfo(restTemplate, gzPushEmpInfo);
// 公共处理瓜子返回的信息
this.handlePushReturnCommon(pushInfo, returnMap);
}
}
/**
* 对接瓜子-合同信息推送
*
* @param pushInfo 瓜子系统交互任务跟进表
*/
private void pushContractTask(TGzPushEntry pushInfo) {
// 根据流程ID获取档案信息
TGzEmpInfo findEmpInfo = this.getEmpInfoCommon(pushInfo.getBizId());
if (Common.isNotNull(findEmpInfo)) {
// 调瓜子接口
TGzEmpInfoPushGzContractVo gzPushContractInfo = tGzEmpInfoService.getGzEmpInfoToPushGzByIdContract(findEmpInfo.getId());
Map<String,String> returnMap = gzConfig.pushGzEmpContract(restTemplate, gzPushContractInfo);
// 公共处理瓜子返回的信息
this.handlePushReturnCommon(pushInfo, returnMap);
}
}
/**
* 根据流程ID获取瓜子档案信息
*
* @param bizId 瓜子流程ID
*/
private TGzEmpInfo getEmpInfoCommon(String bizId) {
return tGzEmpInfoMapper.selectOne(Wrappers.<TGzEmpInfo>query().lambda()
.eq(TGzEmpInfo::getBizId, bizId)
.eq(TGzEmpInfo::getDelFlag, CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
}
/**
* 对接瓜子-合同附件推送
*
* @param pushInfo 瓜子系统交互任务跟进表
*/
private void pushContractAttaTask(TGzPushEntry pushInfo) {
// 根据流程ID获取档案信息
TGzEmpInfo findEmpInfo = this.getEmpInfoCommon(pushInfo.getBizId());
if (Common.isEmpty(findEmpInfo)) {
return;
}
// 调瓜子接口
// 1、获取合同归档附件
TAttaInfo contractAttaInfo = tAttaInfoService.getOne(Wrappers.<TAttaInfo>query().lambda()
.eq(TAttaInfo::getDomainId, findEmpInfo.getId())
.eq(TAttaInfo::getRelationType, "CONTRACT")
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(contractAttaInfo)) {
return;
}
// 先上传附件,再推送atta与类型
if (Common.isNotNull(contractAttaInfo.getAttaSrc())) {
TGzEmpInfoPushGzFileVo pushGzFileVo;
TGzEmpInfoPushGzAttaVo attaVo;
String bizId = pushInfo.getBizId();
String fileId;
URL url;
InputStream inStream = null;
String base64String;
// 获取合同附件
url = ossUtil.getObjectUrl(null, contractAttaInfo.getAttaSrc());
try {
inStream = url.openStream();
base64String = Base64.getEncoder().encodeToString(IOUtils.toByteArray(inStream));
pushGzFileVo = new TGzEmpInfoPushGzFileVo();
pushGzFileVo.setBizId(bizId);
pushGzFileVo.setFileName(contractAttaInfo.getAttaName());
// 文件数据 Base64
pushGzFileVo.setFileData(base64String);
// 2、先推合同附件文件给瓜子,得到瓜子存储附件的ID
fileId = gzConfig.pushGzFile(restTemplate, pushGzFileVo);
// 3、带着瓜子存储附件的ID 存合同附件
attaVo = new TGzEmpInfoPushGzAttaVo();
attaVo.setBizId(bizId);
attaVo.setFileId(fileId);
attaVo.setAttachType(contractAttaInfo.getRelationType());
attaVo.setFileName(contractAttaInfo.getAttaName());
Map<String,String> returnMap = gzConfig.pushGzAttach(restTemplate, attaVo);
// 公共处理瓜子返回的信息
this.handlePushReturnCommon(pushInfo, returnMap);
} catch (Exception e) {
log.error("瓜子附件推送失败!");
pushInfo.setPushStatus(CommonConstants.ONE_STRING);
pushInfo.setFailReason("瓜子合同附件推送异常!");
} finally {
if (null != inStream) {
try {
inStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
/**
* 对接瓜子-公共处理瓜子返回的信息
*
* @param pushInfo 瓜子系统交互任务信息
* @param returnMap 瓜子响应信息
*/
private void handlePushReturnCommon(TGzPushEntry pushInfo, Map<String,String> returnMap){
// 存推送报文
pushInfo.setPushData(returnMap.get("pushData"));
// 存响应结果
pushInfo.setResponseData(returnMap.get("responseData"));
// 默认推送成功
pushInfo.setPushStatus(CommonConstants.ZERO_STRING);
if(!CommonConstants.GZ_SUCCESS_CODE.equals(returnMap.get("responseCode"))){
pushInfo.setPushStatus(CommonConstants.ONE_STRING);
pushInfo.setFailReason(returnMap.get("responseMessage"));
}
pushInfo.setPushTime(LocalDateTime.now());
}
}
......@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzPushEntry;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzPushHandleService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectNewOldVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
......@@ -39,6 +41,9 @@ public class DoJointTask {
@Autowired
private TEmployeeLogService tEmployeeLogService;
@Autowired
private TGzPushHandleService tGzPushHandleService;
/**
* @Description: 合同-批量更换负责人
* @Author: huyc
......@@ -144,4 +149,20 @@ public class DoJointTask {
}
log.info("档案-更新项目档案操作记录结束");
}
/**
* 处理推送给瓜子的交互任务
* @author chenyuxi
* @date 2025-07-11
* @since 1.7.13
**/
@Async
public void handleGzPushEntry(TGzPushEntry tGzPushEntry) {
try {
tGzPushHandleService.handlePushEntry(tGzPushEntry);
} catch (Exception e) {
log.error("处理推送给瓜子的交互任务错误", e);
}
log.info("处理推送给瓜子的交互任务结束");
}
}
......@@ -677,4 +677,7 @@ public interface CommonConstants {
String NINETY_NINE = "99";
String GZ_NEE_PROVIDER_ID = "V59";
// 瓜子推送成功标识
String GZ_SUCCESS_CODE = "S00000";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment