feat: 专项附加扣除模块,去除月份,添加普通用户登录查看本人记录功能
This commit is contained in:
parent
fafc157e63
commit
92a6512dc8
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.biz;
|
||||
|
||||
import com.engine.salary.encrypt.datacollection.SpecialAddDeductionEncrypt;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
|
|
@ -37,10 +38,18 @@ public class SpecialAddDeductionBiz extends BaseBean {
|
|||
}
|
||||
}
|
||||
|
||||
public List<SpecialAddDeductionPO> listByDeclareMonthAndTaxAgentIds(Date declareMonth, List<Long> taxAgentIds) {
|
||||
public List<SpecialAddDeductionListDTO> listByParam(SpecialAddDeductionQueryParam param) {
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
List<SpecialAddDeductionPO> pos = mapper.listByDeclareMonthAndTaxAgentIds(declareMonth, taxAgentIds);
|
||||
List<SpecialAddDeductionListDTO> specialAddDeductionListDTOS = mapper.listByParam(param);
|
||||
return SpecialAddDeductionEncrypt.decrypt(specialAddDeductionListDTOS);
|
||||
}
|
||||
}
|
||||
|
||||
public List<SpecialAddDeductionPO> listByTaxAgentIds(List<Long> taxAgentIds) {
|
||||
try (SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession()) {
|
||||
SpecialAddDeductionMapper mapper = sqlSession.getMapper(SpecialAddDeductionMapper.class);
|
||||
List<SpecialAddDeductionPO> pos = mapper.listByTaxAgentIds(taxAgentIds);
|
||||
return SpecialAddDeductionEncrypt.decrypt(pos);
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +116,7 @@ public class SpecialAddDeductionBiz extends BaseBean {
|
|||
ArrayList::new)
|
||||
);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = listByDeclareMonthAndTaxAgentIds(po.getDeclareMonth(), null);
|
||||
List<SpecialAddDeductionPO> list = listByTaxAgentIds(null);
|
||||
// 待修改的 本地已存在则更新【交集】
|
||||
List<SpecialAddDeductionPO> updateList = list.stream()
|
||||
.map(m -> finalPos.stream()
|
||||
|
|
|
|||
|
|
@ -31,12 +31,6 @@ public class SpecialAddDeductionRecordDTO {
|
|||
@SalaryTableColumn(column = "id", display = false)
|
||||
private Long id;
|
||||
|
||||
//申报月份
|
||||
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
|
||||
@SalaryTableColumn(text = "申报月份", width = "10%", column = "declareMonth", transmethod = "com.engine.salary.transmethod.TransMethod.timeToMoth")
|
||||
@TableTitle(title = "申报月份", dataIndex = "declareMonth", key = "declareMonth")
|
||||
private Date declareMonth;
|
||||
|
||||
//员工id
|
||||
private Long employeeId;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,9 +22,6 @@ public class SpecialAddDeductionImportParam {
|
|||
//上传文件id
|
||||
String imageId;
|
||||
|
||||
//税款所属期
|
||||
String declareMonth;
|
||||
|
||||
//个税扣缴义务人
|
||||
String taxAgentId;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ public class SpecialAddDeductionParam {
|
|||
// 主键id
|
||||
private Long id;
|
||||
|
||||
// 申报月份
|
||||
private String declareMonth;
|
||||
|
||||
// 员工id
|
||||
private Long employeeId;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@ public class SpecialAddDeductionQueryParam extends BaseQueryParam {
|
|||
//主键id
|
||||
private Long id;
|
||||
|
||||
//申报年月
|
||||
private List<String> declareMonth;
|
||||
private List<Date> declareMonthDate;
|
||||
|
||||
//姓名
|
||||
private String username;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,11 +28,6 @@ public class SpecialAddDeductionPO {
|
|||
*/
|
||||
private Long taxAgentId;
|
||||
|
||||
/**
|
||||
* 申报年月
|
||||
*/
|
||||
private Date declareMonth;
|
||||
|
||||
/**
|
||||
* 子女教育
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
package com.engine.salary.mapper.datacollection;
|
||||
import java.util.Date;
|
||||
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionListDTO;
|
||||
import com.engine.salary.entity.datacollection.dto.SpecialAddDeductionRecordDTO;
|
||||
|
|
@ -22,8 +21,7 @@ public interface SpecialAddDeductionMapper {
|
|||
|
||||
List<SpecialAddDeductionRecordDTO> listDtoByParam(@Param("param") SpecialAddDeductionQueryParam param);
|
||||
|
||||
List<SpecialAddDeductionPO> listByDeclareMonthAndTaxAgentIds(@Param("declareMonth") Date declareMonth,
|
||||
@Param("taxAgentIds") List<Long> taxAgentIds);
|
||||
List<SpecialAddDeductionPO> listByTaxAgentIds(@Param("taxAgentIds") List<Long> taxAgentIds);
|
||||
|
||||
List<SpecialAddDeductionListDTO> listByParam(@Param("param") SpecialAddDeductionQueryParam param);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="employee_id" jdbcType="BIGINT" property="employeeId"/>
|
||||
<result column="tax_agent_id" jdbcType="BIGINT" property="taxAgentId"/>
|
||||
<result column="declare_month" jdbcType="TIMESTAMP" property="declareMonth"/>
|
||||
<result column="children_education" jdbcType="VARCHAR" property="childrenEducation"/>
|
||||
<result column="continuing_education" jdbcType="VARCHAR" property="continuingEducation"/>
|
||||
<result column="housing_loan_interest" jdbcType="VARCHAR" property="housingLoanInterest"/>
|
||||
|
|
@ -26,7 +25,6 @@
|
|||
t1.id,
|
||||
t1.employee_id,
|
||||
t1.tax_agent_id,
|
||||
t1.declare_month,
|
||||
t1.children_education,
|
||||
t1.continuing_education,
|
||||
t1.housing_loan_interest,
|
||||
|
|
@ -43,7 +41,6 @@
|
|||
|
||||
<sql id="Special_Column_List">
|
||||
t1.id,
|
||||
t1.declare_month,
|
||||
t1.employee_id,
|
||||
t2.id AS tax_agent_id,
|
||||
t2.name AS tax_agent_name,
|
||||
|
|
@ -81,15 +78,6 @@
|
|||
OR e.workcode like CONCAT('%',#{param.keyword},'%')
|
||||
)
|
||||
</if>
|
||||
<!-- 申报月份 -->
|
||||
<if test="param.declareMonthDate != null">
|
||||
<if test="param.declareMonthDate.size() == 1">
|
||||
AND t1.declare_month = #{param.declareMonthDate[0]}
|
||||
</if>
|
||||
<if test="param.declareMonthDate.size() == 2">
|
||||
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
||||
</if>
|
||||
</if>
|
||||
<!-- 姓名 -->
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like CONCAT('%',#{param.username},'%')
|
||||
|
|
@ -144,15 +132,6 @@
|
|||
)
|
||||
</if>
|
||||
|
||||
<if test="param.declareMonthDate != null">
|
||||
<if test="param.declareMonthDate.size() == 1">
|
||||
AND t1.declare_month = #{param.declareMonthDate[0]}
|
||||
</if>
|
||||
<if test="param.declareMonthDate.size() == 2">
|
||||
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
||||
</if>
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'||#{param.username}||'%'
|
||||
</if>
|
||||
|
|
@ -205,15 +184,6 @@
|
|||
)
|
||||
</if>
|
||||
|
||||
<if test="param.declareMonthDate != null">
|
||||
<if test="param.declareMonthDate.size() == 1">
|
||||
AND t1.declare_month = #{param.declareMonthDate[0]}
|
||||
</if>
|
||||
<if test="param.declareMonthDate.size() == 2">
|
||||
AND (t1.declare_month BETWEEN #{param.declareMonthDate[0]} AND #{param.declareMonthDate[1]})
|
||||
</if>
|
||||
</if>
|
||||
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND e.lastname like '%'+#{param.username}+'%'
|
||||
</if>
|
||||
|
|
@ -268,9 +238,6 @@
|
|||
<if test="taxAgentId != null">
|
||||
tax_agent_id,
|
||||
</if>
|
||||
<if test="declareMonth != null">
|
||||
declare_month,
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
children_education,
|
||||
</if>
|
||||
|
|
@ -313,9 +280,6 @@
|
|||
<if test="taxAgentId != null">
|
||||
#{taxAgentId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="declareMonth != null">
|
||||
#{declareMonth,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
#{childrenEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -363,9 +327,6 @@
|
|||
<if test="taxAgentId != null">
|
||||
tax_agent_id = #{taxAgentId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="declareMonth != null">
|
||||
declare_month = #{declareMonth,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="childrenEducation != null">
|
||||
children_education = #{childrenEducation,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -424,13 +385,6 @@
|
|||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="declare_month = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.declareMonth != null">
|
||||
when id = #{item.id,jdbcType=BIGINT} then #{item.declareMonth,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="children_education = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.childrenEducation != null">
|
||||
|
|
@ -525,13 +479,12 @@
|
|||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into hrsa_special_add_deduction
|
||||
(employee_id, tax_agent_id, declare_month, children_education, continuing_education,
|
||||
(employee_id, tax_agent_id, children_education, continuing_education,
|
||||
housing_loan_interest, housing_rent, supporting_elder, serious_illness_treatment,
|
||||
infant_care, create_time, update_time, creator, delete_type, tenant_key)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.employeeId,jdbcType=BIGINT}, #{item.taxAgentId,jdbcType=BIGINT},
|
||||
#{item.declareMonth,jdbcType=TIMESTAMP},
|
||||
#{item.childrenEducation,jdbcType=VARCHAR}, #{item.continuingEducation,jdbcType=VARCHAR},
|
||||
#{item.housingLoanInterest,jdbcType=VARCHAR}, #{item.housingRent,jdbcType=VARCHAR},
|
||||
#{item.supportingElder,jdbcType=VARCHAR}, #{item.seriousIllnessTreatment,jdbcType=VARCHAR},
|
||||
|
|
@ -560,7 +513,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="listByDeclareMonthAndTaxAgentIds" resultMap="BaseResultMap">
|
||||
<select id="listByTaxAgentIds" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from hrsa_special_add_deduction t1
|
||||
|
|
@ -570,7 +523,6 @@
|
|||
t1.delete_type = 0 AND t2.delete_type = 0
|
||||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
and declare_month=#{declareMonth,jdbcType=TIMESTAMP}
|
||||
<if test="taxAgentIds != null and taxAgentIds.size() != 0">
|
||||
AND t1.tax_agent_id IN
|
||||
<foreach collection="taxAgentIds" open="(" item="taxAgentId" separator="," close=")">
|
||||
|
|
@ -592,7 +544,7 @@
|
|||
AND e.status not in (7)
|
||||
and (e.accounttype is null or e.accounttype = 0)
|
||||
<include refid="paramSql"/>
|
||||
order by t1.declare_month desc
|
||||
order by t1.create_time desc
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIds">
|
||||
|
|
|
|||
|
|
@ -15,11 +15,11 @@ import com.engine.salary.entity.datacollection.param.SpecialAddDeductionParam;
|
|||
import com.engine.salary.entity.datacollection.param.SpecialAddDeductionQueryParam;
|
||||
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeTaxAgentDTO;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
import com.engine.salary.service.AddUpDeductionService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
|
|
@ -29,10 +29,8 @@ import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
|||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.excel.ExcelComment;
|
||||
import com.engine.salary.util.excel.ExcelParseHelper;
|
||||
import com.engine.salary.util.excel.ExcelUtil;
|
||||
|
|
@ -59,8 +57,8 @@ import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TEN
|
|||
|
||||
public class SpecialAddDeductionServiceImpl extends Service implements SpecialAddDeductionService {
|
||||
|
||||
private SpecialAddDeductionMapper getSpecialAddDeductionMapper() {
|
||||
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
||||
private SpecialAddDeductionBiz getSpecialAddDeductionMapper() {
|
||||
return new SpecialAddDeductionBiz();
|
||||
}
|
||||
|
||||
private TaxAgentService getTaxAgentService(User user) {
|
||||
|
|
@ -91,13 +89,6 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
|
||||
@Override
|
||||
public PageInfo<SpecialAddDeductionListDTO> listPage(SpecialAddDeductionQueryParam queryParam) {
|
||||
//申报月份
|
||||
List<String> declareMonth = queryParam.getDeclareMonth();
|
||||
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
||||
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
queryParam.setOrderRule(orderRule);
|
||||
|
|
@ -106,16 +97,10 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
|
||||
if (needAuth) {
|
||||
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
|
||||
return new PageInfo<>(SpecialAddDeductionListDTO.class);
|
||||
}
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
|
||||
putQueryRange(queryParam, employeeId);
|
||||
}
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(queryParam);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
return new PageInfo<>(list, SpecialAddDeductionListDTO.class);
|
||||
}
|
||||
|
||||
|
|
@ -123,29 +108,35 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
public PageInfo<SpecialAddDeductionRecordDTO> recordListPage(SpecialAddDeductionQueryParam queryParam) {
|
||||
long employeeId = user.getUID();
|
||||
|
||||
//申报月份
|
||||
List<String> declareMonth = queryParam.getDeclareMonth();
|
||||
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
||||
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
queryParam.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth(employeeId);
|
||||
if (needAuth) {
|
||||
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
|
||||
return new PageInfo<>(SpecialAddDeductionRecordDTO.class);
|
||||
}
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
|
||||
putQueryRange(queryParam, employeeId);
|
||||
}
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDtoByParam(queryParam);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDTOByParam(queryParam);
|
||||
return new PageInfo<>(list, SpecialAddDeductionRecordDTO.class);
|
||||
}
|
||||
|
||||
private void putQueryRange(SpecialAddDeductionQueryParam queryParam, long employeeId) {
|
||||
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgentIdsAsAdmin)) {
|
||||
// 不是个税扣缴义务人管理员,限定搜索范围为当前登录人
|
||||
List<Long> taxAgentIdsAsEmployee = getTaxAgentService(user)
|
||||
.listAllTaxAgentsAsRange(Collections.singletonList(employeeId))
|
||||
.stream().filter(t -> t.getEmployeeId().equals(employeeId))
|
||||
.map(TaxAgentEmployeeTaxAgentDTO::getTaxAgentIds)
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toList());
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsEmployee);
|
||||
queryParam.setEmployeeId(employeeId);
|
||||
} else {
|
||||
//管理员设置相应的个税扣缴义务人来筛选
|
||||
queryParam.setTaxAgentIds(taxAgentIdsAsAdmin);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> preview(SpecialAddDeductionImportParam importParam) {
|
||||
|
|
@ -188,8 +179,6 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
Validate.notBlank(imageId, "imageId为空");
|
||||
//税款所属期
|
||||
String declareMonthStr = Util.null2String(importParam.getDeclareMonth());
|
||||
//个税扣缴义务人
|
||||
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
|
||||
|
||||
|
|
@ -207,14 +196,9 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
List<DataCollectionEmployee> employees = employBiz.listEmployee();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
//税款所属期
|
||||
Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user)
|
||||
.getAccountedEmployeeData(declareMonthStr);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = getSpecialAddDeductionMapper()
|
||||
.listByDeclareMonthAndTaxAgentIds(declareMonth, null);
|
||||
.listByTaxAgentIds(null);
|
||||
|
||||
// 错误excel内容
|
||||
List<Map> errorData = new ArrayList<>();
|
||||
|
|
@ -231,7 +215,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.declareMonth(declareMonth).build();
|
||||
.build();
|
||||
|
||||
//异常点数量
|
||||
int errorSum = 0;
|
||||
|
|
@ -328,25 +312,6 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
|
||||
|
||||
//fixme 分权判断
|
||||
//
|
||||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
SpecialAddDeductionPO finalPo = po;
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp =
|
||||
salaryAcctEmployees.stream()
|
||||
.filter(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId()))
|
||||
.findFirst();
|
||||
boolean isExist = list.stream()
|
||||
.anyMatch(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId()));
|
||||
if (optionalAcctEmp.isPresent() && isExist) {
|
||||
Map<String, String> errorMessageMap = new HashMap<String, String>();
|
||||
errorMessageMap.put("message", rowIndex + "该年月这条数据已经核算过,不可导入");
|
||||
errorData.add(errorMessageMap);
|
||||
errorSum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (errorSum == 0) {
|
||||
successCount += 1;
|
||||
// 合格数据
|
||||
|
|
@ -373,20 +338,14 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
private void checkImportParam(SpecialAddDeductionImportParam importParam) {
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
//税款所属期
|
||||
String declareMonthStr = Util.null2String(importParam.getDeclareMonth());
|
||||
//个税扣缴义务人
|
||||
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
|
||||
|
||||
if (StringUtils.isBlank(imageId)) {
|
||||
throw new SalaryRunTimeException("文件不存在");
|
||||
}
|
||||
if (StringUtils.isBlank(declareMonthStr)) {
|
||||
throw new SalaryRunTimeException("税款所属期为空");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*
|
||||
|
|
@ -416,15 +375,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
param.setOrderRule(orderRule);
|
||||
|
||||
//申报月份
|
||||
List<String> declareMonth = param.getDeclareMonth();
|
||||
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
||||
param.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
param.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
List<SpecialAddDeductionListDTO> list = getSpecialAddDeductionMapper().listByParam(param);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
// 开启分权并且不是薪酬模块总管理员
|
||||
if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) {
|
||||
List<Long> taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
|
|
@ -492,19 +443,13 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
|
||||
//构建参数
|
||||
param.setEmployeeId(po.getEmployeeId());
|
||||
//申报月份
|
||||
List<String> declareMonth = param.getDeclareMonth();
|
||||
if (CollectionUtils.isNotEmpty(declareMonth)) {
|
||||
param.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
param.setDeclareMonthDate(declareMonth.stream().map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
//获取操作按钮资源
|
||||
List<List<String>> rowList = getExcelRowDetailList(param);
|
||||
|
||||
//获取excel
|
||||
return ExcelUtil.genWorkbook(rowList, "其他免税扣除明细");
|
||||
return ExcelUtil.genWorkbook(rowList, "专项附加扣除明细");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -516,18 +461,17 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
*/
|
||||
private List<List<String>> getExcelRowDetailList(SpecialAddDeductionQueryParam param) {
|
||||
//excel标题
|
||||
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
|
||||
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "子女教育", "继续教育", "住房贷款利息", "住房租金", "赡养老人", "大病医疗", "婴幼儿照护");
|
||||
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
|
||||
//查询详细信息
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDtoByParam(param);
|
||||
List<SpecialAddDeductionRecordDTO> list = getSpecialAddDeductionMapper().listDTOByParam(param);
|
||||
SpecialAddDeductionEncrypt.decrypt(list);
|
||||
final List<List<String>> dataRowList = Optional.ofNullable(list)
|
||||
.map(List::stream)
|
||||
.map(operatorStream -> operatorStream.map(dto -> {
|
||||
List<String> cellList = new ArrayList<>();
|
||||
cellList.add(Util.null2String(dto.getUsername()));
|
||||
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
|
||||
cellList.add(Util.null2String(dto.getTaxAgentName()));
|
||||
cellList.add(Util.null2String(dto.getDepartmentName()));
|
||||
cellList.add(Util.null2String(dto.getMobile()));
|
||||
|
|
@ -556,12 +500,11 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100342, "参数有误:申报月份必传"));
|
||||
}
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
return SpecialAddDeductionBiz.listByDeclareMonthAndTaxAgentIds(SalaryDateUtil.toDateStartOfMonth(declareMonth), null);
|
||||
return SpecialAddDeductionBiz.listByTaxAgentIds(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editData(SpecialAddDeductionParam specialAddDeductionParam) {
|
||||
String declareMonthStr = specialAddDeductionParam.getDeclareMonth();
|
||||
SpecialAddDeductionBiz SpecialAddDeductionBiz = new SpecialAddDeductionBiz();
|
||||
|
||||
Long currentEmployeeId = (long) user.getUID();
|
||||
|
|
@ -573,24 +516,11 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
throw new SalaryRunTimeException("该数据不存在!");
|
||||
}
|
||||
Long taxAgentId = byId.getTaxAgentId();
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId);
|
||||
boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId(), taxAgentId));
|
||||
if (!canEdit) {
|
||||
//没有编辑权限
|
||||
throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!");
|
||||
}
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees =
|
||||
getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp =
|
||||
salaryAcctEmployees.stream()
|
||||
.filter(f -> f.getEmployeeId().equals(specialAddDeductionParam.getEmployeeId()) && f.getTaxAgentId().equals(specialAddDeductionParam.getTaxAgentId()))
|
||||
.findFirst();
|
||||
if (optionalAcctEmp.isPresent()) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可进行编辑!");
|
||||
}
|
||||
}
|
||||
ArrayList<SpecialAddDeductionPO> updateList = new ArrayList<>();
|
||||
SpecialAddDeductionPO build = SpecialAddDeductionPO.builder()
|
||||
.id(specialAddDeductionParam.getId())
|
||||
|
|
@ -613,18 +543,12 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
||||
|
||||
//税款所属期
|
||||
String declareMonthStr = Util.null2String(specialAddDeductionParam.getDeclareMonth());
|
||||
//人员信息
|
||||
List<DataCollectionEmployee> employees = employBiz.listEmployee();
|
||||
// 获取所有个税扣缴义务人
|
||||
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(currentEmployeeId);
|
||||
//税款所属期
|
||||
Date declareMonth = SalaryDateUtil.stringToDate(declareMonthStr + "-01");
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr);
|
||||
// 查询已有数据
|
||||
List<SpecialAddDeductionPO> list = getSpecialAddDeductionMapper().listByDeclareMonthAndTaxAgentIds(declareMonth, null);
|
||||
List<SpecialAddDeductionPO> list = getSpecialAddDeductionMapper().listByTaxAgentIds(null);
|
||||
//合规数据
|
||||
List<SpecialAddDeductionPO> insertData = new ArrayList<>();
|
||||
Date now = new Date();
|
||||
|
|
@ -634,7 +558,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
.createTime(now)
|
||||
.updateTime(now)
|
||||
.creator((long) user.getUID())
|
||||
.declareMonth(declareMonth).build();
|
||||
.build();
|
||||
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
boolean employeeSameId = employees.stream()
|
||||
|
|
@ -656,8 +580,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内");
|
||||
}
|
||||
}
|
||||
|
||||
//商业健康保险
|
||||
//数据填充
|
||||
po.setContinuingEducation(specialAddDeductionParam.getContinuingEducation())
|
||||
.setChildrenEducation(specialAddDeductionParam.getChildrenEducation())
|
||||
.setHousingLoanInterest(specialAddDeductionParam.getHousingLoanInterest())
|
||||
|
|
@ -666,20 +589,6 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
.setSeriousIllnessTreatment(specialAddDeductionParam.getSeriousIllnessTreatment())
|
||||
.setInfantCare(specialAddDeductionParam.getInfantCare());
|
||||
//fixme 分权判断
|
||||
|
||||
// 判断是否有核算过
|
||||
if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) {
|
||||
SpecialAddDeductionPO finalPo = po;
|
||||
Optional<SalaryAcctEmployeePO> optionalAcctEmp =
|
||||
salaryAcctEmployees.stream()
|
||||
.filter(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId()))
|
||||
.findFirst();
|
||||
boolean isExist = list.stream()
|
||||
.anyMatch(f -> f.getEmployeeId().equals(finalPo.getEmployeeId()) && f.getTaxAgentId().equals(finalPo.getTaxAgentId()));
|
||||
if (optionalAcctEmp.isPresent() && isExist) {
|
||||
throw new SalaryRunTimeException("该年月这条数据已经核算过,不可导入");
|
||||
}
|
||||
}
|
||||
insertData.add(po);
|
||||
//入库
|
||||
SpecialAddDeductionBiz.handleImportData(insertData);
|
||||
|
|
@ -756,7 +665,7 @@ public class SpecialAddDeductionServiceImpl extends Service implements SpecialAd
|
|||
taxAgentIds = tai;
|
||||
}
|
||||
// 获取所有想要删除的数据
|
||||
List<SpecialAddDeductionPO> list = specialAddDeductionBiz.listByDeclareMonthAndTaxAgentIds(declareMonthDate, taxAgentIds);
|
||||
List<SpecialAddDeductionPO> list = specialAddDeductionBiz.listByTaxAgentIds(taxAgentIds);
|
||||
// 获取已经核算的数据
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getAddUpDeductionService(user)
|
||||
.getAccountedEmployeeData(declareMonthStr);
|
||||
|
|
|
|||
|
|
@ -202,11 +202,6 @@ public class SpecialAddDeductionController {
|
|||
if (StringUtils.isNotBlank(id)) {
|
||||
param.setId(Long.valueOf(id));
|
||||
}
|
||||
String declareMonth = request.getParameter("declareMonth");
|
||||
if (StringUtils.isNotBlank(declareMonth)) {
|
||||
param.setDeclareMonth(Arrays.stream(declareMonth.split(",")).map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
|
||||
param.setDeclareMonthDate(Arrays.stream(declareMonth.split(",")).map(e -> e + "-01 00:00:00").map(SalaryDateUtil::dateStrToLocalTime).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
String username = request.getParameter("username");
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ public class SpecialAddDeductionWrapper extends Service {
|
|||
ConditionFactory conditionFactory = new ConditionFactory(user);
|
||||
|
||||
//条件组
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<SearchConditionGroup>();
|
||||
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
||||
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
|
||||
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
||||
|
||||
//文本输入框
|
||||
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT, 25034, "username");
|
||||
|
|
|
|||
Loading…
Reference in New Issue