确认名单反馈
This commit is contained in:
parent
660a2718a1
commit
47dbfeb8db
|
|
@ -85,6 +85,7 @@ public class DeductionAmountDTO {
|
|||
*/
|
||||
@TableTitle(title = "报送状态", dataIndex = "declareStatus", key = "declareStatus")
|
||||
private Integer declareStatus;
|
||||
private String declareErrorMsg;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class DeductionAmountFeedBackParam {
|
|||
@DataCheck(require = true, message = "参数错误,个税扣缴义务人id不能为空")
|
||||
private Long taxAgentId;
|
||||
|
||||
@DataCheck(require = true, message = "参数错误,requestId不能为空")
|
||||
private String requestId;
|
||||
|
||||
// 税款所属年度
|
||||
@DataCheck(require = true, message = "参数错误,税款所属年度参数格式错误")
|
||||
private String year;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,12 +79,6 @@ public class DeductionAmountPO {
|
|||
@ElogTransform(name = "证件类型")
|
||||
private Integer cardType;
|
||||
|
||||
/**
|
||||
* 报送状态
|
||||
*/
|
||||
@ElogTransform(name = "报送状态")
|
||||
private Integer declareStatus;
|
||||
|
||||
/**
|
||||
* 是否扣除
|
||||
*/
|
||||
|
|
@ -96,6 +90,18 @@ public class DeductionAmountPO {
|
|||
@ElogTransform(name = "是否成功报送过")
|
||||
private Integer successfullyDeclared;
|
||||
|
||||
/**
|
||||
* 报送状态
|
||||
*/
|
||||
@ElogTransform(name = "报送状态")
|
||||
private Integer declareStatus;
|
||||
|
||||
/**
|
||||
* 申报失败的错误信息
|
||||
*/
|
||||
@ElogTransform(name = "失败的错误信息")
|
||||
private String declareErrorMsg;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package com.engine.salary.entity.deductionamount.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 扣减报送记录
|
||||
* <p>Copyright: Copyright (c) 2023</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
//"hrsa_employee_declare_record")
|
||||
public class DeductionAmountRecordPO {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 个税扣缴义务人
|
||||
*/
|
||||
private Long taxAgentId;
|
||||
/**
|
||||
* 税款所属年
|
||||
*/
|
||||
private String year;
|
||||
/**
|
||||
* 请求的requestId
|
||||
*/
|
||||
private String requestId;
|
||||
/**
|
||||
* 租户key
|
||||
*/
|
||||
private String tenantKey;
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long creator;
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Integer deleteType;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
private Collection<Long> ids;
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
<result column="id" property="id"/>
|
||||
<result column="job_num" property="jobNum"/>
|
||||
<result column="successfully_declared" property="successfullyDeclared"/>
|
||||
<result column="declare_error_msg" property="declareErrorMsg"/>
|
||||
<result column="tax_agent_id" property="taxAgentId"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
|
|
@ -39,6 +40,7 @@
|
|||
, t.id
|
||||
, t.job_num
|
||||
, t.successfully_declared
|
||||
, t.declare_error_msg
|
||||
, t.tax_agent_id
|
||||
, t.tenant_key
|
||||
, t.update_time
|
||||
|
|
@ -108,6 +110,9 @@
|
|||
<if test="successfullyDeclared != null">
|
||||
AND successfully_declared = #{successfullyDeclared}
|
||||
</if>
|
||||
<if test="declareErrorMsg != null">
|
||||
AND declare_error_msg = #{declareErrorMsg}
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
AND tax_agent_id = #{taxAgentId}
|
||||
</if>
|
||||
|
|
@ -177,6 +182,9 @@
|
|||
<if test="successfullyDeclared != null">
|
||||
successfully_declared,
|
||||
</if>
|
||||
<if test="declareErrorMsg != null">
|
||||
declare_error_msg,
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id,
|
||||
</if>
|
||||
|
|
@ -233,6 +241,9 @@
|
|||
<if test="successfullyDeclared != null">
|
||||
#{successfullyDeclared},
|
||||
</if>
|
||||
<if test="declareErrorMsg != null">
|
||||
#{declareErrorMsg},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
#{taxAgentId},
|
||||
</if>
|
||||
|
|
@ -268,6 +279,7 @@
|
|||
employee_type=#{employeeType},
|
||||
job_num=#{jobNum},
|
||||
successfully_declared=#{successfullyDeclared},
|
||||
declare_error_msg=#{declareErrorMsg},
|
||||
tax_agent_id=#{taxAgentId},
|
||||
tenant_key=#{tenantKey},
|
||||
update_time=#{updateTime},
|
||||
|
|
@ -318,6 +330,9 @@
|
|||
<if test="successfullyDeclared != null">
|
||||
successfully_declared=#{successfullyDeclared},
|
||||
</if>
|
||||
<if test="declareErrorMsg != null">
|
||||
declare_error_msg=#{declareErrorMsg},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id=#{taxAgentId},
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.engine.salary.mapper.deductionamount;
|
||||
|
||||
import com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface DeductionAmountRecordMapper {
|
||||
|
||||
/**
|
||||
* 查询所有记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<DeductionAmountRecordPO> listAll();
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<DeductionAmountRecordPO> listSome(DeductionAmountRecordPO deductionAmountRecord);
|
||||
|
||||
|
||||
/**
|
||||
* 根据主键查询
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 返回记录,没有返回null
|
||||
*/
|
||||
DeductionAmountRecordPO getById(Long id);
|
||||
|
||||
|
||||
DeductionAmountRecordPO getByTaxAgentIdAndYear(@Param("taxAgentId")Long taxAgentId,@Param("year") String year);
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
*
|
||||
* @param deductionAmountRecord 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insertIgnoreNull(DeductionAmountRecordPO deductionAmountRecord);
|
||||
|
||||
/**
|
||||
* 修改,修改所有字段
|
||||
*
|
||||
* @param deductionAmountRecord 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int update(DeductionAmountRecordPO deductionAmountRecord);
|
||||
|
||||
/**
|
||||
* 修改,忽略null字段
|
||||
*
|
||||
* @param deductionAmountRecord 修改的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int updateIgnoreNull(DeductionAmountRecordPO deductionAmountRecord);
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param deductionAmountRecord 待删除的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int delete(DeductionAmountRecordPO deductionAmountRecord);
|
||||
|
||||
/**
|
||||
* 批量删除记录
|
||||
* @param ids 主键id集合
|
||||
*/
|
||||
void deleteByIds(@Param("ids") Collection<Long> ids);
|
||||
|
||||
void deleteByTaxAgentIdAndYear(@Param("taxAgentId")Long taxAgentId,@Param("year") String year);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
<?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.engine.salary.mapper.deductionamount.DeductionAmountRecordMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO">
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="delete_type" property="deleteType"/>
|
||||
<result column="id" property="id"/>
|
||||
<result column="request_id" property="requestId"/>
|
||||
<result column="tax_agent_id" property="taxAgentId"/>
|
||||
<result column="tenant_key" property="tenantKey"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="year" property="year"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t
|
||||
.
|
||||
create_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.id
|
||||
, t.request_id
|
||||
, t.tax_agent_id
|
||||
, t.tenant_key
|
||||
, t.update_time
|
||||
, t.year
|
||||
</sql>
|
||||
|
||||
<!-- 查询全部 -->
|
||||
<select id="listAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_deduction_amount_record t
|
||||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_deduction_amount_record t
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="getByTaxAgentIdAndYear" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_deduction_amount_record t
|
||||
WHERE delete_type = 0
|
||||
AND tax_agent_id=#{taxAgentId}
|
||||
AND year=#{year}
|
||||
</select>
|
||||
|
||||
<!-- 条件查询 -->
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_deduction_amount_record t
|
||||
WHERE delete_type = 0
|
||||
<if test="createTime != null">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
AND request_id = #{requestId}
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
AND tax_agent_id = #{taxAgentId}
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="year != null">
|
||||
AND year = #{year}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO">
|
||||
INSERT INTO hrsa_deduction_amount_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type,
|
||||
</if>
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
request_id,
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id,
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="year != null">
|
||||
year,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
#{deleteType},
|
||||
</if>
|
||||
<if test="id != null">
|
||||
#{id},
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
#{requestId},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
#{taxAgentId},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
#{tenantKey},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="year != null">
|
||||
#{year},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO">
|
||||
UPDATE hrsa_deduction_amount_record
|
||||
<set>
|
||||
create_time=#{createTime},
|
||||
creator=#{creator},
|
||||
delete_type=#{deleteType},
|
||||
request_id=#{requestId},
|
||||
tax_agent_id=#{taxAgentId},
|
||||
tenant_key=#{tenantKey},
|
||||
update_time=#{updateTime},
|
||||
year=#{year},
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 更新不为NULL的字段 -->
|
||||
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO">
|
||||
UPDATE hrsa_deduction_amount_record
|
||||
<set>
|
||||
<if test="createTime != null">
|
||||
create_time=#{createTime},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator=#{creator},
|
||||
</if>
|
||||
<if test="deleteType != null">
|
||||
delete_type=#{deleteType},
|
||||
</if>
|
||||
<if test="requestId != null">
|
||||
request_id=#{requestId},
|
||||
</if>
|
||||
<if test="taxAgentId != null">
|
||||
tax_agent_id=#{taxAgentId},
|
||||
</if>
|
||||
<if test="tenantKey != null">
|
||||
tenant_key=#{tenantKey},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time=#{updateTime},
|
||||
</if>
|
||||
<if test="year != null">
|
||||
year=#{year},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 根据主键删除记录 -->
|
||||
<delete id="delete">
|
||||
UPDATE hrsa_deduction_amount_record
|
||||
SET delete_type=1
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
UPDATE hrsa_deduction_amount_record
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByTaxAgentIdAndYear">
|
||||
UPDATE hrsa_deduction_amount_record
|
||||
SET delete_type = 1
|
||||
WHERE delete_type = 0
|
||||
AND tax_agent_id=#{taxAgentId}
|
||||
AND year=#{year}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -3,11 +3,14 @@ package com.engine.salary.remote.tax.client;
|
|||
import com.engine.salary.enums.taxagent.TaxAgentTaxReturnPasswordTypeEnum;
|
||||
import com.engine.salary.remote.tax.request.deductionAmount.ConfirmPreDeductRequest;
|
||||
import com.engine.salary.remote.tax.request.deductionAmount.QueryDeductionAmountRequest;
|
||||
import com.engine.salary.remote.tax.response.deductionAmount.ConfirmFeedbackResponse;
|
||||
import com.engine.salary.util.HttpUtil;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SingnatureData;
|
||||
import com.engine.salary.util.TaskUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -57,7 +60,7 @@ public class DeductionAmountClient extends TaxBaseClient {
|
|||
}
|
||||
|
||||
|
||||
public String confirm(String year, List<ConfirmPreDeductRequest.kczg> kczglb ) {
|
||||
public String confirm(String year, List<ConfirmPreDeductRequest.kczg> kczglb) {
|
||||
|
||||
String url = super.apiConfig.getHost() + "gateway/iit/deductionAmount/confirmPreDeduct";
|
||||
ConfirmPreDeductRequest request = new ConfirmPreDeductRequest();
|
||||
|
|
@ -77,26 +80,22 @@ public class DeductionAmountClient extends TaxBaseClient {
|
|||
request.setSkssnd(year);
|
||||
request.setKczglb(kczglb);
|
||||
|
||||
String reqJson = JsonUtil.toJsonString(request);
|
||||
log.info("confirmPreDeduct params --- \n{}\n", reqJson);
|
||||
Map<String, String> params = new HashMap<>(1);
|
||||
Map<String, String> header = SingnatureData.initHeader(params, apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
|
||||
// 开始请求
|
||||
String res = HttpUtil.doPost(url, header, reqJson, HttpUtil.JSON_TYPE);
|
||||
log.info("confirmPreDeduct res --- {}", res);
|
||||
return res;
|
||||
String requestId = request(url, JsonUtil.parseMap(request, Object.class));
|
||||
return requestId;
|
||||
}
|
||||
|
||||
public String feedback(String requestId) {
|
||||
public ConfirmFeedbackResponse feedback(String requestId) {
|
||||
TaskUtil taskUtil = new TaskUtil();
|
||||
|
||||
String url = super.apiConfig.getHost() + "gateway/iit/deductionAmount/getPreDeductConfirmFeedback";
|
||||
|
||||
Map<String, String> params = new HashMap<>(1);
|
||||
params.put("requestId", requestId);
|
||||
log.info("getPreDeductConfirmFeedback requestId --- \n{}\n", requestId);
|
||||
Map<String, String> header = SingnatureData.initHeader(Collections.emptyMap(), apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
String res = HttpUtil.getRequest(url, header, params);
|
||||
log.info("getPreDeductConfirmFeedback res --- {}", res);
|
||||
return res;
|
||||
Map<String, String> param = new HashMap<>(1);
|
||||
param.put("requestId", requestId);
|
||||
|
||||
Map<String, String> header = SingnatureData.initHeader(new HashMap<>(1), apiConfig.getAppKey(), apiConfig.getAppSecret());
|
||||
String res = HttpUtil.getRequest(url, header, param);
|
||||
taskUtil.writeApiTaskRecord(Util.null2String(taxAgentId), url, JsonUtil.toJsonString(param), res);
|
||||
ConfirmFeedbackResponse response = JsonUtil.parseBean(res, ConfirmFeedbackResponse.class);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
package com.engine.salary.remote.tax.response.deductionAmount;
|
||||
|
||||
import com.engine.salary.entity.taxpayment.response.BaseResponse;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 扣除名单确认反馈
|
||||
* <p>Copyright: Copyright (c) 2023</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ConfirmFeedbackResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
private Body body;
|
||||
|
||||
/**
|
||||
* 神州云合接口返回状态实体类
|
||||
**/
|
||||
@Data
|
||||
public static class Body {
|
||||
|
||||
/**
|
||||
* 总人数
|
||||
*/
|
||||
private String zrs;
|
||||
/**
|
||||
* 成功人数
|
||||
*/
|
||||
private String cgrs;
|
||||
/**
|
||||
* 失败人数
|
||||
*/
|
||||
private String sbrs;
|
||||
/**
|
||||
* 扣除确认失败列表
|
||||
*/
|
||||
private List<kcqrsb> kcqrsblb;
|
||||
|
||||
@Data
|
||||
public static class kcqrsb {
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String xm;
|
||||
/**
|
||||
* 证件类型 见证件类型字典
|
||||
*/
|
||||
private String zzlx;
|
||||
/**
|
||||
* 证件号码 证件号码
|
||||
*/
|
||||
private String zzhm;
|
||||
/**
|
||||
* 国籍
|
||||
*/
|
||||
private String gj;
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
private String sbyy;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ public interface DeductionAmountService {
|
|||
|
||||
Object query(DeductionAmountOnlineQueryParam param);
|
||||
|
||||
Object confirm(DeductionAmountConfirmParam param);
|
||||
String confirm(DeductionAmountConfirmParam param);
|
||||
|
||||
void feedback(DeductionAmountFeedBackParam param);
|
||||
String feedback(DeductionAmountFeedBackParam param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,32 +2,38 @@ package com.engine.salary.service.impl;
|
|||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.PageInfo;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.constant.SzyhApiConstant;
|
||||
import com.engine.salary.entity.deductionamount.dto.DeductionAmountDTO;
|
||||
import com.engine.salary.entity.deductionamount.param.*;
|
||||
import com.engine.salary.entity.deductionamount.po.DeductionAmountPO;
|
||||
import com.engine.salary.entity.deductionamount.po.DeductionAmountRecordPO;
|
||||
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
||||
import com.engine.salary.enums.SalaryOnOffEnum;
|
||||
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
|
||||
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.deductionamount.DeductionAmountMapper;
|
||||
import com.engine.salary.mapper.deductionamount.DeductionAmountRecordMapper;
|
||||
import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper;
|
||||
import com.engine.salary.remote.tax.client.DeductionAmountClient;
|
||||
import com.engine.salary.remote.tax.request.deductionAmount.ConfirmPreDeductRequest;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.remote.tax.response.deductionAmount.ConfirmFeedbackResponse;
|
||||
import com.engine.salary.service.DeductionAmountService;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.ValidUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -41,6 +47,10 @@ import java.util.stream.Collectors;
|
|||
@Slf4j
|
||||
public class DeductionAmountServiceImpl extends Service implements DeductionAmountService {
|
||||
|
||||
private DeductionAmountRecordMapper getDeductionAmountRecordMapper() {
|
||||
return MapperProxyFactory.getProxy(DeductionAmountRecordMapper.class);
|
||||
}
|
||||
|
||||
private DeductionAmountMapper getDeductionAmountMapper() {
|
||||
return MapperProxyFactory.getProxy(DeductionAmountMapper.class);
|
||||
}
|
||||
|
|
@ -49,34 +59,6 @@ public class DeductionAmountServiceImpl extends Service implements DeductionAmou
|
|||
return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class);
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxDeclarationApiConfigService getTaxDeclarationApiConfigService(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationApiConfigServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxAgentTaxReturnService getTaxAgentTaxReturnService(User user) {
|
||||
return ServiceUtil.getService(TaxAgentTaxReturnServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private EmployeeDeclareRecordService getEmployeeDeclareRecordService(User user) {
|
||||
return ServiceUtil.getService(EmployeeDeclareRecordServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxDeclarationApiBillingService getTaxDeclarationApiBillingService(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationApiBillingServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<DeductionAmountDTO> list(DeductionAmountListParam param) {
|
||||
|
|
@ -84,26 +66,27 @@ public class DeductionAmountServiceImpl extends Service implements DeductionAmou
|
|||
|
||||
List<DeductionAmountPO> deductionAmountPOS = getDeductionAmountMapper().listSome(DeductionAmountPO.builder().year(param.getYear()).taxAgentId(param.getTaxAgentId()).build());
|
||||
|
||||
List<DeductionAmountDTO> list = deductionAmountPOS.stream().map(deductionAmountPO -> {
|
||||
return DeductionAmountDTO.builder()
|
||||
.id(deductionAmountPO.getId())
|
||||
.taxAgentId(deductionAmountPO.getEmployeeId())
|
||||
.year(deductionAmountPO.getYear())
|
||||
.employeeId(deductionAmountPO.getEmployeeId())
|
||||
.employeeName(deductionAmountPO.getEmployeeName())
|
||||
.employeeType(deductionAmountPO.getEmployeeType())
|
||||
.jobNum(deductionAmountPO.getJobNum())
|
||||
.nationality(deductionAmountPO.getNationality())
|
||||
.cardNum(deductionAmountPO.getCardNum())
|
||||
.cardType(deductionAmountPO.getCardType())
|
||||
.declareStatus(deductionAmountPO.getDeclareStatus())
|
||||
.deductFlag(deductionAmountPO.getDeductFlag())
|
||||
.successfullyDeclared(deductionAmountPO.getSuccessfullyDeclared())
|
||||
.creator(deductionAmountPO.getCreator())
|
||||
.createTime(deductionAmountPO.getCreateTime())
|
||||
.updateTime(deductionAmountPO.getUpdateTime())
|
||||
.build();
|
||||
}).collect(Collectors.toList());
|
||||
List<DeductionAmountDTO> list = deductionAmountPOS.stream()
|
||||
.map(deductionAmountPO -> DeductionAmountDTO.builder()
|
||||
.id(deductionAmountPO.getId())
|
||||
.taxAgentId(deductionAmountPO.getEmployeeId())
|
||||
.year(deductionAmountPO.getYear())
|
||||
.employeeId(deductionAmountPO.getEmployeeId())
|
||||
.employeeName(deductionAmountPO.getEmployeeName())
|
||||
.employeeType(deductionAmountPO.getEmployeeType())
|
||||
.jobNum(deductionAmountPO.getJobNum())
|
||||
.nationality(deductionAmountPO.getNationality())
|
||||
.cardNum(deductionAmountPO.getCardNum())
|
||||
.cardType(deductionAmountPO.getCardType())
|
||||
.declareStatus(deductionAmountPO.getDeclareStatus())
|
||||
.declareErrorMsg(deductionAmountPO.getDeclareErrorMsg())
|
||||
.deductFlag(deductionAmountPO.getDeductFlag())
|
||||
.successfullyDeclared(deductionAmountPO.getSuccessfullyDeclared())
|
||||
.creator(deductionAmountPO.getCreator())
|
||||
.createTime(deductionAmountPO.getCreateTime())
|
||||
.updateTime(deductionAmountPO.getUpdateTime())
|
||||
.build())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), list, DeductionAmountDTO.class);
|
||||
}
|
||||
|
|
@ -134,9 +117,9 @@ public class DeductionAmountServiceImpl extends Service implements DeductionAmou
|
|||
.cardNum(employeeDeclarePO.getCardNum())
|
||||
.cardType(employeeDeclarePO.getCardType())
|
||||
.nationality(employeeDeclarePO.getNationality())
|
||||
.declareStatus(0)
|
||||
.deductFlag(1)
|
||||
.successfullyDeclared(0)
|
||||
.declareStatus(DeclareStatusEnum.NOT_DECLARE.getValue())
|
||||
.deductFlag(SalaryOnOffEnum.OFF.getValue())
|
||||
.successfullyDeclared(SalaryOnOffEnum.OFF.getValue())
|
||||
.creator((long) user.getUID())
|
||||
.createTime(now)
|
||||
.updateTime(now)
|
||||
|
|
@ -164,7 +147,7 @@ public class DeductionAmountServiceImpl extends Service implements DeductionAmou
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object confirm(DeductionAmountConfirmParam param) {
|
||||
public String confirm(DeductionAmountConfirmParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
Long taxAgentId = param.getTaxAgentId();
|
||||
String year = param.getYear();
|
||||
|
|
@ -181,13 +164,78 @@ public class DeductionAmountServiceImpl extends Service implements DeductionAmou
|
|||
}).collect(Collectors.toList());
|
||||
|
||||
DeductionAmountClient deductionAmountClient = new DeductionAmountClient(taxAgentId);
|
||||
return deductionAmountClient.confirm(year, kczglb);
|
||||
String requestId = deductionAmountClient.confirm(year, kczglb);
|
||||
|
||||
//更新状态
|
||||
deductionAmountPOS.forEach(deductionAmountPO -> {
|
||||
deductionAmountPO.setDeclareStatus(DeclareStatusEnum.DECLARING.getValue());
|
||||
getDeductionAmountMapper().updateIgnoreNull(deductionAmountPO);
|
||||
});
|
||||
|
||||
//插入记录
|
||||
getDeductionAmountRecordMapper().deleteByTaxAgentIdAndYear(taxAgentId, year);
|
||||
DeductionAmountRecordPO recordPO = DeductionAmountRecordPO.builder()
|
||||
.id(IdGenerator.generate())
|
||||
.taxAgentId(taxAgentId)
|
||||
.year(year)
|
||||
.requestId(requestId)
|
||||
.creator((long) user.getUID())
|
||||
.createTime(new Date())
|
||||
.updateTime(new Date())
|
||||
.deleteType(NumberUtils.INTEGER_ZERO)
|
||||
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
||||
.build();
|
||||
getDeductionAmountRecordMapper().insertIgnoreNull(recordPO);
|
||||
|
||||
return requestId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedback(DeductionAmountFeedBackParam param) {
|
||||
DeductionAmountClient deductionAmountClient = new DeductionAmountClient(param.getTaxAgentId());
|
||||
String feedback = deductionAmountClient.feedback(param.getRequestId());
|
||||
public String feedback(DeductionAmountFeedBackParam param) {
|
||||
Long taxAgentId = param.getTaxAgentId();
|
||||
String year = param.getYear();
|
||||
DeductionAmountRecordPO recordPO = getDeductionAmountRecordMapper().getByTaxAgentIdAndYear(taxAgentId, year);
|
||||
|
||||
if (recordPO == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(175337, "请先点击报送扣除名单,再点击反馈"));
|
||||
}
|
||||
|
||||
String requestId = recordPO.getRequestId();
|
||||
DeductionAmountClient deductionAmountClient = new DeductionAmountClient(taxAgentId);
|
||||
ConfirmFeedbackResponse feedback = deductionAmountClient.feedback(requestId);
|
||||
|
||||
if (feedback == null || feedback.getHead() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, "服务异常,请稍后重试"));
|
||||
}
|
||||
// 如果税友返回错误信息
|
||||
String code = feedback.getHead().getCode();
|
||||
if (SzyhApiConstant.HANDLING_CODE.equals(code) || SzyhApiConstant.TASK_HANDLING_CODE.equals(code)) {
|
||||
//进行中的任务,重试
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(175337, "任务还在处理中,请稍后点击反馈"));
|
||||
}
|
||||
|
||||
if (!SzyhApiConstant.SUCCESS_CODE.equals(code)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(95828, feedback.getHead().getMsg()));
|
||||
}
|
||||
|
||||
List<DeductionAmountPO> deductionAmountPOS = getDeductionAmountMapper().listSome(DeductionAmountPO.builder().taxAgentId(taxAgentId).year(year).build());
|
||||
|
||||
List<ConfirmFeedbackResponse.Body.kcqrsb> kcqrsblb = feedback.getBody().getKcqrsblb();
|
||||
Map<String, String> failMap = SalaryEntityUtil.convert2Map(kcqrsblb, ConfirmFeedbackResponse.Body.kcqrsb::getZzhm, ConfirmFeedbackResponse.Body.kcqrsb::getSbyy);
|
||||
|
||||
deductionAmountPOS.forEach(deductionAmountPO -> {
|
||||
String cardNum = deductionAmountPO.getCardNum();
|
||||
if (failMap.containsKey(cardNum)) {
|
||||
deductionAmountPO.setDeclareStatus(DeclareStatusEnum.DECLARE_FAIL.getValue());
|
||||
deductionAmountPO.setDeclareErrorMsg(failMap.get(cardNum));
|
||||
} else {
|
||||
deductionAmountPO.setDeclareStatus(DeclareStatusEnum.DECLARE_SUCCESS.getValue());
|
||||
deductionAmountPO.setSuccessfullyDeclared(SalaryOnOffEnum.ON.getValue());
|
||||
}
|
||||
getDeductionAmountMapper().updateIgnoreNull(deductionAmountPO);
|
||||
});
|
||||
|
||||
return String.format("成功%s条,失败%s条", feedback.getBody().getCgrs(), feedback.getBody().getSbrs());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -706,9 +706,7 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
|
|||
}
|
||||
// 更新员工的报送状态
|
||||
if (CollectionUtils.isNotEmpty(needUpdateEmployeeDeclares)) {
|
||||
//todo
|
||||
needUpdateEmployeeDeclares.forEach(getEmployeeDeclareMapper()::updateIgnoreNull);
|
||||
// updateBatchById(needUpdateEmployeeDeclares);
|
||||
}
|
||||
// 删除原来的人员报送记录
|
||||
getEmployeeDeclareRecordService(user).deleteByTaxCycleAndTaxAgentId(param.getTaxCycle(), param.getTaxAgentId());
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class DeductionAmountController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String confirm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeductionAmountConfirmParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<DeductionAmountConfirmParam, Object>(user).run(getDeductionAmountWrapper(user)::confirm, param);
|
||||
return new ResponseResult<DeductionAmountConfirmParam, String>(user).run(getDeductionAmountWrapper(user)::confirm, param);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -80,7 +80,7 @@ public class DeductionAmountController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String feedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeductionAmountFeedBackParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<DeductionAmountFeedBackParam, Object>(user).run(getDeductionAmountWrapper(user)::feedback, param);
|
||||
return new ResponseResult<DeductionAmountFeedBackParam, String>(user).run(getDeductionAmountWrapper(user)::feedback, param);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,11 +40,11 @@ public class DeductionAmountWrapper extends Service {
|
|||
return getDeductionAmountService(user).query(param);
|
||||
}
|
||||
|
||||
public Object confirm(DeductionAmountConfirmParam param) {
|
||||
public String confirm(DeductionAmountConfirmParam param) {
|
||||
return getDeductionAmountService(user).confirm(param);
|
||||
}
|
||||
|
||||
public void feedback(DeductionAmountFeedBackParam param) {
|
||||
getDeductionAmountService(user).feedback(param);
|
||||
public String feedback(DeductionAmountFeedBackParam param) {
|
||||
return getDeductionAmountService(user).feedback(param);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue