Commit 474bc11c authored by hongguangwu's avatar hongguangwu

错误信息记录表

parent 69c1e0ba
......@@ -63,14 +63,14 @@ public class EkpIncomeUtil {
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return null;
return EkpConstants.SEND_FAILED;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
return e.getMessage();
}
}
public String sendToEkpRisk(EkpIncomeParamRisk param) {
......@@ -100,14 +100,14 @@ public class EkpIncomeUtil {
String body = obj.getBody();
if (StringUtils.isBlank(body)) {
log.error(EkpConstants.SEND_FAILED);
return null;
return EkpConstants.SEND_FAILED;
} else {
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
} catch (Exception e) {
log.info(e.getMessage());
return null;
return e.getMessage();
}
}
......
......@@ -57,14 +57,14 @@ public class EkpSalaryUtil {
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error(EkpConstants.SEND_FAILED);
return null;
return EkpConstants.SEND_FAILED;
}else{
log.info(EkpConstants.SEND_SUCCESS+body);
return body;
}
}catch (Exception e){
log.info(e.getMessage());
return null;
return e.getMessage();
}
}
......
......@@ -48,6 +48,7 @@ import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryStandardSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -527,6 +528,9 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
account = new TSalaryAccount();
account.setId(sendParam.getFd_3b10af838eab5c());
sendBack = ekpSalaryUtil.sendToEKP(sendParam);
if (Common.isEmpty(sendBack) || sendBack.length() != 32) {
sendBack = ekpSalaryUtil.sendToEKP(sendParam);
}
account.setSendTime(sendTime);
account.setSendUser(user.getId());
account.setSendUserName(user.getNickname());
......@@ -536,6 +540,16 @@ public class TSalaryStandardServiceImpl extends ServiceImpl<TSalaryStandardMappe
account.setEkpId(sendBack);
} else {
sendStatus = false;
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.ONE_STRING);
error.setCreateUserName(s.getCreateName());
error.setLinkId(account.getId());
error.setTitle(sendBack);
error.setNums(CommonConstants.ONE_INT);
HttpDaprUtil.invokeMethodPost(socialProperties.getAppUrl(), socialProperties.getAppId()
, "/tsendekperror/inner/saveError", error, Boolean.class, SecurityConstants.FROM_IN);
}
accountList.add(account);
}
......
......@@ -21,6 +21,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -47,7 +48,7 @@ public class TSendEkpError {
private String title;
@ExcelAttribute(name = "类型")
@ExcelProperty("类型(1薪资明细2预估明细3缴费明细4薪资实时收入5定时收入6派单实时收入7预估定时收入8缴费定时收入9商险实时收入)")
@ExcelProperty("类型(1薪资明细2预估明细3缴费明细4实时收入5定时收入)")
private String type;
@ExcelAttribute(name = "创建日")
......@@ -60,6 +61,7 @@ public class TSendEkpError {
@ExcelAttribute(name = "创建时间")
@ExcelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ExcelAttribute(name = "创建人姓名")
......
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* error存储
......@@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface TSendEkpErrorMapper extends BaseMapper<TSendEkpError> {
/**
* @param tSendEkpError
* @Description: 查找对应类型的1条数据来更新
* @Author: hgw
* @Date: 2022/9/7 16:56
* @return: com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError
**/
TSendEkpError getByTitleTypeDay( @Param("tSendEkpError") TSendEkpError tSendEkpError);
}
......@@ -29,16 +29,20 @@ 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.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpIncomeUtil;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParam;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamManage;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EkpIncomeParamRisk;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncome;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TIncomeMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
import com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeSearchVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeVo;
......@@ -66,6 +70,9 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
@Autowired
private TIncomeDetailService tIncomeDetailService;
@Autowired
private TSendEkpErrorService tSendEkpErrorService;
@Autowired
private EkpIncomeUtil ekpIncomeUtil;
......@@ -315,11 +322,24 @@ public class TIncomeServiceImpl extends ServiceImpl<TIncomeMapper, TIncome> impl
income.setSendStatus(CommonConstants.ZERO_STRING);
this.save(income);
String sendBack = this.getSendBack(income);
if (Common.isEmpty(sendBack) || sendBack.length() != 32) {
sendBack = this.getSendBack(income);
}
income.setSendTime(new Date());
if (Common.isNotNull(sendBack) && sendBack.length() == 32) {
income.setSendStatus(CommonConstants.ONE_STRING);
income.setSendMonth(DateUtil.addMonth(0));
income.setEkpId(sendBack);
} else {
TSendEkpError error = new TSendEkpError();
error.setCreateTime(new Date());
error.setCreateDay(DateUtil.getThisDay());
error.setType(CommonConstants.FOUR_STRING);
error.setCreateUserName("收入表推送");
error.setLinkId(income.getId());
error.setTitle(sendBack);
error.setNums(CommonConstants.ONE_INT);
tSendEkpErrorService.saveError(error);
}
return this.updateById(income);
}
......
......@@ -17,6 +17,8 @@
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.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSendEkpErrorService;
......@@ -41,7 +43,17 @@ public class TSendEkpErrorServiceImpl extends ServiceImpl<TSendEkpErrorMapper, T
**/
@Override
public boolean saveError(TSendEkpError tSendEkpError) {
return this.save(tSendEkpError);
// 类型、创建日不可为空
if (Common.isEmpty(tSendEkpError.getType()) || Common.isEmpty(tSendEkpError.getCreateDay())) {
return false;
}
TSendEkpError error = baseMapper.getByTitleTypeDay(tSendEkpError);
if (error == null) {
return this.save(tSendEkpError);
} else {
error.setNums(error.getNums()+ CommonConstants.ONE_INT);
return this.updateById(error);
}
}
}
......@@ -23,7 +23,7 @@
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper">
<resultMap id="tIncomeMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError">
<resultMap id="tSendEkpErrorMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TSendEkpError">
<id property="id" column="ID"/>
<result property="title" column="title"/>
<result property="type" column="TYPE"/>
......@@ -51,6 +51,9 @@
<if test="tSendEkpError.title != null and tSendEkpError.title.trim() != ''">
AND a.TITLE = #{tSendEkpError.title}
</if>
<if test="tSendEkpError.title == null or tSendEkpError.title.trim() == ''">
AND a.TITLE is null
</if>
<if test="tSendEkpError.type != null and tSendEkpError.type.trim() != ''">
AND a.TYPE = #{tSendEkpError.type}
</if>
......@@ -59,4 +62,16 @@
</if>
</if>
</sql>
<!-- 查找对应类型的1条数据来更新 -->
<select id="getByTitleTypeDay" resultMap="tSendEkpErrorMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_provident_fund a
<where>
1=1
<include refid="tSendEkpError_where"/>
</where>
limit 1
</select>
</mapper>
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