Commit efc91385 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.14' into MVP1.7.14

parents decc6d2d 14a8d98d
......@@ -574,4 +574,7 @@ public class TGzEmpInfo extends BaseEntity {
@Schema(description = "持卡人姓名")
private String accountName;
@Schema(description = "档案状态(0:已提交,1:暂存)")
private String empStatus;
}
......@@ -48,6 +48,10 @@ public class TGzEmpInfoExportMain implements Serializable {
@ExcelProperty("员工档案提交时间")
private String createTime;
@ExcelAttribute(name = "档案状态", isDataId = true, readConverterExp = "0=已提交,1=暂存")
@ExcelProperty("档案状态")
private String empStatus;
@ExcelAttribute(name = "档案推送瓜子状态", isDataId = true, readConverterExp = "0=待推送,1=已推送")
@ExcelProperty("档案推送瓜子状态")
private String empPushStatus;
......
......@@ -491,6 +491,10 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
YifuUser user = getNewYifuUser();
TGzEmpInfo tGzEmpInfo = tGzEmpInfoVo;
Integer offerId = tGzEmpInfoVo.getOfferId();
// 1.7.14: 档案状态必传
if (Common.isEmpty(tGzEmpInfoVo.getEmpStatus())) {
return R.failed("档案状态必传!");
}
if (Common.isEmpty(offerId)) {
return R.failed("请传参流程ID!");
} else {
......@@ -504,30 +508,33 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
// 测试 郭彤:这个提示改下吧,没必要吧ID还有状态枚举值列出来 2025-6-30 18:09:05
// return R.failed("瓜子Offer状态不对("+gzOfferInfo.getOfferStatus()+"),不可编辑,Offer的ID="+ offerId)
}
gzOfferInfo.setOfferStatus("12");
gzOfferInfoMapper.updateById(gzOfferInfo);
// 记录状态变更的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);
// 1.7.14: 档案状态是提交,才更新offer状态
if(CommonConstants.ZERO_STRING.equals(tGzEmpInfoVo.getEmpStatus())){
gzOfferInfo.setOfferStatus("12");
gzOfferInfoMapper.updateById(gzOfferInfo);
// 记录状态变更的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);
}
}
}
}
......@@ -536,12 +543,19 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
if (Common.isEmpty(gzEmpId)) {
tGzEmpInfo.setCreateBy(user.getId());
tGzEmpInfo.setCreateName(user.getNickname());
tGzEmpInfo.setCreateTime(LocalDateTime.now());
// 1.7.14: 档案状态是提交,才存 创建时间(提交时间)
if(CommonConstants.ZERO_STRING.equals(tGzEmpInfoVo.getEmpStatus())){
tGzEmpInfo.setCreateTime(LocalDateTime.now());
}
this.save(tGzEmpInfo);
gzEmpId = tGzEmpInfo.getId();
} else {
tGzEmpInfo.setUpdateBy(user.getId());
tGzEmpInfo.setUpdateTime(LocalDateTime.now());
// 1.7.14: 档案状态是暂存,清除 创建时间(提交时间)
if(CommonConstants.ONE_STRING.equals(tGzEmpInfoVo.getEmpStatus())){
tGzEmpInfo.setCreateTime(null);
}
this.updateById(tGzEmpInfo);
}
// 获取瓜子档案附属信息:先删除后增加:
......@@ -843,6 +857,22 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
if (Common.isEmpty(attaEmp.getAttaName())) {
attaEmp.setAttaName(CommonConstants.CENTER_SPLIT_LINE_STRING);
}
// 1.7.14: 附件类型映射
// 41(瓜子申明签名)42(瓜子确认签名)NID_A(证件正面) NID_B(证件反面)
// 附件类型转化:声明签字:21;确认签字:22; 9身份证;24 身份证国徽
if("41".equals(atta.getRelationType())){
atta.setRelationType("21");
}
if("42".equals(atta.getRelationType())){
atta.setRelationType("22");
}
if("NID_A".equals(atta.getRelationType())){
atta.setRelationType("9");
}
if("NID_B".equals(atta.getRelationType())){
atta.setRelationType("24");
}
attaEmp.setDomainId(empId);
attaEmp.setCreateBy(user.getId());
attaEmp.setCreateName(user.getNickname());
......@@ -1020,9 +1050,11 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
// 按gzEmpInfo实体类顺序转化:
emp.setEmpName(gzEmpInfo.getName());
emp.setEmpIdcard(gzEmpInfo.getNationalId());
emp.setIdProvince(gzEmpInfo.getNativePlaceAreaId());
emp.setIdCity(null);
emp.setIdTown(null);
// 1.7.14: 户籍所在地取值调整
emp.setIdProvince(gzEmpInfo.getHukouProvinceAreaId());
emp.setIdCity(gzEmpInfo.getHukouCityAreaId());
emp.setIdTown(gzEmpInfo.getHukouCountyAreaId());
// 民族
emp.setEmpNational(getDictValue(dictMap, gzEmpInfo.getEthnicGrpCd(), ExcelAttributeConstants.GZ_ETHNIC_GRP_CD));
// 婚姻状态
......@@ -1050,10 +1082,10 @@ public class TGzEmpInfoServiceImpl extends ServiceImpl<TGzEmpInfoMapper, TGzEmpI
emp.setContactAddress(gzEmpInfo.getAddress());
// 户口性质
emp.setEmpRegisType(getDictValue(dictMap, gzEmpInfo.getHukouType(), ExcelAttributeConstants.GZ_HUKOU_TYPE));
emp.setFileProvince(gzEmpInfo.getHukouProvinceAreaId());
emp.setFileCity(gzEmpInfo.getHukouCityAreaId());
emp.setFileTown(gzEmpInfo.getHukouCountyAreaId());
// 1.7.14: 档案所在地取值调整: ”默认为“安徽省-合肥市-蜀山区”
emp.setFileProvince(12);
emp.setFileCity(135);
emp.setFileTown(1267);
emp.setBankName(getDictValue(dictMap, gzEmpInfo.getBankCd(), ExcelAttributeConstants.GZ_BANK));
emp.setBankSubName(gzEmpInfo.getBankName());
if (Common.isNotNull(gzEmpInfo.getAccountProvinceAreaId())) {
......
......@@ -102,6 +102,7 @@
<result property="hukouCountyAreaId" column="hukou_county_area_id"/>
<result property="accountProvinceAreaId" column="account_province_area_id"/>
<result property="accountCityAreaId" column="account_city_area_id"/>
<result property="empStatus" column="emp_status"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
......@@ -181,7 +182,8 @@
a.hukou_city_area_id,
a.hukou_county_area_id,
a.account_province_area_id,
a.account_city_area_id
a.account_city_area_id,
a.emp_status
</sql>
<sql id="tGzEmpInfo_where">
<if test="tGzEmpInfo != null">
......@@ -194,6 +196,9 @@
<if test="tGzEmpInfo.offerId != null ">
AND a.offer_id = #{tGzEmpInfo.offerId}
</if>
<if test="tGzEmpInfo.empStatus != null and tGzEmpInfo.empStatus.trim() != ''">
AND a.emp_status = #{tGzEmpInfo.empStatus}
</if>
<if test="tGzEmpInfo.empPushStatus != null and tGzEmpInfo.empPushStatus.trim() != ''">
AND a.emp_push_status = #{tGzEmpInfo.empPushStatus}
</if>
......@@ -411,7 +416,7 @@
a.del_flag = '0'
<include refid="tGzEmpInfo_where"/>
</where>
ORDER by a.create_time desc,a.id desc
ORDER by a.emp_status,a.create_time desc,a.id desc
</select>
<!--count-->
......@@ -431,6 +436,7 @@
a.id,
a.biz_id,
a.offer_id,
a.emp_status,
a.emp_push_status,
a.contract_push_status,
a.contract_atta_push_status,
......@@ -517,7 +523,7 @@
<include refid="tGzEmpInfo_where"/>
</where>
group by a.id
ORDER by a.create_time desc,a.id desc
ORDER by a.emp_status,a.create_time desc,a.id desc
<if test="tGzEmpInfo.limitStart != null">
limit #{tGzEmpInfo.limitStart},#{tGzEmpInfo.limitEnd}
</if>
......
......@@ -99,7 +99,7 @@ public class UpmsDaprUtils {
}
/**
* @Author fxj
* @Description 通过用户ID 获取 在用的MVP系统的用户
* @Description 通过用户ID 获取 在用的MVP系统的用户
* @Date 17:24 2025/3/12
**/
public R<SysUsersVo> getUserVoByUserIds(String userIds) {
......@@ -109,6 +109,21 @@ public class UpmsDaprUtils {
}
return allUserVoR;
}
/**
* @Author hgw
* @Description 通过用户ID 获取 在用的MVP系统的用户
* @Date 2025-8-1 14:51:03
**/
public R<SysUsersVo> getInUseUserByIds(String userIds) {
R<SysUsersVo> allUserVoR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId()
,"/user/inner/getInUseUserByIds", userIds, SysUsersVo.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(allUserVoR)){
return R.failed("获取指定用户IDS对应在用的用户信息失败!");
}
return allUserVoR;
}
public R<SysUser> getSimpleUser(String userId) {
R<SysUser> userR = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(),daprUpmsProperties.getAppId(),"/user/inner/getSimpleUser",userId, SysUser.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(userR)){
......
......@@ -468,6 +468,10 @@ public class InsurancesConstants {
* 商险已结算,无法登记保单保费
*/
public static final String SETTLE_HANDLE_THREE_NOT_REGISTERED = "商险已结算,无法登记保单保费";
/**
* 商险已支出,无法登记保单保费
*/
public static final String PAY_SETTLE_NOT_REGISTERED = "商险已支出,无法登记保单保费";
/**
* 保单号不存在或已过期
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @Description: 查询EKP中的状态,拦截批量保单号保费
* @Author: hgw
* @Date: 2025/8/1 18:02
* @return:
**/
@Data
public class EkpSettleStatusVo implements Serializable {
/**
* 结算状态
**/
private String settleStatus;
/**
* 支出状态
**/
private String payStatus;
}
......@@ -47,7 +47,7 @@ public interface EkpSettleMapper {
* @param id
* @return {@link SettleVo}
*/
String getSettleStatusFromEkpInsuranceDetail(String id);
EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String id);
List<EkpInsuranceViewVo> selectSettleStatusBySettleNo(@Param("settleNo") String settleNo, @Param("payFlag") String payFlag);
......
......@@ -36,7 +36,7 @@ public interface EkpSettleService extends IService<TInsuranceTypeRate> {
* @param id 新增类
* @return {@link R}
*/
String getSettleStatusFromEkpInsuranceDetail(String id);
EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String id);
/**
* 根据结算单编号查询商险视图信息
......
......@@ -45,7 +45,7 @@ public class EkpSettleServiceImpl implements EkpSettleService {
}
@Override
public String getSettleStatusFromEkpInsuranceDetail(String id) {
public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String id) {
return ekpSettleMapper.getSettleStatusFromEkpInsuranceDetail(id);
}
......
......@@ -3863,7 +3863,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
InsuranceRegisterParam param;
SettleVo settleVo;
List<TInsuranceEkp> ekpList;
String status;
// EKP 结算状态、支出状态
EkpSettleStatusVo settleStatus;
for (int i = 0; i < distinctList.size(); i++) {
param = distinctList.get(i);
param.setFlag(CommonConstants.ONE_STRING);
......@@ -4052,15 +4053,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
status = getSettleStatusFromEkpInsuranceDetail(detail.getId(), detail.getDefaultSettleId());
if(null != status){
//保费更新或者保单号发票号更新
if (InsurancesConstants.SETTLE_TWO.equals(status)) {
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
continue;
settleStatus = getSettleStatusFromEkpInsuranceDetail(detail.getId(), detail.getDefaultSettleId());
if(null != settleStatus){
if(Common.isNotNull(settleStatus.getSettleStatus())) {
//保费更新或者保单号发票号更新
if (InsurancesConstants.SETTLE_TWO.equals(settleStatus.getSettleStatus())) {
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(settleStatus.getSettleStatus())) {
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
continue;
}
}
if (InsurancesConstants.SETTLE_ONE.equals(status)) {
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
// 商险已支出,无法登记保单保费
if(Common.isNotNull(settleStatus.getPayStatus()) && InsurancesConstants.SETTLE_TWO.equals(settleStatus.getPayStatus())) {
param.setErrorMessage(InsurancesConstants.PAY_SETTLE_NOT_REGISTERED);
continue;
}
}
......@@ -7630,7 +7638,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param
* @return {@link String}
*/
public String getSettleStatusFromEkpInsuranceDetail(String detailId,String settleId){
public EkpSettleStatusVo getSettleStatusFromEkpInsuranceDetail(String detailId,String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
return ekpSettleService.getSettleStatusFromEkpInsuranceDetail(id);
......
......@@ -61,9 +61,9 @@
group by fd_3b0a5743acab7e
</select>
<select id="getSettleStatusFromEkpInsuranceDetail" resultType="java.lang.String">
<select id="getSettleStatusFromEkpInsuranceDetail" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSettleStatusVo">
select
fd_3adfe6ec6a8cbe
fd_3adfe6ec6a8cbe settleStatus,fd_3adfe6eda67236 payStatus
from
ekp_insurances_info
where
......
......@@ -48,6 +48,7 @@ public interface TSalaryEmployeeMapper extends BaseMapper<TSalaryEmployee> {
List<TSalaryEmployeeExportVo> noPageDiy( @Param("tSalaryEmployee") TSalaryEmployeeSearchVo searchVo, @Param("idList")List<String> idList);
List<TSalaryEmployee> getListByIdCard(@Param("idCardList") List<String> idCardList);
List<TSalaryEmployee> getListByPhone(@Param("phoneList") List<String> phoneList);
TSalaryEmployee getByEmpIdCard(@Param("empIdCard") String empIdCard);
......
......@@ -256,6 +256,19 @@
</if>
</select>
<!-- 按手机号查询全部人员 -->
<select id="getListByPhone" resultMap="tSalaryEmployeeMap" >
<if test="phoneList != null and phoneList.size>0">
SELECT
<include refid="Base_Column_List"/>
FROM t_salary_employee a
where a.EMP_PHONE in
<foreach item="idStr" index="index" collection="phoneList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
</select>
<!-- 按身份证查询人员 -->
<select id="getByEmpIdCard" resultMap="tSalaryEmployeeMap" >
SELECT
......
package com.yifu.cloud.plus.v1.yifu.social.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* @description 派单办理失败发送企微消息
* @date 2025-8-1 11:22:43
*/
@Data
@Schema(description = "派单办理失败发送企微消息")
public class TSocialAlert {
@Schema(description = "客服ID")
private String createBy;
@Schema(description = "客服姓名")
private String createName;
@Schema(description = "社保条数")
private int socialNum;
@Schema(description = "公积金条数")
private int fundNum;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.social.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.CheckedException;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @Author: huyc
* @Date: 2023/7/28
* @Description:
* @return: 企业微信配置——拷贝过来的
**/
@Configuration
@Data
@Slf4j
public class WxConfig {
@Value("${wx.corpid}")
private String corpid;
@Value("${wx.corpsecret}")
private String corpsecret;
@Value("${wx.agentid}")
private String agentid;
@Value("${wx.authUrl}")
private String authUrl;
@Value("${wx.domainName}")
private String domainName;
@Autowired
private RedisTemplate redisTemplate;
//未授权
private String accossTokenInvliad = "40014";
/**
* @param
* @Author: huyc
* @Date: 2023/7/28
* @Description: 获取微信accos_token
* @return: java.lang.String
**/
public String getAccessToken(RestTemplate restTemplate) {
if (Common.isNotNull(agentid)) {
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN.concat(agentid), corpsecret);
}
return this.getToken(restTemplate, CacheConstants.WX_ACCOSS_TOKEN, corpsecret);
}
/**
* @param restTemplate
* @param tokenKey
* @param corpsecretKey
* @Description: 获取token
* @Author: huyc
* @Date: 2023/7/28 14:46
* @return: java.lang.String
**/
public String getToken(RestTemplate restTemplate, String tokenKey, String corpsecretKey) {
Object wxToken = redisTemplate.opsForValue().get(tokenKey);
if (null != wxToken) {
return String.valueOf(wxToken);
}
String requestTokenUrl = String.format(SecurityConstants.WX_GET_ACCOSS_TOKEN, corpid, corpsecretKey);
String result = restTemplate.getForObject(requestTokenUrl, String.class);
if (Common.isEmpty(result)) {
throw new CheckedException("微信授权失败");
}
String token = JSON.parseObject(result).getString("access_token");
if (Common.isEmpty(token)) {
log.info(result);
throw new CheckedException("获取微信token失败");
}
redisTemplate.opsForValue().set(tokenKey, token);
redisTemplate.expire(tokenKey, 3600, TimeUnit.SECONDS);
return token;
}
/**
* @param
* @Author: huyc
* @Date: 2023/7/28 14:43
* @Description: 移除微信accossToken
* @return: java.lang.String
**/
public void removeAccessToken() {
redisTemplate.delete(CacheConstants.WX_ACCOSS_TOKEN);
}
/**
* @param restTemplate
* @param requestMap 请求内容
* @Author: huyc
* @Date: 2023/7/28 14:48
* @Description: 发送卡片消息
* @return: java.lang.String
**/
public boolean sendTextCard(RestTemplate restTemplate, Map<String, Object> requestMap) {
// 必须加上header说明
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Gson gson = new Gson();
log.debug("发企业微信===请求:{}", gson.toJson(requestMap));
HttpEntity<String> requestEntity = new HttpEntity<>(gson.toJson(requestMap), headers);
String accessToken = getAccessToken(restTemplate);
ResponseEntity<String> responseEntity = restTemplate.postForEntity(String.format(SecurityConstants.WX_SEND_MESSAGE, accessToken), requestEntity, String.class);
log.debug("发企业微信===返回:{}", JSON.toJSONString(responseEntity));
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(responseEntity));
JSONObject jsonBody = jsonObject.getJSONObject("body");
if (jsonBody != null) {
String errcode = jsonBody.getString("errcode");
if (accossTokenInvliad.equals(errcode)) {
//删除accossToken缓存
removeAccessToken();
return false;
}
if (!CommonConstants.ZERO_STRING.equals(errcode)) { //非正常,则打印错误日志
log.info(jsonObject.toJSONString());
}
} else {
log.info(jsonObject.toJSONString());
}
return true;
}
}
package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialWarnService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @Author hgw
* @Date2025-8-1 11:19:32
* @Description 派单提醒相关
* @Version 1.0
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/socialWarn")
@Tag(name = "派单提醒相关")
public class TSocialWarnController {
@Resource
private TSocialWarnService socialWarnService;
@Operation(description = "每天10:00推送派单办理失败的消息")
@Inner
@PostMapping("/inner/pushSocialAlertToWx")
public void pushSocialAlertToWx() {
socialWarnService.pushSocialAlertToWx();
}
}
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialAlert;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author hgw
* @description 查询派单失败的数据
* @date 2025-8-1 15:23:34
*/
@Mapper
public interface TSocialWarnMapper extends BaseMapper<TSocialAlert> {
/**
* @Description: 获取派单办理失败的信息
* @Author: hgw
* @Date: 2025/8/1 15:09
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.TSocialAlert>
**/
List<TSocialAlert> getSocialAlertToWx();
}
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialAlert;
/**
* @author hgw
* @description 查询派单办理失败的信息,推送企微
* @date 2025-8-1 15:23:20
*/
public interface TSocialWarnService extends IService<TSocialAlert> {
void pushSocialAlertToWx();
}
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUsersVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
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.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.social.config.WxConfig;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialWarnMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialWarnService;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialAlert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author hgw
* @description 派单办理失败的,推送企微
* @date 2025-8-1 15:23:16
*/
@Service
public class TSocialWarnServiceImpl extends ServiceImpl<TSocialWarnMapper, TSocialAlert> implements TSocialWarnService {
@Autowired
private UpmsDaprUtils upmsDaprUtils;
@Autowired
private WxConfig wxConfig;
/**
* @Description: 10点推送企微消息——派单办理失败
* @Author: hgw
* @Date: 2025/8/1 15:11
* @return: void
**/
@Override
public void pushSocialAlertToWx() {
try {
// TODO - 逻辑待产品梳理清楚,sql待完善
List<TSocialAlert> list = baseMapper.getSocialAlertToWx();
String userIds;
if (Common.isNotKong(list)) {
userIds = list.stream().map(TSocialAlert::getCreateBy).distinct().collect(Collectors.joining(","));
// 获取在用账号信息
Map<String, SysUser> inUseUserMap = this.getInUseUserByIds(userIds);
if (inUseUserMap != null && !inUseUserMap.isEmpty()) {
// 离职人员
StringBuilder liZhiUserName = new StringBuilder();
SysUser user;
Map<String, String> pushMap = new HashMap<>();
StringBuilder content;
for (TSocialAlert vo : list) {
user = inUseUserMap.get(vo.getCreateBy());
if (user == null || Common.isEmpty(user.getWxMessage())) {
if (Common.isNotNull(liZhiUserName)) {
liZhiUserName.append("、");
}
liZhiUserName.append(vo.getCreateName());
} else {
content = new StringBuilder("当前存在");
if (vo.getSocialNum() > 0) {
content.append("社保派单失败数量:").append(vo.getSocialNum());
if (vo.getFundNum() > 0) {
content.append(",公积金派单失败数量:").append(vo.getFundNum());
}
} else if (vo.getFundNum() > 0) {
content.append("公积金派单失败数量:").append(vo.getFundNum());
}
content.append("<br/>请及时至HRO系统进行处理。");
pushMap.put(user.getWxMessage(), content.toString());
}
}
// 离职的人,发给陈红:
if (Common.isNotNull(liZhiUserName)) {
// 陈红的 user.getWxMessage()
pushMap.put("66870fa57d72637233f81f1e0b26311e", "申请人" + liZhiUserName
+ "状态异常,当前存在社保派单失败、公积金派单失败。请及时至HRO系统进行处理。");
}
//开始推送信息到企业微信
if (Common.isNotKong(pushMap)) {
pushMap.forEach((k, v) -> {
sendMessageToWx(k, v);
});
}
}
}
} catch (Exception e) {
log.error("推送社保办理失败信息到企业微信异常", e);
}
}
/**
* @Description 获取在用账号信息
* @Date 2025-8-1 11:50:06
**/
private Map<String, SysUser> getInUseUserByIds(String userIds) {
Map<String, SysUser> userMap = null;
if (Common.isNotKong(userIds)) {
R<SysUsersVo> res = upmsDaprUtils.getInUseUserByIds(userIds);
if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())) {
userMap = res.getData().getUserList();
}
}
return userMap;
}
//发送企业微信待办
private void sendMessageToWx(String useruserWx, String content) {
if (Common.isEmpty(useruserWx) || Common.isEmpty(content)) {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(useruserWx)) {
sendUser = new StringBuilder(useruserWx);
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
textcard.put("title", "派单办理失败提醒");
textcard.put("url", String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "66"));
textcard.put("description", content);
requestMap.put("touser", sendUser);
requestMap.put("agentid", wxConfig.getAgentid());
requestMap.put("msgtype", "textcard");
requestMap.put("textcard", textcard);
// 必须加上header说明
if (!wxConfig.sendTextCard(restTemplate, requestMap)) {
wxConfig.sendTextCard(restTemplate, requestMap);
}
}
}
}
\ No newline at end of file
......@@ -78,4 +78,12 @@ socialFriend:
appSecret : V52dkvxtFUgIvzlfNE9G8g==
#线上
#appKey : 3082B14EE2114C2D93B3A222DD925C26=
#appSecret : VmURqoxqmoKnNLXzAWynqQ==
\ No newline at end of file
#appSecret : VmURqoxqmoKnNLXzAWynqQ==
#企业微信配置
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
......@@ -67,4 +67,12 @@ socialFriend:
urlDownloadEmployeeFeedback: /gateway/pts/hrss/sourceFile/downloadEmployeeFeedback
urlUpload : /gateway/file/upload
appKey : 3082B14EE2114C2D93B3A222DD925C26=
appSecret : VmURqoxqmoKnNLXzAWynqQ==
\ No newline at end of file
appSecret : VmURqoxqmoKnNLXzAWynqQ==
#企业微信配置
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
......@@ -66,4 +66,12 @@ socialFriend:
urlDownloadEmployeeFeedback: /gateway/pts/hrss/sourceFile/downloadEmployeeFeedback
urlUpload : /gateway/file/upload
appKey : 89357285571962202409230949030
appSecret : V52dkvxtFUgIvzlfNE9G8g==
\ No newline at end of file
appSecret : V52dkvxtFUgIvzlfNE9G8g==
#企业微信配置
wx:
corpid: wwbcb090af0dfe50e5
corpsecret: 16kqEL_eU-ARwYyqLgEBWHgxm8gXVnkzv_eJMLy9NpU
agentid: 1000010
authUrl: https://test-wx.worfu.com/yifu-auth/method/oauth/wxLogin
domainName: https://test-wx.worfu.com
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialWarnMapper">
<select id="getSocialAlertToWx" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.TSocialAlert">
select
d.CREATE_BY createBy,d.CREATE_NAME createName
,sum(if(d.SOCIAL_HANDLE_STATUS in ('2','3'),1,0)) socialNum
,sum(if(d.FUND_HANDLE_STATUS = '2',1,0)) fundNum
from t_dispatch_info d
where d.CREATE_TIME >= CONCAT(DATE_SUB(CURDATE(), INTERVAL 1 DAY), ' 00:00:00')
and d.CREATE_TIME <![CDATA[ <= ]]> CONCAT(CURDATE(), ' 00:00:00')
and (d.SOCIAL_HANDLE_STATUS in ('2','3') or d.FUND_HANDLE_STATUS = '2')
GROUP BY d.CREATE_BY
</select>
</mapper>
......@@ -734,4 +734,28 @@ public class UserController {
}
return naVo;
}
/**
* @Author hgw
* @Description 获取所有在用的账号,key是userId
* @Date 2025-8-1 14:48:15
**/
@Inner
@PostMapping(value = {"/inner/getInUseUserByIds"})
public SysUsersVo getInUseUserByIds(@RequestBody String userIds) {
SysUsersVo naVo = new SysUsersVo();
if (Common.isNotNull(userIds)) {
//获取所有在用的账号
List<SysUser> sysUsers = userService.list(Wrappers.<SysUser>query().lambda()
.eq(SysUser::getLockFlag,CommonConstants.ZERO_STRING)
.eq(SysUser::getDelFlag,CommonConstants.ZERO_STRING)
.in(SysUser::getUserId, Common.getList(userIds)));
if (Common.isNotEmpty(sysUsers)) {
Map<String,SysUser> userMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, v->v));
naVo.setUserList(userMap);
}
}
return naVo;
}
}
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