Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
钱涛 2022-04-18 21:36:24 +08:00
commit 10e39169e3
51 changed files with 4385 additions and 153 deletions

15
.gitignore vendored
View File

@ -1,15 +0,0 @@
/weaver-hrm-salary.iml
/out/
/.idea/
HELP.md
target/
### IntelliJ IDEA ###
.idea
/src/test
/src/META-INF
/log

View File

@ -6,6 +6,8 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
import com.engine.salary.entity.salaryarchive.po.TaxAgentPO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
@ -14,9 +16,11 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
import com.engine.salary.entity.siarchives.po.*;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.*;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
@ -1303,7 +1307,170 @@ public class SIAccountBiz {
}
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageUtil.start(queryParam.getCurrent(),queryParam.getPageSize());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = buildRecords(insuranceAccountDetailPOS, paymentMap);
// List<ICategoryPO> iCategoryPOS = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll();
// Page<InsuranceCategoryPO> page = FormatManager.getTablePage();
// Page<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new Page<>(page.getCurrent(), insuranceAccountViewListDTOS.size(), insuranceAccountViewListDTOS.size(),
// page.isSearchCount());
PageInfo<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS,InsuranceAccountViewListDTO.class);
insuranceAccountViewListDTOPage.setTotal(insuranceAccountViewListDTOS.size());
return insuranceAccountViewListDTOPage;
}
public List<InsuranceAccountViewListDTO> buildRecords(List<InsuranceAccountDetailPO> list, Map<Long, TaxAgent> paymentMap) {
Map<Long, InsuranceAccountViewListDTO> result = new HashMap<>();
//根据组织分组,对社保进行统计
Map<Long, List<InsuranceAccountDetailPO>> socialCollect = list.stream().filter(item -> item.getSocialPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getSocialPayOrg));
socialCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountSocialView(insuranceAccountViewListDTO, v);
});
//根据组织分组对公积金进行统计
Map<Long, List<InsuranceAccountDetailPO>> fundCollect = list.stream().filter(item -> item.getFundPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getFundPayOrg));
fundCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountFundView(insuranceAccountViewListDTO, v);
});
//根据组织分组,对其他福利进行统计
Map<Long, List<InsuranceAccountDetailPO>> otherCollect = list.stream().filter(item -> item.getOtherPayOrg() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getOtherPayOrg));
otherCollect.forEach((k, v) -> {
if (result.get(k) == null) {
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
temp.setPayOrg(paymentMap.get(k).getName());
result.put(k, temp);
}
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
accountOtherView(insuranceAccountViewListDTO, v);
});
//对各组织进行金额合计
List<InsuranceAccountViewListDTO> viewDTOS = new ArrayList<>();
result.forEach((k, v) -> {
BigDecimal socialPaySum = StringUtils.isBlank(v.getSocialPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getSocialPaySum());
BigDecimal fundPaySum = StringUtils.isBlank(v.getFundPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getFundPaySum());
BigDecimal otherPaySum = StringUtils.isBlank(v.getOtherPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getOtherPaySum());
v.setIndex(k);
BigDecimal sum = socialPaySum.add(fundPaySum).add(otherPaySum);
v.setSum(sum.toPlainString());
viewDTOS.add(v);
});
//合计
InsuranceAccountViewListDTO insuranceAccountViewListDTO = new InsuranceAccountViewListDTO();
int socialNum = 0;
int fundNum = 0;
int otherNum = 0;
BigDecimal socialSum = new BigDecimal("0");
BigDecimal fundSum = new BigDecimal("0");
BigDecimal otherSum = new BigDecimal("0");
BigDecimal sum = new BigDecimal("0");
for (InsuranceAccountViewListDTO item : viewDTOS) {
if (item.getSocialNum() != null) {
socialNum += item.getSocialNum();
}
if (item.getFundNum() != null) {
fundNum += item.getFundNum();
}
if (item.getOtherNum() != null) {
otherNum += item.getOtherNum();
}
if (StringUtils.isNotBlank(item.getSocialPaySum())) {
socialSum = socialSum.add(new BigDecimal(item.getSocialPaySum()));
}
if (StringUtils.isNotBlank(item.getFundPaySum())) {
fundSum = fundSum.add(new BigDecimal(item.getFundPaySum()));
}
if (StringUtils.isNotBlank(item.getOtherPaySum())) {
otherSum = otherSum.add(new BigDecimal(item.getOtherPaySum()));
}
if (StringUtils.isNotBlank(item.getSum())) {
sum = sum.add(new BigDecimal(item.getSum()));
}
}
insuranceAccountViewListDTO.setSum(sum.toPlainString());
insuranceAccountViewListDTO.setSocialPaySum(socialSum.toPlainString());
insuranceAccountViewListDTO.setPayOrg(SalaryI18nUtil.getI18nLabel(93278, "合计"));
insuranceAccountViewListDTO.setFundPaySum(fundSum.toPlainString());
insuranceAccountViewListDTO.setOtherPaySum(otherSum.toPlainString());
insuranceAccountViewListDTO.setSocialNum(socialNum);
insuranceAccountViewListDTO.setFundNum(fundNum);
insuranceAccountViewListDTO.setOtherNum(otherNum);
viewDTOS.add(insuranceAccountViewListDTO);
viewDTOS.forEach(e -> {
e.setSocialPaySum(StringUtils.isBlank(e.getSocialPaySum()) ? "0" : e.getSocialPaySum());
e.setSocialNum(e.getSocialNum() == null ? 0 : e.getSocialNum());
e.setFundNum(e.getFundNum() == null ? 0 : e.getFundNum());
e.setFundPaySum(StringUtils.isBlank(e.getFundPaySum()) ? "0" : e.getFundPaySum());
e.setOtherPaySum(StringUtils.isBlank(e.getOtherPaySum()) ? "0" : e.getOtherPaySum());
e.setOtherNum(e.getOtherNum() == null ? 0 : e.getOtherNum());
e.setSum(SalaryEntityUtil.thousandthConvert(e.getSum()));
e.setSocialPaySum(SalaryEntityUtil.thousandthConvert(e.getSocialPaySum()));
e.setOtherPaySum(SalaryEntityUtil.thousandthConvert(e.getOtherPaySum()));
e.setFundPaySum(SalaryEntityUtil.thousandthConvert(e.getFundPaySum()));
});
return viewDTOS;
}
public void accountOtherView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int otherNum = 0;
BigDecimal otherPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getOtherSum())) {
otherNum += 1;
otherPaySum = otherPaySum.add(new BigDecimal(item.getOtherSum()));
}
}
dto.setOtherNum(otherNum);
dto.setOtherPaySum(otherPaySum.toPlainString());
}
public void accountFundView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int fundNum = 0;
BigDecimal fundPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getFundSum())) {
fundNum += 1;
fundPaySum = fundPaySum.add(new BigDecimal(item.getFundSum()));
}
}
dto.setFundNum(fundNum);
dto.setFundPaySum(fundPaySum.toPlainString());
}
public void accountSocialView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
int socialNum = 0;
BigDecimal socialPaySum = new BigDecimal("0");
for (InsuranceAccountDetailPO item : pos) {
if (StringUtils.isNotBlank(item.getSocialSum())) {
socialNum += 1;
socialPaySum = socialPaySum.add(new BigDecimal(item.getSocialSum()));
}
}
dto.setSocialNum(socialNum);
dto.setSocialPaySum(socialPaySum.toPlainString());
}
}

View File

@ -0,0 +1,33 @@
package com.engine.salary.cmd.taxDeclaration;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.TaxRateBiz;
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class TaxDeclarationGetFormCmd extends AbstractCommonCommand<Map<String, Object>> {
public TaxDeclarationGetFormCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>(16);
TaxRateBiz taxRateBiz = new TaxRateBiz();
TaxRateSaveParam taxRateSaveParam = (TaxRateSaveParam) params.get("taxRateSaveParam");
taxRateBiz.save(taxRateSaveParam, (long) user.getUID());
return apidatas;
}
}

View File

@ -0,0 +1,33 @@
package com.engine.salary.cmd.taxDeclaration;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.TaxRateBiz;
import com.engine.salary.entity.taxrate.param.TaxRateSaveParam;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
public class TaxDeclarationGetTaxDeclarationInfoCmd extends AbstractCommonCommand<Map<String, Object>> {
public TaxDeclarationGetTaxDeclarationInfoCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>(16);
TaxRateBiz taxRateBiz = new TaxRateBiz();
TaxRateSaveParam taxRateSaveParam = (TaxRateSaveParam) params.get("taxRateSaveParam");
taxRateBiz.save(taxRateSaveParam, (long) user.getUID());
return apidatas;
}
}

View File

@ -1,19 +1,22 @@
package com.engine.salary.cmd.taxDeclaration;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.salaryarchive.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxrate.vo.TaxAgentTableVO;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.DBType;
import com.fapiao.neon.model.in.Page;
import org.apache.commons.lang3.StringUtils;
import weaver.general.PageIdConst;
import weaver.general.Util;
import weaver.conn.RecordSet;
import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
public class TaxDeclarationListCmd extends AbstractCommonCommand<Map<String, Object>> {
@ -31,51 +34,68 @@ public class TaxDeclarationListCmd extends AbstractCommonCommand<Map<String, Obj
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>(16);
//查询个税申报表
SalaryWeaTable<TaxDeclaration> table = new SalaryWeaTable<TaxDeclaration>(user, TaxDeclaration.class);
//sql条件
String sqlWhere = makeSqlWhere(params,user);
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
String pageID = "a4f85287-e3f9-4275-9527-7d06e54y6rj8";
String pageUid = pageID + "_" + user.getUID();
String pageSize = PageIdConst.getPageSize(pageID, user.getUID());
String fileds = " create_time,creator,delete_type, description, id, name, system_type, tenant_key, update_time";
String sql = " from hrsa_sys_tax_rate_base s " +
" where s.delete_type = 0";
//模糊查询
String name = Util.null2String(params.get("name"));
if (StringUtils.isNotBlank(name)) {
sql += " and s.name like '%" + name + "%' ";
}
sql += " union all " +
" select create_time,creator,delete_type, description, id, name, system_type, tenant_key, update_time " +
" from hrsa_tax_rate_base b " +
" where b.delete_type = 0 ";
//模糊查询
if (StringUtils.isNotBlank(name)) {
sql += " and b.name like '%" + name + "%' ";
}
WeaTable table = new WeaTable();
table.setPageUID(pageUid);
table.setPageID(pageID);
table.setPagesize(pageSize);
table.setBackfields(fileds);
table.setSqlform(sql);
// table.setSqlwhere();
table.setSqlorderby("id desc");
table.setSqlprimarykey("id");
table.setSqlisdistinct("false");
table.getColumns().add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE));
table.getColumns().add(new WeaTableColumn("20%", "名称", "name", ""));
table.getColumns().add(new WeaTableColumn("20%", "名称", "systemType", ""));
table.getColumns().add(new WeaTableColumn("20%", "名称", "createTime", ""));
table.getColumns().add(new WeaTableColumn("20%", "名称", "description", ""));
result.putAll(table.makeDataResult());
result.success();
apidatas = result.getResultMap();
return apidatas;
//人员list
List<Object> list = table.makeDataResult().values().stream().collect(Collectors.toList());
//SalaryWeaTable<SimpleEmployee> simpleEmployees = new SalaryWeaTable<SimpleEmployee>(user, SimpleEmployee.class);
//查询个税扣缴义务人
SalaryWeaTable<TaxAgentTableVO> taxAgentPOS = new SalaryWeaTable<TaxAgentTableVO>(user, TaxAgentTableVO.class);
List employeeIds = new ArrayList();
if(!table.makeDataResult().isEmpty()){
//查询人员
//查询个税扣缴义务人
}
return result.getResultMap();
}
/**
* sql条件
*
* @param params
* @return
*/
private String makeSqlWhere(Map<String, Object> params,User user) {
DBType dbType = DBType.get(new RecordSet().getDBType());
//租户key
String userId = user.getLoginid();
String sqlWhere = "where delete_Type = 0 and tenantKey = userId";
//区间查询
String FromSalaryMonth = (String) params.get("FromSalaryMonth");
String EndSalaryMonth = (String) params.get("EndSalaryMonth");
if (SalaryEntityUtil.isNotNullOrEmpty(FromSalaryMonth)&&SalaryEntityUtil.isNotNullOrEmpty(EndSalaryMonth)) {
sqlWhere += "AND salary_month between to_date(FromSalaryMonth,'yyyy-mm') and to_date(EndSalaryMonth,'yyyy-mm')";
}
return sqlWhere;
}
/**
* sql条件
*
* @param params
* @return
*/
private String makeSqlWhereAgent(Map<String, Object> params) {
DBType dbType = DBType.get(new RecordSet().getDBType());
String sqlWhere = "where delete_Type = 0";
//模糊查询
String name = (String) params.get("name");
if (StringUtils.isNotBlank(name)) {
sqlWhere += " AND name " + dbType.like(name);
}
return sqlWhere;
}
}

View File

@ -1,6 +1,10 @@
package com.engine.salary.entity.siaccount.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -16,32 +20,34 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "b3afad76-a971-4fe3-8064-0cabdcb10b18", tableType = WeaTableType.NONE,operates = {
})
public class InsuranceAccountViewListDTO {
//"序号")
@TableTitle(title = "序号", dataIndex = "index", key = "index")
private Long index;
//缴纳组织")
@TableTitle(title = "缴纳组织", dataIndex = "payOrg", key = "payOrg")
private String payOrg;
//社保人数")
@TableTitle(title = "社保人数", dataIndex = "socialNum", key = "socialNum")
private Integer socialNum;
//公积金人数")
@TableTitle(title = "公积金人数", dataIndex = "fundNum", key = "fundNum")
private Integer fundNum;
//其他福利人数")
@TableTitle(title = "其他福利人数", dataIndex = "otherNum", key = "otherNum")
private Integer otherNum;
//社保缴费合计")
@TableTitle(title = "社保缴费合计", dataIndex = "socialPaySum", key = "socialPaySum")
private String socialPaySum;
//公积金缴费合计")
@TableTitle(title = "公积金缴费合计", dataIndex = "fundPaySum", key = "fundPaySum")
private String fundPaySum;
//其他福利缴费合计")
@TableTitle(title = "其他福利缴费合计", dataIndex = "otherPaySum", key = "otherPaySum")
private String otherPaySum;
//合计")
@TableTitle(title = "合计", dataIndex = "sum", key = "sum")
private String sum;
}

View File

@ -0,0 +1,25 @@
package com.engine.salary.entity.siexport.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author weaver_cl
* @Description: TODO 导出
* @Date 2022/3/7
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class InsuranceExportParam {
//@NotBlank
@DataCheck(require = true,message = "账单月份不可为空")
private String billMonth;
}

View File

@ -0,0 +1,53 @@
package com.engine.salary.entity.siexport.po;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.enums.UserStatusEnum;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/3/7
* @Version V1.0
**/
public class AccountExportPO extends InsuranceAccountDetailPO {
private String userName;
private String telephone;
private String departmentName;
private UserStatusEnum userStatus;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public UserStatusEnum getUserStatus() {
return userStatus;
}
public void setUserStatus(UserStatusEnum userStatus) {
this.userStatus = userStatus;
}
}

View File

@ -56,4 +56,9 @@ public class TaxDeclaration {
*/
private Date updateTime;
/**
* 应税项目1:正常工资薪金所得
*/
private Integer incomeCategory;
}

View File

@ -0,0 +1,375 @@
package com.engine.salary.entity.taxdeclaration.bo;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description: 个税申报表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 10:01 AM
* @version:v1.0
*/
public class TaxDeclarationBO {
public static List<TaxDeclarationListDTO> convert2ListDTO(List<TaxDeclarationPO> taxDeclarations,
List<DataCollectionEmployee> simpleEmployees,
List<TaxAgent> taxAgents) {
if (CollectionUtils.isEmpty(simpleEmployees)) {
return Collections.emptyList();
}
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName);
Map<Long, String> employeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername);
return taxDeclarations.stream().map(e -> TaxDeclarationListDTO.builder()
.id(e.getId())
.salaryMonth(e.getSalaryMonth().toString())
.taxAgentId(e.getTaxAgentId())
.taxAgentName(taxAgentNameMap.getOrDefault(e.getTaxAgentId(), ""))
.taxCycle(e.getTaxCycle().toString())
.operateEmployeeId(e.getCreator())
.operateEmployeeName(employeeNameMap.getOrDefault(e.getCreator(), ""))
.operateTime(SalaryDateUtil.getFormatLocalDateTime(e.getCreateTime()))
.description(e.getDescription())
.build()).collect(Collectors.toList());
}
public static void buildDetailListDTO(Long taxDeclarationId,
PageInfo<TaxDeclarationDetailListDTO> page,
List<TaxDeclarationDetailPO> taxDeclarationDetails,
List<DataCollectionEmployee> simpleEmployees) {
if (CollectionUtils.isEmpty(taxDeclarationDetails)) {
return;
}
int index = (page.getNextPage() - 1) * page.getSize();
List<TaxDeclarationDetailListDTO> dtos = Lists.newArrayListWithExpectedSize(simpleEmployees.size());
Map<Long, List<TaxDeclarationDetailPO>> taxDeclarationDetailMap = SalaryEntityUtil.group2Map(taxDeclarationDetails, TaxDeclarationDetailPO::getEmployeeId);
for (DataCollectionEmployee simpleEmployee : simpleEmployees) {
Map<String, String> valueMap = SalaryEntityUtil.convert2Map(taxDeclarationDetailMap.get(simpleEmployee.getEmployeeId()), TaxDeclarationDetailPO::getFieldCode, TaxDeclarationDetailPO::getFieldValue);
TaxDeclarationDetailListDTO dto = new TaxDeclarationDetailListDTO();
dto.setId(simpleEmployee.getEmployeeId());
dto.setTaxDeclarationId(taxDeclarationId);
dto.setSeq(++index);
dto.setEmployeeId(simpleEmployee.getEmployeeId());
dto.setEmployeeName(simpleEmployee.getUsername());
dto.setIdCardType(SalaryI18nUtil.getI18nLabel(101696,"身份证"));
dto.setIdCardNo("");
dto.setTaxpayerIdNo("");
dto.setResidentType(SalaryI18nUtil.getI18nLabel(101697,"居民"));
dto.setIncomeType(SalaryI18nUtil.getI18nLabel(101698,"工资、薪金"));
dto.setIncome(valueMap.getOrDefault("income",""));
dto.setFee(valueMap.getOrDefault("fee", ""));
dto.setTaxFreeIncome(valueMap.getOrDefault("taxFreeIncome", ""));
dto.setSubtraction(valueMap.getOrDefault("subtraction", ""));
dto.setEndowmentInsurance(valueMap.getOrDefault("endowmentInsurance", ""));
dto.setMedicalInsurance(valueMap.getOrDefault("medicalInsurance",""));
dto.setUnemploymentInsurance(valueMap.getOrDefault("unemploymentInsurance",""));
dto.setHousingProvidentFund(valueMap.getOrDefault("housingProvidentFund",""));
dto.setAnnuity(valueMap.getOrDefault("annuity",""));
dto.setCommercialHealthInsurance(valueMap.getOrDefault("commercialHealthInsurance",""));
dto.setTaxDeferredEndowmentInsurance(valueMap.getOrDefault("taxDeferredEndowmentInsurance",""));
dto.setOriginalValueOfProperty(valueMap.getOrDefault("originalValueOfProperty",""));
dto.setDeductedTax(valueMap.getOrDefault("deductedTax",""));
dto.setOther(valueMap.getOrDefault("other",""));
dto.setAddUpIncome(valueMap.getOrDefault("addUpIncome",""));
dto.setAddUpSubtraction(valueMap.getOrDefault("addUpSubtraction",""));
dto.setAddUpSpecialDeduction(valueMap.getOrDefault("addUpSpecialDeduction",""));
dto.setAddUpChildEducation(valueMap.getOrDefault("addUpChildEducation",""));
dto.setAddUpContinuingEducation(valueMap.getOrDefault("addUpContinuingEducation",""));
dto.setAddUpHousingLoanInterest(valueMap.getOrDefault("addUpHousingLoanInterest",""));
dto.setAddUpHousingRent(valueMap.getOrDefault("addUpHousingRent",""));
dto.setAddUpSupportElderly(valueMap.getOrDefault("addUpSupportElderly",""));
dto.setAddUpOther(valueMap.getOrDefault("addUpOtherDeduction",""));
dto.setLessTaxProportion(valueMap.getOrDefault("lessTaxProportion",""));
dto.setAllowedDonation(valueMap.getOrDefault("addUpAllowedDonation",""));
dto.setTaxableIncome(valueMap.getOrDefault("addUpTaxableIncome",""));
dto.setTaxRate(valueMap.getOrDefault("taxRate",""));
dto.setQuickDeductionFactor(valueMap.getOrDefault("quickDeductionFactor",""));
dto.setTaxPayable(valueMap.getOrDefault("addUpTaxPayable",""));
dto.setTaxSavings(valueMap.getOrDefault("addUpTaxDeduction",""));
dto.setTaxWithheld(valueMap.getOrDefault("taxWithheld",""));
dto.setRefundedOrSupplementedTax(valueMap.getOrDefault("refundedOrSupplementedTax",""));
dtos.add(dto);
}
page.setList(dtos);
}
public static Result handle(TaxDeclarationSaveParam saveParam,
Date taxCycle,
List<SalaryItemPO> salaryItems,
List<SalarySobPO> salarySobs,
List<SalaryAcctResultPO> salaryAcctResults
) {
Result result = new Result();
if (CollectionUtils.isEmpty(salaryAcctResults)) {
return result;
}
// 薪资项目聚合成map为了根据code获取id
Map<String, Long> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getCode, SalaryItemPO::getId);
// 薪资账套聚合成map为了根据id获取incomeCategory
Map<Long, SalarySobPO> salarySobPOMap = SalaryEntityUtil.convert2Map(salarySobs, SalarySobPO::getId);
// 薪资核算结果按照个税扣缴义务人id所用薪资账套的incomeCategory聚合成map
/* Map<Long, Map<Integer, List<SalaryAcctResultPO>>> taxAgentIdKeyAcctResultMap = salaryAcctResults.stream()
.collect(Collectors.groupingBy(SalaryAcctResultPO::getTaxAgentId,
Collectors.groupingBy(salaryAcctResultPO -> salarySobPOMap.get(salaryAcctResultPO.getSalarySobId()).getIncomeCategory())));
*/// 一个个税扣缴义务人一种薪资类型生成一张个税申报表
Map<Long, List<SalaryAcctResultPO>> taxAgentIdKeyAcctResultMap = SalaryEntityUtil.group2Map(salaryAcctResults, SalaryAcctResultPO::getTaxAgentId);
taxAgentIdKeyAcctResultMap.forEach((k, v) -> {
// 新增的个税申报表
TaxDeclarationPO taxDeclaration = convert2PO(saveParam, taxCycle, k);
result.getNeedInsertTaxDeclarations().add(taxDeclaration);
// 处理个税申报明细以及累计情况
handleTaxDeclarationDetail(result, taxDeclaration, v, salaryItemMap);
});
/*taxAgentIdKeyAcctResultMap.forEach((taxAgentId, incomeCategoryKeyAcctResultPOMap) -> {
incomeCategoryKeyAcctResultPOMap.forEach((incomeCategory, salaryAcctResultPOS) -> {
// 新增的个税申报表
TaxDeclarationPO taxDeclaration = convert2PO(saveParam, taxCycle, taxAgentId, incomeCategory, employeeId);
result.getNeedInsertTaxDeclarations().add(taxDeclaration);
if (Objects.equals(incomeCategory, IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())) {
// 生成个税申报表
handleTaxDeclaration4Wage(result, taxDeclaration, salaryAcctResultPOS, salaryItemMap);
// 生成往期累计情况
handleAddUpSituation(result, taxDeclaration, salaryAcctResultPOS, salaryItemMap);
}
if (Objects.equals(incomeCategory, IncomeCategoryEnum.REMUNERATION_FOR_LABOR.getValue())) {
// 生成个税申报表
handleTaxDeclaration4Labor(result, taxDeclaration, salaryAcctResultPOS, salaryItemMap);
}
});
});*/
return result;
}
private static void handleTaxDeclarationDetail(Result result,
TaxDeclarationPO taxDeclaration,
List<SalaryAcctResultPO> salaryAcctResults,
Map<String, Long> salaryItemMap) {
if (CollectionUtils.isEmpty(salaryAcctResults)) {
return;
}
// 核算结果按照人员id分类
Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResults, SalaryAcctResultPO::getEmployeeId);
acctResultMap.forEach((k, v) -> {
Map<String, BigDecimal> valueMap = Maps.newHashMapWithExpectedSize(32);
Map<Long, List<SalaryAcctResultPO>> resultMap = SalaryEntityUtil.group2Map(v, SalaryAcctResultPO::getSalaryItemId);
// 收入
BigDecimal income = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault("income", 0L)), e -> SalaryEntityUtil.empty2Zero(e.getResultValue()));
valueMap.put("income", income);
// 费用
BigDecimal fee = BigDecimal.ZERO;
valueMap.put("fee", fee);
// 免税收入
BigDecimal taxFreeIncome = BigDecimal.ZERO;
valueMap.put("taxFreeIncome", taxFreeIncome);
// 减除费用
BigDecimal subtraction = findValue("subtraction", resultMap, salaryItemMap);
valueMap.put("subtraction", subtraction);
// 基本养老保险
BigDecimal endowmentInsurance = findValue("endowmentInsurance", resultMap, salaryItemMap);
valueMap.put("endowmentInsurance", endowmentInsurance);
// 基本医疗保险
BigDecimal medicalInsurance = findValue("medicalInsurance", resultMap, salaryItemMap);
valueMap.put("medicalInsurance", medicalInsurance);
// 失业保险
BigDecimal unemploymentInsurance = findValue("unemploymentInsurance", resultMap, salaryItemMap);
valueMap.put("unemploymentInsurance", unemploymentInsurance);
// 住房公积金
BigDecimal housingProvidentFund = findValue("housingProvidentFund", resultMap, salaryItemMap);
valueMap.put("housingProvidentFund", housingProvidentFund);
// 年金
BigDecimal annuity = findValue("annuity", resultMap, salaryItemMap);
valueMap.put("annuity", annuity);
// 商业健康保险
BigDecimal commercialHealthInsurance = findValue("commercialHealthInsurance", resultMap, salaryItemMap);
valueMap.put("commercialHealthInsurance", commercialHealthInsurance);
// 税延养老保险
BigDecimal taxDeferredEndowmentInsurance = findValue("taxDeferredEndowmentInsurance", resultMap, salaryItemMap);
valueMap.put("taxDeferredEndowmentInsurance", taxDeferredEndowmentInsurance);
// 财产原值
BigDecimal originalValueOfProperty = findValue("originalValueOfProperty", resultMap, salaryItemMap);
valueMap.put("originalValueOfProperty", originalValueOfProperty);
// 允许扣除的税费
BigDecimal deductedTax = findValue("deductedTax", resultMap, salaryItemMap);
valueMap.put("deductedTax", deductedTax);
// 其他
BigDecimal other = findValue("other", resultMap, salaryItemMap);
valueMap.put("other", other);
// 累计收入
BigDecimal addUpIncome = findAddUpValue("addUpIncome", resultMap, salaryItemMap);
valueMap.put("addUpIncome", addUpIncome);
// 累计减除费用
BigDecimal addUpSubtraction = findAddUpValue("addUpSubtraction", resultMap, salaryItemMap);
valueMap.put("addUpSubtraction", addUpSubtraction);
// 累计专项扣除
BigDecimal addUpSpecialDeduction = findAddUpValue("addUpSpecialDeduction", resultMap, salaryItemMap);
valueMap.put("addUpSpecialDeduction", addUpSpecialDeduction);
// 累计子女教育
BigDecimal addUpChildEducation = findAddUpValue("addUpChildEducation", resultMap, salaryItemMap);
valueMap.put("addUpChildEducation", addUpChildEducation);
// 累计继续教育
BigDecimal addUpContinuingEducation = findAddUpValue("addUpContinuingEducation", resultMap, salaryItemMap);
valueMap.put("addUpContinuingEducation", addUpContinuingEducation);
// 累计住房贷款利息
BigDecimal addUpHousingLoanInterest = findAddUpValue("addUpHousingLoanInterest", resultMap, salaryItemMap);
valueMap.put("addUpHousingLoanInterest", addUpHousingLoanInterest);
// 累计住房租金
BigDecimal addUpHousingRent = findAddUpValue("addUpHousingRent", resultMap, salaryItemMap);
valueMap.put("addUpHousingRent", addUpHousingRent);
// 累计赡养老人
BigDecimal addUpSupportElderly = findAddUpValue("addUpSupportElderly", resultMap, salaryItemMap);
valueMap.put("addUpSupportElderly", addUpSupportElderly);
// 累计其他扣除
BigDecimal addUpOtherDeduction = findAddUpValue("addUpOtherDeduction", resultMap, salaryItemMap);
valueMap.put("addUpOtherDeduction", addUpOtherDeduction);
// 减按计税比例
BigDecimal lessTaxProportion = BigDecimal.ONE;
valueMap.put("lessTaxProportion", lessTaxProportion);
// 准允扣除的捐赠额
BigDecimal addUpAllowedDonation = findAddUpValue("addUpAllowedDonation", resultMap, salaryItemMap);
valueMap.put("addUpAllowedDonation", addUpAllowedDonation);
// 应纳税所得额
BigDecimal addUpTaxableIncome = findAddUpValue("addUpTaxableIncome", resultMap, salaryItemMap);
valueMap.put("addUpTaxableIncome", addUpTaxableIncome);
// 税率
BigDecimal taxRate = findAddUpValue("taxRate", resultMap, salaryItemMap);
valueMap.put("taxRate", taxRate);
// 速算扣除数
BigDecimal quickDeductionFactor = findAddUpValue("quickDeductionFactor", resultMap, salaryItemMap);
valueMap.put("quickDeductionFactor", quickDeductionFactor);
// 应纳税额
BigDecimal addUpTaxPayable = findAddUpValue("addUpTaxPayable", resultMap, salaryItemMap);
valueMap.put("addUpTaxPayable", addUpTaxPayable);
// 减免税额
BigDecimal addUpTaxDeduction = BigDecimal.ZERO;
valueMap.put("addUpTaxDeduction", addUpTaxDeduction);
// 应补缴税额
BigDecimal refundedOrSupplementedTax = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault("refundedOrSupplementedTax", 0L)),
e -> SalaryEntityUtil.empty2Zero(e.getResultValue()));
valueMap.put("refundedOrSupplementedTax", refundedOrSupplementedTax);
// 已扣缴税额
BigDecimal taxWithheld = addUpTaxPayable.subtract(refundedOrSupplementedTax);
valueMap.put("taxWithheld", taxWithheld);
valueMap.forEach((key, value) -> {
TaxDeclarationDetailPO detailPO = TaxDeclarationDetailPO.builder()
.id(IdGenerator.generate())
.taxDeclarationId(taxDeclaration.getId())
.employeeId(k)
.fieldCode(key)
.fieldValue(value.toPlainString())
.creator(taxDeclaration.getCreator())
.createTime(SalaryDateUtil.dateToLocalDateTime(taxDeclaration.getCreateTime()))
.updateTime(SalaryDateUtil.dateToLocalDateTime(taxDeclaration.getUpdateTime()))
.deleteType(0)
.tenantKey(taxDeclaration.getTenantKey())
.build();
result.getNeedInsertTaxDeclarationDetails().add(detailPO);
});
// 累计社保个人合计
BigDecimal addUpSocialSecurityTotal = findAddUpValue("addUpSocialSecurityTotal", resultMap, salaryItemMap);
// 累计公积金个人合计
BigDecimal addUpAccumulationFundTotal = findAddUpValue("addUpAccumulationFundTotal", resultMap, salaryItemMap);
// 累计年金及其他福利合计
BigDecimal addUpEnterpriseAndOther = findAddUpValue("addUpEnterpriseAndOther", resultMap, salaryItemMap);
// 更新累计情况
AddUpSituation accumulatedSituation = AddUpSituation.builder()
.id(IdGenerator.generate())
.employeeId(k)
.taxAgentId(taxDeclaration.getTaxAgentId())
.taxYearMonth((taxDeclaration.getSalaryMonth()))
.year(taxDeclaration.getSalaryMonth().getYear())
.addUpIncome(addUpIncome.toPlainString())
.addUpSocialSecurityTotal(addUpSocialSecurityTotal.toPlainString())
.addUpAccumulationFundTotal(addUpAccumulationFundTotal.toPlainString())
.addUpEnterpriseAndOther(addUpEnterpriseAndOther.toPlainString())
.addUpSubtraction(addUpSubtraction.toPlainString())
.addUpChildEducation(addUpChildEducation.toPlainString())
.addUpContinuingEducation(addUpContinuingEducation.toPlainString())
.addUpHousingLoanInterest(addUpHousingLoanInterest.toPlainString())
.addUpHousingRent(addUpHousingRent.toPlainString())
.addUpSupportElderly(addUpSupportElderly.toPlainString())
.addUpOtherDeduction(addUpOtherDeduction.toPlainString())
.addUpTaxExemptIncome("0")
.addUpAllowedDonation(addUpAllowedDonation.toPlainString())
.addUpAdvanceTax(addUpTaxPayable.toPlainString())
.creator(taxDeclaration.getCreator())
.createTime(taxDeclaration.getCreateTime())
.updateTime(taxDeclaration.getUpdateTime())
.tenantKey(taxDeclaration.getTenantKey())
.deleteType(0)
.build();
result.getNeedInsertAccumulatedSituations().add(accumulatedSituation);
});
}
private static TaxDeclarationPO convert2PO(TaxDeclarationSaveParam saveParam, Date taxCycle, Long taxAgentId) {
LocalDateTime now = LocalDateTime.now();
return TaxDeclarationPO.builder()
.id(IdGenerator.generate())
.taxAgentId(taxAgentId)
.salaryMonth(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1)))
.taxCycle(taxCycle)
.description(saveParam.getDescription())
// .creator(employeeId)
.createTime(SalaryDateUtil.localDateTimeToDate(now))
.updateTime(SalaryDateUtil.localDateTimeToDate(now))
.deleteType(0)
//.tenantKey(tenantKey)
.build();
}
private static BigDecimal findValue(String fieldCode, Map<Long, List<SalaryAcctResultPO>> resultMap, Map<String, Long> salaryItemMap) {
return resultMap.getOrDefault(salaryItemMap.getOrDefault(fieldCode, 0L), Collections.emptyList()).stream()
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
.filter(e -> e.compareTo(BigDecimal.ZERO) > 0)
.findAny()
.orElse(BigDecimal.ZERO);
}
private static BigDecimal findAddUpValue(String fieldCode, Map<Long, List<SalaryAcctResultPO>> resultMap, Map<String, Long> salaryItemMap) {
return resultMap.getOrDefault(salaryItemMap.getOrDefault(fieldCode, 0L), Collections.emptyList()).stream()
.map(e -> SalaryEntityUtil.empty2Zero(e.getResultValue()))
.max(Comparator.comparingDouble(BigDecimal::doubleValue))
.orElse(BigDecimal.ZERO);
}
@Data
public static class Result {
private Collection<TaxDeclarationPO> needInsertTaxDeclarations;
private Collection<TaxDeclarationDetailPO> needInsertTaxDeclarationDetails;
private Collection<AddUpSituation> needInsertAccumulatedSituations;
public Result() {
this.needInsertTaxDeclarations = Lists.newArrayList();
this.needInsertTaxDeclarationDetails = Lists.newArrayList();
this.needInsertAccumulatedSituations = Lists.newArrayList();
}
}
}

View File

@ -0,0 +1,870 @@
package com.engine.salary.entity.taxdeclaration.bo;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import java.util.List;
/**
* @description: 个税申报表明细的表头
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 11:31 AM
* @version:v1.0
*/
public class TaxDeclarationDetailListColumn {
private static final String COLUMN = " [\n" +
" {\n" +
" title: '序号',\n" +
" titleLabelId: 84162,\n" +
" dataIndex: 'seq_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '1',\n" +
" dataIndex: 'seq',\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '姓名',\n" +
" titleLabelId: 85429,\n" +
" dataIndex: 'employeeName_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '2',\n" +
" dataIndex: 'employeeName'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '身份证件类型',\n" +
" titleLabelId: 102781,\n" +
" dataIndex: 'idCardType_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '3',\n" +
" dataIndex: 'idCardType'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '身份证件号码',\n" +
" titleLabelId: 102782,\n" +
" dataIndex: 'idCardNo_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '4',\n" +
" dataIndex: 'idCardNo'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '纳税人识别号',\n" +
" titleLabelId: 102783,\n" +
" dataIndex: 'taxpayerIdNo_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '5',\n" +
" dataIndex: 'taxpayerIdNo'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '是否为非居民个人',\n" +
" titleLabelId: 102785,\n" +
" dataIndex: 'isPersonal_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '6',\n" +
" dataIndex: 'isPersonal'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '所得项目',\n" +
" titleLabelId: 102786,\n" +
" dataIndex: 'incomeType_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '7',\n" +
" dataIndex: 'incomeType'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '本月(次)情况',\n" +
" titleLabelId: 102787,\n" +
" dataIndex: 'condition_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" children : [\n" +
" {\n" +
" title: '收入额计算',\n" +
" titleLabelId: 102788,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_calc_p',\n" +
" children : [\n" +
" {\n" +
" title: '收入',\n" +
" titleLabelId: 96689,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_p',\n" +
" children : [\n" +
" {\n" +
" title: '8',\n" +
" dataIndex: 'income'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '费用',\n" +
" titleLabelId: 102789,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'fee_p',\n" +
" children : [\n" +
" {\n" +
" title: '9',\n" +
" dataIndex: 'fee'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '免税收入',\n" +
" titleLabelId: 102790,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxFreeIncome_p',\n" +
" children : [\n" +
" {\n" +
" title: '10',\n" +
" dataIndex: 'taxFreeIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '减除费用',\n" +
" titleLabelId: 102791,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'subtraction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '11',\n" +
" dataIndex: 'subtraction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '专项扣除',\n" +
" titleLabelId: 85829,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'special_deduction_p',\n" +
" children : [\n" +
" {\n" +
" title: '基本养老保险费',\n" +
" titleLabelId: 102792,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'endowment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '12',\n" +
" dataIndex: 'endowmentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '基本医疗保险费',\n" +
" titleLabelId: 102793,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'medical_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '13',\n" +
" dataIndex: 'medicalInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '失业保险费',\n" +
" titleLabelId: 102794,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'unemployment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '14',\n" +
" dataIndex: 'unemploymentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房公积金',\n" +
" titleLabelId: 102795,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'housing_fund_p',\n" +
" children : [\n" +
" {\n" +
" title: '15',\n" +
" dataIndex: 'housingProvidentFund'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '其他扣除',\n" +
" titleLabelId: 85831,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'other_deduction_p',\n" +
" children : [\n" +
" {\n" +
" title: '年金',\n" +
" titleLabelId: 102796,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'annuity_p',\n" +
" children : [\n" +
" {\n" +
" title: '16',\n" +
" dataIndex: 'annuity'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '商业健康保险',\n" +
" titleLabelId: 91238,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'commercial_health_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '17',\n" +
" dataIndex: 'commercialHealthInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '税延养老保险',\n" +
" titleLabelId: 91239,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'tax_deferred_endowment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '18',\n" +
" dataIndex: 'taxDeferredEndowmentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '财产原值',\n" +
" titleLabelId: 102797,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'originalValueOfProperty_p',\n" +
" children : [\n" +
" {\n" +
" title: '19',\n" +
" dataIndex: 'originalValueOfProperty'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '允许扣除的税费',\n" +
" titleLabelId: 102798,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'deductedTax_p',\n" +
" children : [\n" +
" {\n" +
" title: '20',\n" +
" dataIndex: 'deductedTax'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '其他',\n" +
" titleLabelId: 102799,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'other_p',\n" +
" children : [\n" +
" {\n" +
" title: '21',\n" +
" dataIndex: 'other'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '累计情况(工资、薪金)',\n" +
" titleLabelId: 87521,\n" +
" dataIndex: 'cumsituation_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" children : [\n" +
" {\n" +
" title: '累计收入额',\n" +
" titleLabelId: 86712,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpIncome_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '22',\n" +
" dataIndex: 'addUpIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计减除费用',\n" +
" titleLabelId: 86711,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSubtraction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '23',\n" +
" dataIndex: 'addUpSubtraction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计专项扣除',\n" +
" titleLabelId: 102800,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSpecialDeduction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '24',\n" +
" dataIndex: 'addUpSpecialDeduction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
"\n" +
" {\n" +
" title: '累计专项附加扣除',\n" +
" titleLabelId: 85380,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_calc_p',\n" +
" children : [\n" +
" {\n" +
" title: '子女教育',\n" +
" titleLabelId: 102801,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpChildEducation_p',\n" +
" children : [\n" +
" {\n" +
" title: '25',\n" +
" dataIndex: 'addUpChildEducation'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '赡养老人',\n" +
" titleLabelId: 102802,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSupportElderly_p',\n" +
" children : [\n" +
" {\n" +
" title: '26',\n" +
" dataIndex: 'addUpSupportElderly'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房贷款利息',\n" +
" titleLabelId: 102803,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpHousingLoanInterest_p',\n" +
" children : [\n" +
" {\n" +
" title: '27',\n" +
" dataIndex: 'addUpHousingLoanInterest'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房租金',\n" +
" titleLabelId: 102804,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpHousingRent_p',\n" +
" children : [\n" +
" {\n" +
" title: '28',\n" +
" dataIndex: 'addUpHousingRent'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '继续教育',\n" +
" titleLabelId: 102805,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpContinuingEducation_p',\n" +
" children : [\n" +
" {\n" +
" title: '29',\n" +
" dataIndex: 'addUpContinuingEducation'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计其他扣除',\n" +
" titleLabelId: 90569,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpOther_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '30',\n" +
" dataIndex: 'addUpOther'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '减按计税比例',\n" +
" titleLabelId: 102806,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'lessTaxProportion_p',\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '31',\n" +
" dataIndex: 'lessTaxProportion'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '准予扣除的捐赠额',\n" +
" titleLabelId: 91240,\n" +
" dataIndex: 'allowedDonation_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '32',\n" +
" dataIndex: 'allowedDonation'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '税款计算',\n" +
" titleLabelId: 102807,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'cumsituation_p',\n" +
" children : [\n" +
" {\n" +
" title: '应纳税所得额',\n" +
" titleLabelId: 96693,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxableIncome_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '33',\n" +
" dataIndex: 'taxableIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '税率/预扣率',\n" +
" titleLabelId: 102808,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxRate_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '34',\n" +
" dataIndex: 'taxRate'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '速算扣除数',\n" +
" titleLabelId: 84228,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'quickDeductionFactor_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '35',\n" +
" dataIndex: 'quickDeductionFactor'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '应纳税额',\n" +
" titleLabelId: 102809,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxPayable_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '36',\n" +
" dataIndex: 'taxPayable'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '减免税额',\n" +
" titleLabelId: 102810,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxSavings_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '37',\n" +
" dataIndex: 'taxSavings'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '已扣缴税额',\n" +
" titleLabelId: 102811,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxWithheld_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '38',\n" +
" dataIndex: 'taxWithheld'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '应补(退)税额',\n" +
" titleLabelId: 102812,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'refundedOrSupplementedTax_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '39',\n" +
" dataIndex: 'refundedOrSupplementedTax'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
"\n" +
" {\n" +
" title: '备注',\n" +
" titleLabelId: 84961,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'description_p',\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '40',\n" +
" dataIndex: 'description'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]";
/**
* 个税申报表导出的表头
*
* @return
*/
public static String[] listHeader() {
return new String[]{
SalaryI18nUtil.getI18nLabel(84162, "序号"),
SalaryI18nUtil.getI18nLabel(85429, "姓名"),
SalaryI18nUtil.getI18nLabel(102781, "身份证件类型"),
SalaryI18nUtil.getI18nLabel(102782, "身份证件号码"),
SalaryI18nUtil.getI18nLabel(102783, "纳税人识别号"),
SalaryI18nUtil.getI18nLabel(102785, "是否为非居民个人"),
SalaryI18nUtil.getI18nLabel(102786, "所得项目"),
SalaryI18nUtil.getI18nLabel(96689, "收入"),
SalaryI18nUtil.getI18nLabel(102789, "费用"),
SalaryI18nUtil.getI18nLabel(102790, "免税收入"),
SalaryI18nUtil.getI18nLabel(102791, "减除费用"),
SalaryI18nUtil.getI18nLabel(102792, "基本养老保险费"),
SalaryI18nUtil.getI18nLabel(102793, "基本医疗保险费"),
SalaryI18nUtil.getI18nLabel(102794, "失业保险费"),
SalaryI18nUtil.getI18nLabel(102795, "住房公积金"),
SalaryI18nUtil.getI18nLabel(102796, "年金"),
SalaryI18nUtil.getI18nLabel(91238, "商业健康保险"),
SalaryI18nUtil.getI18nLabel(91239, "税延养老保险"),
SalaryI18nUtil.getI18nLabel(102797, "财产原值"),
SalaryI18nUtil.getI18nLabel(102798, "允许扣除的税费"),
SalaryI18nUtil.getI18nLabel(102799, "其他"),
SalaryI18nUtil.getI18nLabel(86712, "累计收入额"),
SalaryI18nUtil.getI18nLabel(86711, "累计减除费用"),
SalaryI18nUtil.getI18nLabel(102800, "累计专项扣除"),
SalaryI18nUtil.getI18nLabel(102801, "子女教育"),
SalaryI18nUtil.getI18nLabel(102802, "赡养老人"),
SalaryI18nUtil.getI18nLabel(102803, "住房贷款利息"),
SalaryI18nUtil.getI18nLabel(102804, "住房租金"),
SalaryI18nUtil.getI18nLabel(102805, "继续教育"),
SalaryI18nUtil.getI18nLabel(90569, "累计其他扣除"),
SalaryI18nUtil.getI18nLabel(102806, "减按计税比例"),
SalaryI18nUtil.getI18nLabel(91240, "准予扣除的捐赠额"),
SalaryI18nUtil.getI18nLabel(96693, "应纳税所得额"),
SalaryI18nUtil.getI18nLabel(102808, "税率/预扣率"),
SalaryI18nUtil.getI18nLabel(84228, "速算扣除数"),
SalaryI18nUtil.getI18nLabel(102809, "应纳税额"),
SalaryI18nUtil.getI18nLabel(102810, "减免税额"),
SalaryI18nUtil.getI18nLabel(102811, "已扣缴税额"),
SalaryI18nUtil.getI18nLabel(102812, "应补(退)税额"),
SalaryI18nUtil.getI18nLabel(84961, "备注")};
}
/**
* 解析个税申报表的标头
*
* @return
*/
public static List<WeaTableColumn> listTableColumn() {
List<WeaTableColumn> weaTableColumns = Lists.newArrayList(JsonUtil.parseList(TaxDeclarationDetailListColumn.COLUMN, WeaTableColumn.class));
// for (WeaTableColumn weaTableColumn : weaTableColumns) {
// buildTitle(weaTableColumn);
// }
return weaTableColumns;
}
/**
* 个税申报表表头多语言
*
* @param weaTableColumn
*/
// private static void buildTitle(WeaTableColumn weaTableColumn) {
// weaTableColumn.setTitle(SalaryI18nUtil.getI18nLabel(weaTableColumn.getTitleLabelId(), weaTableColumn.getTitle()));
// if (CollectionUtils.isNotEmpty(weaTableColumn.getChildren())) {
// for (WeaTableColumnWapper weaTableColumnWapper : weaTableColumn.getChildren()) {
// buildTitle(weaTableColumnWapper);
// }
// }
// }
}

View File

@ -0,0 +1,235 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 个税申报表详情列表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 10:31 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationDetailListDTO {
/**
* 主键id
*/
private Long id;
/**
* 个税申报记录id
*/
private Long taxDeclarationId;
/**
* 序号
*/
private Integer seq;
/**
* 人员id
*/
private Long employeeId;
/**
* 姓名
*/
private String employeeName;
/**
* 身份证件类型
*/
private String idCardType;
/**
* 身份证件号码
*/
private String idCardNo;
/**
* 纳税人识别号
*/
private String taxpayerIdNo;
/**
* 是居民还是非居民
*/
private String residentType;
/**
* 所得项目
*/
private String incomeType;
/**
* 收入
*/
private String income;
/**
* 费用
*/
private String fee;
/**
* 免税收入
*/
private String taxFreeIncome;
/**
* 减除费用
*/
private String subtraction;
/**
* 养老保险
*/
private String endowmentInsurance;
/**
* 医疗保险
*/
private String medicalInsurance;
/**
* 失业保险
*/
private String unemploymentInsurance;
/**
* 住房公积金
*/
private String housingProvidentFund;
/**
* 年金
*/
private String annuity;
/**
* 商业健康保险
*/
private String commercialHealthInsurance;
/**
* 税延养老保险
*/
private String taxDeferredEndowmentInsurance;
/**
* 财产原值
*/
private String originalValueOfProperty;
/**
* 允许扣除的税费
*/
private String deductedTax;
/**
* 其他
*/
private String other;
/**
* 累计收入额
*/
private String addUpIncome;
/**
* 累计减除费用
*/
private String addUpSubtraction;
/**
* 累计专项扣除
*/
private String addUpSpecialDeduction;
/**
* 累计子女教育
*/
private String addUpChildEducation;
/**
* 累计继续教育
*/
private String addUpContinuingEducation;
/**
* 累计住房贷款利息
*/
private String addUpHousingLoanInterest;
/**
* 累计住房租金
*/
private String addUpHousingRent;
/**
* 累计赡养老人
*/
private String addUpSupportElderly;
/**
* 累计其他扣除
*/
private String addUpOther;
/**
* 减按计税比例
*/
private String lessTaxProportion;
/**
* 准允扣除的捐赠额
*/
private String allowedDonation;
/**
* 应纳税所得额
*/
private String taxableIncome;
/**
* 税率
*/
private String taxRate;
/**
* 速算扣除数
*/
private String quickDeductionFactor;
/**
* 应纳税款
*/
private String taxPayable;
/**
* 减免税额
*/
private String taxSavings;
/**
* 已扣缴税额
*/
private String taxWithheld;
/**
* 应补退税额
*/
private String refundedOrSupplementedTax;
/**
* 备注
*/
private String description;
}

View File

@ -0,0 +1,33 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
/**
* @description: 个税申报记录表单
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 9:40 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationFormDTO {
//薪资所属月")
private YearMonth salaryMonth;
//个税扣缴义务人id")
private Long taxAgentId;
//个税扣缴义务人名称")
private String taxAgentName;
//备注")
private String description;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
/**
* @description: 个税申报表信息
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/16/21 3:22 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationInfoDTO {
//薪资所属月")
private YearMonth salaryMonth;
//个税扣缴义务人id")
private Long taxAgentId;
//个税扣缴义务人名称")
private String taxAgentName;
}

View File

@ -0,0 +1,61 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @description: 个税申报表详情列表劳务报酬所得
* @author: xiajun
* @modified By: xiajun
* @date: 2022/3/11 10:05
* @version:v1.0
*/
@Data
@Accessors(chain = true)
public class TaxDeclarationLaborListDTO {
//主键id")
private Long id;
//人员id")
private Long employeeId;
//工号")
private String jobNum;
//姓名")
private String username;
//证件类型")
private String cardType;
//证件号码")
private String cardNum;
//"所得项目")
private String incomeItems;
//"劳务收入")
private String laborIncome;
//"劳务免税收入")
private String laborTaxFreeIncome;
//"商业健康保险")
private String commercialHealthInsurance;
//"税延养老保险")
private String taxDeferredEndowmentInsurance;
//"其他")
private String other;
//"准允扣除的捐赠额")
private String allowedDonation;
//"减免税额")
private String taxDeduction;
//备注")
private String description;
}

View File

@ -0,0 +1,52 @@
package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 个税申报记录列表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 9:31 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationListDTO {
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@TableTitle(title = "薪资所属月份", dataIndex = "salaryMonth", key = "salaryMonth")
private String salaryMonth;
@TableTitle(title = "个税扣缴义务人", dataIndex = "taxAgentId", key = "taxAgentId")
private Long taxAgentId;
@TableTitle(title = "个税扣缴义务人名称", dataIndex = "taxAgentName", key = "taxAgentName")
private String taxAgentName;
@TableTitle(title = "税款所属期", dataIndex = "taxCycle", key = "taxCycle")
private String taxCycle;
@TableTitle(title = "操作人id", dataIndex = "operateEmployeeId", key = "operateEmployeeId")
private Long operateEmployeeId;
@TableTitle(title = "操作人名称", dataIndex = "operateEmployeeName", key = "operateEmployeeName")
private String operateEmployeeName;
@JsonFormat(pattern = "yyyy-MM-dd")
@TableTitle(title = "操作时间", dataIndex = "operateTime", key = "operateTime")
private String operateTime;
@TableTitle(title = "备注", dataIndex = "description", key = "description")
private String description;
}

View File

@ -0,0 +1,91 @@
package com.engine.salary.entity.taxdeclaration.dto;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @description: 个税申报表详情列表正常工资薪金所得
* @author: xiajun
* @modified By: xiajun
* @date: 2022/3/11 9:35
* @version:v1.0
*/
@Data
@Accessors(chain = true)
public class TaxDeclarationWageListDTO {
//主键id")
private Long id;
//人员id")
private Long employeeId;
//"工号")
private String jobNum;
//"姓名")
private String username;
//证件类型")
private String cardType;
//证件号码")
private String cardNum;
//本期收入")
private String income;
//本期免税收入")
private String taxFreeIncome;
//"基本养老保险费")
private String endowmentInsurance;
//"基本医疗保险费")
private String medicalInsurance;
//失业保险费")
private String unemploymentInsurance;
//住房公积金")
private String housingProvidentFund;
//"累计子女教育")
private String addUpChildEducation;
//累计住房贷款利息")
private String addUpHousingLoanInterest;
//"累计住房租金")
private String addUpHousingRent;
//累计继续教育")
private String addUpContinuingEducation;
//"累计赡养老人")
private String addUpSupportElderly;
//"累计大病医疗")
private String addUpIllnessMedical;
//"企业(职业)年金")
private String annuity;
//商业健康保险")
private String commercialHealthInsurance;
//"税延养老保险")
private String taxDeferredEndowmentInsurance;
//"其他")
private String other;
//"准允扣除的捐赠额")
private String allowedDonation;
//"减免税额")
private String taxDeduction;
//"备注")
private String description;
}

View File

@ -0,0 +1,26 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* @description: 个税申报记录详情列表查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 3:21 PM
* @version:v1.0
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationDetailListQueryParam extends BaseQueryParam {
//"个税申报记录id")
private Long taxDeclarationId;
}

View File

@ -0,0 +1,30 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.*;
import java.time.YearMonth;
/**
* @description: 个税申报记录查询条件
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 9:30 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationListQueryParam extends BaseQueryParam {
//薪资所属月范围起点
private YearMonth fromSalaryMonth;
//薪资所属月范围终点
private YearMonth endSalaryMonth;
private String fromSalaryMonthStr;
private String endSalaryMonthStr;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.taxdeclaration.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.YearMonth;
/**
* @description: 生成个税申报表参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 9:44 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationSaveParam {
//薪资所属月")
private YearMonth salaryMonth;
//备注")
private String description;
private String salaryMonthStr;
}

View File

@ -0,0 +1,78 @@
package com.engine.salary.entity.taxdeclaration.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
/**
* @description: 个税申报表详情
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/14/21 7:01 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationDetailPO {
/**
* 主键id
*/
private Long id;
/**
* 个税申报记录id
*/
private Long taxDeclarationId;
/**
* 人员id
*/
private Long employeeId;
/**
* 申报表字段code
*/
private String fieldCode;
/**
* 申报表字段的值
*/
private String fieldValue;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 应税项目1:正常工资薪金所得
*/
private Integer incomeCategory;
}

View File

@ -0,0 +1,76 @@
package com.engine.salary.entity.taxdeclaration.po;
import com.engine.salary.common.LocalDateRange;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @description: 个税申报记录
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/14/21 6:57 PM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclarationPO {
/**
* 主键id
*/
private Long id;
/**
* 薪资所属月
*/
private Date salaryMonth;
/**
* 税款所属期
*/
private Date taxCycle;
/**
* 个税扣缴义务人id
*/
private Long taxAgentId;
/**
* 备注
*/
private String description;
/**
* 租户key
*/
private String tenantKey;
/**
* 创建人id
*/
private Long creator;
/**
* 是否删除
*/
private Integer deleteType;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
//税款所属期
LocalDateRange salaryMonths;
}

View File

@ -0,0 +1,78 @@
package com.engine.salary.entity.taxrate.vo;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 个税申报记录列表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 9:31 AM
* @version:v1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a4f85287-e3f9-4275-9527-7d06e54y6rj8",
fields = "id, salary_month, tax_cycle, tax_agent_id, description,creator, create_time, update_time, delete_type, tenant_key",
fromSql = "from hrsa_tax_declaration",
orderby = "id desc",
primarykey = "id",
operates = {@SalaryTableOperate(text = "查看")}
)
public class TaxDeclarationListVO {
private Long id;
@SalaryTableColumn(
text = "薪资所属月",
column = "salaryMonth",
width = "10%"
)
private String salaryMonth;
private Long taxAgentId;
/* @SalaryTableColumn(
text = "个税扣缴义务人",
column = "taxAgentName",
width = "20%"
)
private String taxAgentName;*/
@SalaryTableColumn(
text = "税款所属期",
column = "taxCycle",
width = "10%"
)
private String taxCycle;
private Long operateEmployeeId;
/* @SalaryTableColumn(
text = "操作人",
column = "operateEmployeeName",
width = "10%"
)
private String operateEmployeeName;
*/
/* @SalaryTableColumn(
text = "操作时间",
column = "operateTime",
width = "20%"
)
private String operateTime;*/
@SalaryTableColumn(
text = "备注",
column = "description",
width = "30%"
)
private String description;
}

View File

@ -15,6 +15,8 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
WAGES_AND_SALARIES(1, "正常工资薪金所得", 98656),
REMUNERATION_FOR_LABOR(4, "劳务报酬所得", 105218),
// 暂时注释掉后续会开放
// ONETIME_ANNUAL_BONUS(2,"全年一次性奖金收入", 0),
//

View File

@ -0,0 +1,18 @@
package com.engine.salary.mapper;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public interface InsuranceExportMapper {
List<AccountExportPO> exportAccount(@Param("paymentStatus") Integer paymentStatus, @Param("billMonth") String billMonth);
}

View File

@ -0,0 +1,34 @@
<?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.InsuranceExportMapper">
<select id="exportAccount" resultType="com.engine.salary.entity.siexport.po.AccountExportPO">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.`NAME` AS departmentName,e.`STATUS` AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
<select id="exportAccount" resultType="com.weaver.hrm.salary.entity.siexport.po.AccountExportPO" databaseId="oracle">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.NAME AS departmentName,e.STATUS AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
<select id="exportAccount" resultType="com.weaver.hrm.salary.entity.siexport.po.AccountExportPO" databaseId="sqlserver">
SELECT
a.*,e.username AS userName,e.MOBILE AS telephone,d.NAME AS departmentName,e.STATUS AS userStatus
FROM(
SELECT * from hrsa_bill_detail
WHERE delete_type = 0 AND bill_month = #{billMonth} AND payment_status = #{paymentStatus}
)a
LEFT JOIN {$publicdb}.employee e ON e.ID = a.employee_id
LEFT JOIN {$publicdb}.department d ON d.id = e.department
</select>
</mapper>

View File

@ -124,7 +124,8 @@
<select id="selectList" resultMap="BaseResultMap">
SELECT
t.employee_id,t.social_sum,t.fund_sum,t.other_sum
t.employee_id,t.social_sum,t.fund_sum,t.other_sum,t.fund_pay_org,t.social_pay_org,
t.other_pay_org
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0

View File

@ -1,8 +1,13 @@
package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@Mapper
@ -63,5 +68,38 @@ public interface TaxDeclarationDetailMapper {
* @return 返回影响行数
*/
int delete(TaxDeclarationDetail taxDeclarationDetail);
/**
* 批量插入
*
* @param taxDeclarationDetails
*/
void batchInsert(@Param("collection") Collection<TaxDeclarationDetailPO> taxDeclarationDetails);
/**
* 统计一共多少人员
*
* @param taxDeclarationId
* @param tenantKey
* @return
*/
int countEmployeeId(@Param("taxDeclarationId") Long taxDeclarationId);
/**
* 分页查询人员id
*
* @param page
* @param taxDeclarationId
* @param tenantKey
* @return
*/
PageInfo<Long> listEmployeeId(@Param("taxDeclarationId") Long taxDeclarationId);
/**
* 查询个税申报表明细
*
* @param page
* @param taxDeclarationId
* @param employeeIds
* @return
*/
List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds);
}

View File

@ -45,6 +45,32 @@
FROM hrsa_tax_declaration_detail t
WHERE id = #{id} AND delete_type = 0
</select>
<select id="countEmployeeId" resultType="int">
SELECT count(DISTINCT employee_id)
FROM hrsa_tax_declaration_detail
WHERE delete_type = 0
AND tax_declaration_id = #{taxDeclarationId}
</select>
<select id="listEmployeeId" resultType="long">
SELECT DISTINCT employee_id
FROM hrsa_tax_declaration_detail
WHERE delete_type = 0
AND tax_declaration_id = #{taxDeclarationId}
</select>
<select id="listByTaxDeclarationIdAndEmployeeIds"
resultType="com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_declaration_detail
WHERE delete_type = 0
AND tax_declaration_id = #{taxDeclarationId}
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail"
@ -148,6 +174,26 @@
</if>
</trim>
</insert>
<insert id="batchInsert">
INSERT INTO hrsa_tax_declaration_detail
(id, tax_declaration_id, employee_id, field_code, field_value, creator,
create_time, update_time, delete_type, tenant_key)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.taxDeclarationId},
#{item.employeeId},
#{item.fieldCode},
#{item.fieldValue},
#{item.creator},
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
)
</foreach>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail">

View File

@ -1,8 +1,11 @@
package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@Mapper
@ -63,5 +66,19 @@ public interface TaxDeclarationMapper {
* @return 返回影响行数
*/
int delete(TaxDeclaration taxDeclaration);
/**
* 条件查询
*
* @return 返回集合没有返回空List
*/
List<TaxDeclarationPO> listSome(TaxDeclarationPO taxDeclarationPO);
/**
* 批量插入
*
* @param taxDeclarationDetails
*/
void batchInsert(@Param("collection") Collection<TaxDeclarationPO> taxDeclarationDetails);
}

View File

@ -16,9 +16,7 @@
<!-- 表字段 -->
<sql id="baseColumns">
t
.
create_time
t.create_time
, t.creator
, t.delete_type
, t.description
@ -45,6 +43,41 @@
FROM hrsa_tax_declaration t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultType="com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_tax_declaration t
WHERE delete_type = 0
<if test="salaryMonths != null and salaryMonths.fromDate != null">
AND salary_month <![CDATA[ >= ]]> #{salaryMonths.fromDate}
</if>
<if test="salaryMonths != null and salaryMonths.endDate != null">
AND salary_month <![CDATA[ <= ]]> #{salaryMonths.endDate}
</if>
ORDER BY id DESC
</select>
<insert id="batchInsert">
INSERT INTO hrsa_tax_declaration
(create_time, creator, delete_type, description, id, salary_month,
tax_agent_id, tax_cycle, tenant_key, update_time)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.create_time},
#{item.creator},
#{item.delete_type},
#{item.description},
#{item.id},
#{item.salary_month},
#{item.tax_agent_id},
#{item.tax_cycle},
#{item.tenant_key},
#{item.update_time}
)
</foreach>
</insert>
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclaration"

View File

@ -1,7 +1,11 @@
package com.engine.salary.service;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Collection;
import java.util.List;
@ -148,5 +152,31 @@ public interface SIAccountService {
* @param param
*/
Map<String,Object> getInspectTable(InsuranceAccountDetailParam param);
/**
* 正常缴纳添加缴纳人员表单
* @param params
* @return
*/
Map<String,Object> getCommonForm(Map<String, Object> params);
/**
* 补缴添加缴纳人员表单
* @param params
* @return
*/
Map<String,Object> getSupplementaryForm(Map<String, Object> params);
/**
* 总览
* @param param
* @return
*/
PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam param);
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public interface SIExportService {
/**
* 总览导出
* @param param
* @return
*/
XSSFWorkbook exportOverView(InsuranceExportParam param);
/**
* 补缴核算导出
* @param paymentStatus
* @param param
* @return
*/
XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param);
}

View File

@ -26,4 +26,10 @@ public interface SISchemeService {
List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment);
Map<String, Object> listPage(Map<String, Object> params);
/**
* 获取当前租户下所有的方案id和方案名称的map
* @return Map
*/
Map<Long, String> getSchemeIdNameMap();
}

View File

@ -0,0 +1,74 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import java.util.Collection;
/**
* @description: 个税申报表明细
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/23/22 4:28 PM
* @version:v1.0
*/
public interface TaxDeclarationDetailService {
/**
* 根据个税申报表id人员id查询个税申报表明细
*
* @param taxDeclarationId 个税申报表id
* @param employeeIds 人员id
* @param tenantKey 租户key
* @return
*/
//List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds, String tenantKey);
/**
* 根据列表查询条件查询个税申报列表明细中的人员
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
//Page<Long> listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey);
/**
* 根据列表查询条件查询个税申报列表明细
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
PageInfo<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam);
/**
* 根据列表查询条件查询个税申报列表明细劳务报酬所得
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
PageInfo<TaxDeclarationLaborListDTO> listDtoPageByParam4Labor(TaxDeclarationDetailListQueryParam queryParam);
/**
* 根据列表查询条件查询个税申报列表明细正常工资薪金所得
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
PageInfo<TaxDeclarationWageListDTO> listDtoPageByParam4Wage(TaxDeclarationDetailListQueryParam queryParam);
/**
* 批量保存
*
* @param taxDeclarationDetailPOS 个税申报表明细po
*/
void batchSave(Collection<TaxDeclarationDetailPO> taxDeclarationDetailPOS);
}

View File

@ -0,0 +1,23 @@
package com.engine.salary.service;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
/**
* @description: 个税申报表导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/4/22 4:09 PM
* @version:v1.0
*/
public interface TaxDeclarationExcelService {
/**
* 导出个税申报表
*
* @param taxDeclarationId
* @param tenantKey
*/
XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId);
}

View File

@ -1,5 +1,14 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public interface TaxDeclarationService {
@ -9,7 +18,18 @@ public interface TaxDeclarationService {
*/
Map<String, Object> listPage(Map<String, Object> params);
Map<String, Object> save(Map<String, Object> params);
PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam);
List<TaxAgent> countByTaxDeclarationId(Collection<Long> taxAgentIds);
//表单
TaxDeclaration getById(Long id);
Map<String, Object> getForm(Map<String, Object> params);
Map<String, Object> getTaxDeclarationInfo(Map<String, Object> params);
void save(TaxDeclarationSaveParam saveParam);
Map<String, Object> update(Map<String, Object> params);

View File

@ -2,6 +2,7 @@ package com.engine.salary.service.impl;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.cloudstore.eccom.pc.table.*;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil;
@ -15,6 +16,7 @@ import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
@ -24,6 +26,7 @@ import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.InspectStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ProjectTypeEnum;
import com.engine.salary.mapper.datacollection.EmployMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
@ -40,6 +43,7 @@ import com.engine.salary.util.SalaryFormItemUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -186,7 +190,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//补缴缴纳列表
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
//PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceAccountDetailPO> list = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).list(queryParam);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
@ -499,5 +503,90 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return datas;
}
@Override
public Map<String, Object> getCommonForm(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>();
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
List<SearchConditionItem> conditionItem = new ArrayList<>();
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "对象", "require", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
apidatas.put("condition",addGroups);
return apidatas;
}
@Override
public Map<String, Object> getSupplementaryForm(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>();
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<SearchConditionItem> condition = new ArrayList<>();
List<SearchConditionItem> conditionItems = new ArrayList<>();
List<SearchConditionItem> conditionItem = new ArrayList<>();
SearchConditionItem billMonthList = SalaryFormItemUtil.datePickerItem(user, 2, 16, true, 2, "账单月份", "billMonth");
billMonthList.setMultiple(true);
billMonthList.getOtherParams().put("type", "months");
billMonthList.getOtherParams().put("format", "YYYY-MM");
billMonthList.getOtherParams().put("showFormat", "YYYY-MM");
billMonthList.setMultiple(true);
condition.add(billMonthList);
SearchConditionItem billProjects = SalaryFormItemUtil.checkboxItem(user,18,6,3,true,"补缴项目","projects");
billProjects.setOptions(buildBillProjectsOptions());
billMonthList.setMultiple(false);
condition.add(billProjects);
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 3, true, "对象", "require", "17", "includes");
conditionItems.add(includes);
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "require", "17", "excludes");
conditionItem.add(excludes);
addGroups.add(new SearchConditionGroup("基础信息",true,condition));
addGroups.add(new SearchConditionGroup("人员范围",true,conditionItems));
addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
apidatas.put("condition",addGroups);
return apidatas;
}
@Override
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageInfo<InsuranceAccountViewListDTO> pageInfos = siAccountBiz.overView(queryParam);
pageInfos.setPageNum(queryParam.getCurrent());
pageInfos.setPageSize(queryParam.getPageSize());
return pageInfos;
}
public List<SearchConditionOption> buildBillProjectsOptions() {
List<SearchConditionOption> options = new ArrayList<>();
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ALL.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.ALL.getLabelId(), ProjectTypeEnum.ALL.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.SOCIAL.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.SOCIAL.getLabelId(), ProjectTypeEnum.SOCIAL.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.FUND.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.FUND.getLabelId(), ProjectTypeEnum.FUND.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.OTHER.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.OTHER.getLabelId(), ProjectTypeEnum.OTHER.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.ENDOWMENT_INSURANCE.getLabelId(), ProjectTypeEnum.ENDOWMENT_INSURANCE.getDefaultLabel())));
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()),
SalaryI18nUtil.getI18nLabel( ProjectTypeEnum.MEDICAL_INSURANCE.getLabelId(), ProjectTypeEnum.MEDICAL_INSURANCE.getDefaultLabel())));
return options;
}
}

View File

@ -0,0 +1,474 @@
package com.engine.salary.service.impl;
import com.alibaba.fastjson.JSON;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SIAccountBiz;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.entity.siexport.po.AccountExportPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.siaccount.BillStatusEnum;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.enums.siaccount.ResourceFromEnum;
import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.mapper.InsuranceExportMapper;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.SIExportService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.SalaryAssert;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import com.engine.common.util.ServiceUtil;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIExportServiceImpl extends Service implements SIExportService {
private SIAccountBiz siAccountBiz = new SIAccountBiz();
private SISchemeService getSISchemeService(User user) {
return ServiceUtil.getService(SISchemeServiceImpl.class,user);
}
@Override
public XSSFWorkbook exportOverView(InsuranceExportParam queryParam) {
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap);
List<List<Object>> excelSheetData = new ArrayList<>();
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
// 2.表头
String[] header = {
SalaryI18nUtil.getI18nLabel( 93270, "缴纳组织"),
SalaryI18nUtil.getI18nLabel( 93272, "社保人数"),
SalaryI18nUtil.getI18nLabel( 93273, "公积金人数"),
SalaryI18nUtil.getI18nLabel( 93274, "其他福利人数"),
SalaryI18nUtil.getI18nLabel( 93275, "社保缴费合计"),
SalaryI18nUtil.getI18nLabel( 93276, "公积金缴费合计"),
SalaryI18nUtil.getI18nLabel( 93277, "其他福利缴费合计"),
SalaryI18nUtil.getI18nLabel( 93278, "合计")};
excelSheetData.add(Collections.singletonList(header));
//工作簿数据
List<List<Object>> rows = new LinkedList<>();
for (InsuranceAccountViewListDTO dto : insuranceAccountViewListDTOS) {
List<Object> row = new LinkedList<>();
row.add(dto.getPayOrg());
row.add(dto.getSocialNum());
row.add(dto.getFundNum());
row.add(dto.getOtherNum());
row.add(dto.getSocialPaySum());
row.add(dto.getFundPaySum());
row.add(dto.getOtherPaySum());
row.add(dto.getSum());
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
@Override
public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) {
List<AccountExportPO> accountExportPOS = MapperProxyFactory.getProxy(InsuranceExportMapper.class).exportAccount(paymentStatus, param.getBillMonth());
List<WeaTableColumn> columns = new ArrayList<>();
List<Map<String, Object>> records = new ArrayList<>();
if (PaymentStatusEnum.COMMON.getValue() == paymentStatus) {
columns = buildCommonColumns(accountExportPOS, false);
}
if (PaymentStatusEnum.REPAIR.getValue() == paymentStatus) {
columns = buildCommonColumns(accountExportPOS, true);
}
records = buildCommonRecords(accountExportPOS);
List<List<Object>> excelSheetData = new ArrayList<>();
//工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案"); //表头
excelSheetData.add(Collections.singletonList(columns.stream().map(item -> item.getText()).toArray(String[]::new)));
//工作簿数据
List<List<Object>> rows = new LinkedList<>();
for (Map<String, Object> recordData : records) {
List<Object> row = new LinkedList<>();
for (WeaTableColumn column : columns) {
row.add(recordData.get(column.getColumn()));
}
rows.add(row);
}
excelSheetData.addAll(rows);
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
}
private List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
List<Map<String, Object>> result = new ArrayList<>();
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
Map<Long, String> schemeIdNameMap = getSISchemeService(user).getSchemeIdNameMap();
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
list.forEach(item -> {
Map<String, Object> record = new HashMap<>();
record.put("billMonth", item.getBillMonth());
record.put("billStatus", SalaryEnumUtil.enumMatchByValue(item.getBillStatus(), BillStatusEnum.values(), BillStatusEnum.class));
record.put("userName", item.getUserName());
record.put("department", item.getDepartmentName());
record.put("supplementaryMonth", item.getSupplementaryMonth());
record.put("mobile", item.getTelephone());
record.put("employeeStatus", item.getUserStatus() == null ? "" : item.getUserStatus().getDescription());
ResourceFromEnum from = SalaryEnumUtil.enumMatchByValue(item.getResourceFrom(), ResourceFromEnum.values(), ResourceFromEnum.class);
record.put("sourceFrom", SalaryI18nUtil.getI18nLabel( from.getLabelId(), from.getDefaultLabel()));
record.put("socialPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
record.put("socialAccount", item.getSocialAccount());
record.put("socialSchemeName", schemeIdNameMap.get(item.getSocialSchemeId()));
if (StringUtils.isNotEmpty(item.getSocialPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialBase", v);
});
}
record.put("fundPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
record.put("fundAccount", item.getFundAccount());
record.put("fundSchemeName", schemeIdNameMap.get(item.getFundSchemeId()));
record.put("supplementFundAccount", item.getSupplementFundAccount());
if (StringUtils.isNotEmpty(item.getFundPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "fundBase", v);
});
}
record.put("otherPayOrg", paymentMap.get(item.getOtherPayOrg()) == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName());
record.put("otherSchemeName", schemeIdNameMap.get(item.getOtherSchemeId()));
if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) {
Map<String, Object> socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "otherBase", v);
});
}
if (StringUtils.isNotEmpty(item.getSocialPerJson())) {
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, Object>().getClass());
socialJson.forEach((k, v) -> {
record.put(k + "socialPer", v);
});
}
record.put("socialPerSum", item.getSocialPerSum());
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "fundPer", v);
});
}
record.put("fundPerSum", item.getFundPerSum());
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "otherPer", v);
});
}
record.put("otherPerSum", item.getOtherPerSum());
record.put("perSum", item.getPerSum());
if (StringUtils.isNotEmpty(item.getSocialComJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "socialCom", v);
});
}
record.put("socialComSum", item.getSocialComSum());
if (StringUtils.isNotEmpty(item.getFundComJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "fundCom", v);
});
}
record.put("fundComSum", item.getFundComSum());
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
fundPerJson.forEach((k, v) -> {
record.put(k + "otherCom", v);
});
}
record.put("otherComSum", item.getOtherComSum());
record.put("comSum", item.getComSum());
record.put("socialSum", item.getSocialSum());
record.put("fundSum", item.getFundSum());
record.put("otherSum", item.getOtherSum());
record.put("total", item.getTotal());
result.add(record);
});
return result;
}
private Map<Integer, Map<String, String>> buildComTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialComJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundComJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherComJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(
categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "socialCom");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "fundCom");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100289, "单位"),
social + "otherCom");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
private Map<Integer, Map<String, String>> buildPersonalTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundPerJson())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "socialPer");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "fundPer");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 87159, "个人"),
social + "otherPer");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
private List<WeaTableColumn> buildCommonColumns(List<AccountExportPO> pos, boolean flag) {
List<WeaTableColumn> list = new ArrayList<>();
Map<String, String> categoryIdNameMap = categoryIdNameMap();
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap);
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap);
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86185, "部门"), "department"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86186, "手机号"), "mobile"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 86187, "员工状态"), "employeeStatus"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100377, "数据来源"), "sourceFrom"));
if (flag) {
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100379, "补缴月份"), "supplementaryMonth"));
}
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91325, "社保缴纳组织"), "socialPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91324, "社保账号"), "socialAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91323, "社保方案名称"), "socialSchemeName"));
//组装社保基数
columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91488, "公积金缴纳组织"), "fundPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91486, "公积金账号"), "fundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91485, "公积金方案名称"), "fundSchemeName"));
//组装公积金基数
columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91487, "补充公积金账号"), "supplementFundAccount"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91497, "其他福利缴纳组织"), "otherPayOrg"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 91496, "其他福利方案名称"), "otherSchemeName"));
columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
personColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100388, "社保个人合计"), "socialPerSum"));
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100390, "公积金个人合计"), "fundPerSum"));
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100392, "其他福利个人合计"), "otherPerSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100393, "个人合计"), "perSum"));
comColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100394, "社保单位合计"), "socialComSum"));
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100395, "公积金单位合计"), "fundComSum"));
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
list.add(new WeaTableColumn("150px",k, v));
});
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100396, "其他福利单位合计"), "fundComSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100397, "单位合计"), "comSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100398, "社保合计"), "socialSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100399, "公积金合计"), "fundSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 100400, "其他福利合计"), "otherSum"));
list.add(new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 93278, "合计"), "total"));
return list;
}
private Map<String, String> categoryIdNameMap() {
//系统福利类型
Map<Long, String> systemMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listByDataType(DataTypeEnum.SYSTEM.getValue()).stream()
.collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
Map<Long, String> customMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll()
.stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
HashMap<Long, String> total = new HashMap<>();
if (MapUtils.isNotEmpty(systemMap)) {
total.putAll(systemMap);
}
if (MapUtils.isNotEmpty(customMap)) {
total.putAll(customMap);
}
HashMap<String, String> result = new HashMap<>();
total.forEach((k, v) -> {
result.put(String.valueOf(k), v);
});
return result;
}
private Map<Integer, Map<String, String>> buildPaymentTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
Set<String> socailIds = new HashSet<>();
Set<String> fundIds = new HashSet<>();
Set<String> otherIds = new HashSet<>();
Map<Integer, Map<String, String>> result = new HashMap<>();
pos.stream().forEach(item -> {
if (StringUtils.isNotBlank(item.getSocialPaymentBaseString())) {
Map<String, String> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
socialJson.forEach((k, v) -> {
socailIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getFundPaymentBaseString())) {
Map<String, String> fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
fundJson.forEach((k, v) -> {
fundIds.add(k);
});
}
if (StringUtils.isNotBlank(item.getOtherPaymentBaseString())) {
Map<String, String> otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
otherJson.forEach((k, v) -> {
otherIds.add(k);
});
}
});
Map<String, String> socialColumns = new HashMap<>();
Map<String, String> fundColumns = new HashMap<>();
Map<String, String> otherColumns = new HashMap<>();
socailIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "socialBase");
}
});
fundIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "fundBase");
}
});
otherIds.stream().forEach(social -> {
if (categoryIdNameMap.containsKey(social)) {
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel( 100293, "申报基数"), social + "otherBase");
}
});
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
return result;
}
}

View File

@ -4,10 +4,16 @@ import com.engine.core.impl.Service;
import com.engine.salary.biz.SISchemeBiz;
import com.engine.salary.cmd.sischeme.*;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
@ -51,4 +57,14 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
public Map<String, Object> listPage(Map<String, Object> params) {
return commandExecutor.execute(new SISchemeListCmd(params,user));
}
@Override
public Map<Long, String> getSchemeIdNameMap() {
Map<Long, String> result = new HashMap<>();
List<InsuranceSchemePO> insuranceSchemePOS = MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).listAll();
if (CollectionUtils.isNotEmpty(insuranceSchemePOS)) {
result = insuranceSchemePOS.stream().collect(Collectors.toMap(InsuranceSchemePO::getId, InsuranceSchemePO::getSchemeName));
}
return result;
}
}

View File

@ -0,0 +1,117 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.TaxDeclarationDetailService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import com.mzlion.core.lang.CollectionUtils;
import weaver.hrm.User;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tenantKey;
/**
* @description: 个税申报表明细
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/23/22 4:29 PM
* @version:v1.0
*/
public class TaxDeclarationDetailServiceImpl extends Service implements TaxDeclarationDetailService {
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper(User user) {
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService() {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
/*@Override
public List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds, String tenantKey) {
if (CollectionUtils.isEmpty(employeeIds)) {
return Collections.emptyList();
}
return new LambdaQueryChainWrapper<>(taxDeclarationDetailMapper)
.eq(TaxDeclarationDetailPO::getTenantKey, tenantKey)
.eq(TaxDeclarationDetailPO::getDeleteType, 0)
.eq(TaxDeclarationDetailPO::getTaxDeclarationId, taxDeclarationId)
.in(TaxDeclarationDetailPO::getEmployeeId, employeeIds)
.list();
}
@Override
public Page<Long> listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey) {
// 分页参数
Page<Long> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// 查询个税申报表明细中的人员分页
return taxDeclarationDetailMapper.listEmployeeId(page, queryParam.getTaxDeclarationId(), tenantKey);
}
*/
@Override
public PageInfo<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam) {
// 查询个税申报表明细的人员
PageInfo<Long> employeeIdPage = getTaxDeclarationDetailMapper(user).listEmployeeId(queryParam.getTaxDeclarationId());
PageInfo<TaxDeclarationDetailListDTO> dtoPage = new PageInfo<TaxDeclarationDetailListDTO>(TaxDeclarationDetailListDTO.class);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
List<Long> list = employeeIdPage.getList();
if (CollectionUtils.isNotEmpty(list)) {
// 查询个税申报表明细
List<TaxDeclarationDetailPO> taxDeclarationDetailPOS = listByTaxDeclarationIdAndEmployeeIds(queryParam.getTaxDeclarationId(), employeeIdPage.getList());
// 查询人员
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService().listByIds(employeeIdPage.getList());
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIdPage.getRecords(), tenantKey);
// 转换成列表dto
TaxDeclarationBO.buildDetailListDTO(queryParam.getTaxDeclarationId(), dtoPage, taxDeclarationDetailPOS, simpleEmployees);
}
return dtoPage;
}
@Override
public PageInfo<TaxDeclarationLaborListDTO> listDtoPageByParam4Labor(TaxDeclarationDetailListQueryParam queryParam) {
return null;
}
@Override
public PageInfo<TaxDeclarationWageListDTO> listDtoPageByParam4Wage(TaxDeclarationDetailListQueryParam queryParam) {
return null;
}
@Override
public void batchSave(Collection<TaxDeclarationDetailPO> taxDeclarationDetailPOS) {
getTaxDeclarationDetailMapper(user).batchInsert(taxDeclarationDetailPOS);
}
public List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds) {
if (CollectionUtils.isEmpty(employeeIds)) {
return Collections.emptyList();
}
// return new LambdaQueryChainWrapper<>(taxDeclarationDetailMapper)
// .eq(TaxDeclarationDetailPO::getTenantKey, tenantKey)
// .eq(TaxDeclarationDetailPO::getDeleteType, 0)
// .eq(TaxDeclarationDetailPO::getTaxDeclarationId, taxDeclarationId)
// .in(TaxDeclarationDetailPO::getEmployeeId, employeeIds)
// .list();
return getTaxDeclarationDetailMapper(user).listByTaxDeclarationIdAndEmployeeIds(taxDeclarationId,employeeIds);
}
}

View File

@ -0,0 +1,78 @@
package com.engine.salary.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailListColumn;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.TaxDeclarationDetailService;
import com.engine.salary.service.TaxDeclarationExcelService;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.time.LocalDateTime;
import java.util.*;
/**
* @description: 个税申报表导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/4/22 4:17 PM
* @version:v1.0
*/
@Slf4j
public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclarationExcelService {
private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) {
return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user);
}
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper(User user) {
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
}
@Override
public XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId) {
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "个税申报表");
//表头字段
String[] headers = TaxDeclarationDetailListColumn.listHeader();
// 解析表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationDetailListColumn.listTableColumn();
List<Object> headerList = new ArrayList<>(Arrays.asList(headers));
// 查询当前个税申报表一共有多少人员
int count = getTaxDeclarationDetailMapper(user).countEmployeeId(taxDeclarationId);
// 以1000个人员一页一共有多少页
int totalPages = (count % 1000 == 0) ? (count / 1000) : (count / 1000 + 1); //总页数
// excel导出的数据
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(count);
rows.add(headerList);
for (int i = 0; i < totalPages; i++) {
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam().setTaxDeclarationId(taxDeclarationId);
queryParam.setCurrent(i);
queryParam.setPageSize(1000);
PageInfo<TaxDeclarationDetailListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam(queryParam);
for (Object taxDeclarationDetailListDTO : dtoPage.getList()) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationDetailListDTO, Object.class);
for (Object weaTableColumn : headerList) {
row.add(map.get(weaTableColumn));
}
rows.add(row);
}
}
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
}

View File

@ -1,24 +1,96 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationDeleteCmd;
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationListCmd;
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationSaveCmd;
import com.engine.salary.cmd.taxDeclaration.TaxDeclarationUpdateCmd;
import com.engine.salary.cmd.taxDeclaration.*;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.entity.taxrate.param.TaxAgentQueryParam;
import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import java.util.Map;
import java.util.*;
public class TaxDeclarationServiceImpl extends Service implements TaxDeclarationService {
private TaxDeclarationMapper getTaxDeclarationMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationMapper.class);
}
@Override
public Map<String, Object> listPage(Map<String, Object> params) {
return commandExecutor.execute(new TaxDeclarationListCmd(params, user));
}
@Override
public Map<String, Object> save(Map<String, Object> params) {
return commandExecutor.execute(new TaxDeclarationSaveCmd(params, user));
public PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam) {
// 分页参数
TaxDeclarationPO po = TaxDeclarationPO.builder().build();
PageInfo<TaxDeclarationPO> page = new PageInfo<>();
LocalDateRange localDateRange = new LocalDateRange();
if (Objects.nonNull(queryParam.getFromSalaryMonth())) {
localDateRange.setFromDate(SalaryDateUtil.localDateToDate(queryParam.getFromSalaryMonth().atDay(1)));
}
if (Objects.nonNull(queryParam.getEndSalaryMonth())) {
localDateRange.setEndDate(SalaryDateUtil.localDateToDate(queryParam.getEndSalaryMonth().atEndOfMonth()));
}
po.setSalaryMonths(localDateRange);
//Page<TaxDeclarationPO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// if (SalaryEntityUtil.isNotNullOrEmpty(queryParam.getFromSalaryMonth())&&SalaryEntityUtil.isNotNullOrEmpty(queryParam.getEndSalaryMonth()) ) {
// // taxDeclarationMapper.selectPage(page, queryWrapper)
// }
// 查询个税申报表
PageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<TaxDeclarationPO> taxDeclarationPOS = getTaxDeclarationMapper().listSome(po);
page.setList(taxDeclarationPOS);
return page;
}
//根据id查询taxAgents
@Override
public List<TaxAgent> countByTaxDeclarationId(Collection<Long> taxAgentIds) {
if (CollectionUtils.isEmpty(taxAgentIds)) {
return Collections.emptyList();
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
TaxAgentMapper taxAgentMapper = sqlSession.getMapper(TaxAgentMapper.class);
return taxAgentMapper.listBySome(TaxAgentQueryParam.builder().ids(taxAgentIds).build());
} finally {
sqlSession.close();
}
}
//根据id获取TaxDeclaration
@Override
public TaxDeclaration getById(Long id) {
return getTaxDeclarationMapper().getById(id);
}
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
return commandExecutor.execute(new TaxDeclarationGetFormCmd(params, user));
}
@Override
public Map<String, Object> getTaxDeclarationInfo(Map<String, Object> params) {
return commandExecutor.execute(new TaxDeclarationGetTaxDeclarationInfoCmd(params, user));
}
@Override
public void save(TaxDeclarationSaveParam saveParam) {
//return commandExecutor.execute(new TaxDeclarationSaveCmd(saveParam));
return;
}
@Override

View File

@ -165,6 +165,12 @@ public class SalaryDateUtil {
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
if (null == localDateTime) {
return null;
}
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}
public static String getFormatLocalDate(Date date) {
if (date == null) {
@ -395,5 +401,18 @@ public class SalaryDateUtil {
return yearMonth.atEndOfMonth();
}
/**
* String转Date
* @param date
* @return
*/
public static Date stringToDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date parse = null;
if (date != null) {
parse = sdf.parse(date);
}
return parse;
}
}

View File

@ -43,6 +43,30 @@ public class SalaryFormItemUtil {
}
/**
* checkbox
* @param user
* @param colSpan
* @param fieldcol
* @param viewAttr
* @param isQuickSearch
* @param label
* @param name
* @return
*/
public static SearchConditionItem checkboxItem(User user, int colSpan, int fieldcol,
int viewAttr, boolean isQuickSearch, String label,String name) {
ConditionFactory conditionFactory = new ConditionFactory(user);
SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX,502327,name);
checkbox.setColSpan(colSpan);
checkbox.setFieldcol(fieldcol);
checkbox.setViewAttr(viewAttr);
checkbox.setIsQuickSearch(isQuickSearch);
checkbox.setLabel(label);
return checkbox;
}
/**
* 输入框数字
* @param user

View File

@ -3,9 +3,12 @@ package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
import com.engine.salary.entity.siaccount.param.*;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SIAccountWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.HrmUserVarify;
@ -17,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -33,6 +37,9 @@ public class SIAccountController {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
public SIAccountWrapper getSIAccountWrapper(User user) {
return ServiceUtil.getService(SIAccountWrapper.class,user);
}
/**
* 获取台账列表页
*
@ -193,12 +200,14 @@ public class SIAccountController {
}
// @GetMapping("commonForm")
// @ApiOperation("正常缴纳添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> queryCommonForm() {
// return siAccountWrapper.getCommonForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@GET
@Path("/commonForm")
@Produces(MediaType.APPLICATION_JSON)
public String queryCommonForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::getCommonForm, ParamUtil.request2Map(request));
}
@POST
@Path("/common/save")
@ -210,12 +219,13 @@ public class SIAccountController {
}
// @GetMapping("querySupplementaryForm")
// @ApiOperation("补缴添加缴纳人员表单")
// @WeaPermission
// public WeaResult<WeaForm> querySupplementaryForm() {
// return siAccountWrapper.getSupplementaryForm(UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
@GET
@Path("/querySupplementaryForm")
@Produces(MediaType.APPLICATION_JSON)
public String querySupplementaryForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::getSupplementaryForm, ParamUtil.request2Map(request));
}
@POST
@ -267,13 +277,15 @@ public class SIAccountController {
}
// @GetMapping("overView")
// @ApiOperation("总览")
// @WeaPermission
// public WeaResult<WeaTable<InsuranceAccountViewListDTO>> overView(@RequestParam(value = "billMonth") String billMonth) {
// return siAccountWrapper.overView(billMonth, UserContext.getCurrentUser().getEmployeeId(), TenantContext.getCurrentTenantKey());
// }
//
@GET
@Path("/overView")
@Produces(MediaType.APPLICATION_JSON)
public String overView(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<InsuranceAccountDetailParam, PageInfo<InsuranceAccountViewListDTO>>().run(getService(user)::overView, insuranceAccountDetailParam);
}
@GET
@Path("/tabList")
@ -334,4 +346,5 @@ public class SIAccountController {
return new ResponseResult<String, Map<String, Boolean>>().run(getService(user)::buttonCheck, billMonth);
}
}

View File

@ -0,0 +1,112 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
import com.engine.salary.service.SIAccountService;
import com.engine.salary.service.impl.SIAccountServiceImpl;
import com.engine.salary.wrapper.SIAccountWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.time.LocalDate;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIExportController {
public SIAccountService getService(User user) {
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
}
public SIAccountWrapper getSIAccountWrapper(User user) {
return ServiceUtil.getService(SIAccountWrapper.class,user);
}
@POST
@Path("/common/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportAccount(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIAccountWrapper(user).exportAccount(PaymentStatusEnum.COMMON.getValue(),param);
String time = LocalDate.now().toString();
String fileName = "正常缴纳核算报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/supplementary/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSupplementary(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIAccountWrapper(user).exportAccount(PaymentStatusEnum.REPAIR.getValue(),param);
String time = LocalDate.now().toString();
String fileName = "补缴核算报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
@POST
@Path("/overView/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportOverView(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody InsuranceExportParam param) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getSIAccountWrapper(user).exportOverView(param);
String time = LocalDate.now().toString();
String fileName = "总览报表" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
}

View File

@ -1,54 +1,121 @@
package com.engine.salary.web;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationFormDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationInfoDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.service.TaxDeclarationExcelService;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.service.impl.TaxDeclarationExcelServiceImpl;
import com.engine.salary.service.impl.TaxDeclarationServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.TaxDeclarationWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
public class TaxDeclarationController {
// @PostMapping("/list")
// @ApiOperation("个税申报表列表")
// @WeaPermission
// public WeaResult<WeaTable<TaxDeclarationListDTO>> listTaxDeclaration(@RequestBody TaxDeclarationListQueryParam queryParam) {
// WeaTable<TaxDeclarationListDTO> weaTable = taxDeclarationWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @GetMapping("/getForm")
// @ApiOperation("个税申报表表单")
// @WeaPermission
// public WeaResult<WeaForm> getForm(@RequestParam(value = "id", required = false) Long id) {
// WeaForm weaForm = taxDeclarationWrapper.getForm(id, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaForm);
// }
//
// @GetMapping("/getTaxDeclarationInfo")
// @ApiOperation("个税申报表相关信息")
// @WeaPermission
// public WeaResult<TaxDeclarationInfoDTO> getTaxDeclarationInfo(@RequestParam(value = "taxDeclarationId") Long taxDeclarationId) {
// TaxDeclarationInfoDTO taxDeclarationInfo = taxDeclarationWrapper.getTaxDeclarationInfoById(taxDeclarationId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(taxDeclarationInfo);
// }
//
// @PostMapping("/save")
// @ApiOperation("个税申报表生成")
// @WeaPermission
// public WeaResult<Object> saveTaxDeclaration(@RequestBody TaxDeclarationSaveParam saveParam) {
// taxDeclarationWrapper.save(saveParam, UserContext.getCurrentEmployeeId(), TenantContext.getCurrentTenantKey());
// return WeaResult.success(null);
// }
//
// @PostMapping("/detail/list")
// @ApiOperation("个税申报表详情列表")
// @WeaPermission
// public WeaResult<WeaTable<TaxDeclarationDetailListDTO>> listTaxDeclarationDetail(@RequestBody TaxDeclarationDetailListQueryParam queryParam) {
// WeaTable<TaxDeclarationDetailListDTO> weaTable = taxDeclarationDetailWrapper.listPage(queryParam, TenantContext.getCurrentTenantKey());
// return WeaResult.success(weaTable);
// }
//
// @PostMapping("/export")
// @ApiOperation("个税申报表相关信息")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportTaxDeclaration(@RequestParam(value = "taxDeclarationId") Long taxDeclarationId) {
// Map<String, Object> map = taxDeclarationExcelService.exportTaxDeclaration(taxDeclarationId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(map);
// }
// private BaseBean logger = new BaseBean();
private TaxDeclarationService getService(User user) {
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
private TaxDeclarationWrapper getTaxDeclarationWrapper(User user) {
return ServiceUtil.getService(TaxDeclarationWrapper.class, user);
}
private TaxDeclarationExcelService getTaxDeclarationExcelService(User user) {
return (TaxDeclarationExcelService)ServiceUtil.getService(TaxDeclarationExcelServiceImpl.class, user);
}
/* private TaxDeclarationDetailWrapper getTaxDeclarationDetailWrapper(User user) {
return ServiceUtil.getService(TaxDeclarationDetailWrapper.class, user);
}*/
//个税申报表列表
@POST
@Path("/listPage")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException {
User user = HrmUserVarify.getUser(request, response);
queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr()==null?"":queryParam.getFromSalaryMonthStr()));
queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr()==null?"":queryParam.getEndSalaryMonthStr()));
return new ResponseResult<TaxDeclarationListQueryParam, PageInfo<TaxDeclarationListDTO>>().run(getTaxDeclarationWrapper(user)::listPage, queryParam);
}
//个税申报表表单
@GET
@Path("/getForm")
@Produces(MediaType.APPLICATION_JSON)
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, TaxDeclarationFormDTO>().run(getTaxDeclarationWrapper(user)::getForm, id);
}
//个税申报表相关信息
@GET
@Path("/getTaxDeclarationInfo")
@Produces(MediaType.APPLICATION_JSON)
public String getTaxDeclarationInfo(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, TaxDeclarationInfoDTO>().run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId);
}
//个税申报表生成
@POST
@Path("/save")
@Produces(MediaType.APPLICATION_JSON)
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
return new ResponseResult<TaxDeclarationSaveParam, Long>().run(getTaxDeclarationWrapper(user)::save, param);
}
//个税申报表详情列表
/* @GET
@Path("/detail/list")
@Produces(MediaType.APPLICATION_JSON)
public String listTaxDeclarationDetail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationDetailListQueryParam param) {
User user = HrmUserVerify.getUser(request, response);
return new ResponseResult<TaxDeclarationDetailListQueryParam, Long>().run(getTaxDeclarationDetailWrapper(user)::listPage, param);
}*/
//个税申报表相关信息
@GET
@Path("/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getTaxDeclarationExcelService(user).exportTaxDeclaration(taxDeclarationId);
String fileName = "个税申报表";
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
import com.engine.salary.service.SIExportService;
import com.engine.salary.service.impl.SIExportServiceImpl;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/18
* @Version V1.0
**/
public class SIAccountWrapper extends Service {
public SIExportService getSIExportService(User user) {
return ServiceUtil.getService(SIExportServiceImpl.class, user);
}
public XSSFWorkbook exportOverView(InsuranceExportParam param) {
return getSIExportService(user).exportOverView(param);
}
public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) {
return getSIExportService(user).exportAccount(paymentStatus,param);
}
}

View File

@ -0,0 +1,66 @@
/*
package com.engine.salary.wrapper;
import com.engine.core.impl.Service;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.service.TaxDeclarationDetailService;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.util.page.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
*/
/**
* @description: 个税申报表明细
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/23/22 6:07 PM
* @version:v1.0
*//*
@Slf4j
@Component
public class TaxDeclarationDetailWrapper extends Service {
@Resource
private TaxDeclarationService taxDeclarationService;
@Resource
private TaxDeclarationDetailService taxDeclarationDetailService;
*/
/**
* 个税申报表明细列表
*
* @param queryParam 列表查询条件
* @return
*//*
public PageInfo listPage(TaxDeclarationDetailListQueryParam queryParam) {
TaxDeclaration taxDeclaration = taxDeclarationService.getById(queryParam.getTaxDeclarationId());
PageInfo<TaxDeclarationDetailListDTO> dtoPage = new PageInfo<TaxDeclarationDetailListDTO>(TaxDeclarationDetailListDTO.class);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
// 正常工资薪金所得
if (Objects.equals(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())) {
PageInfo<TaxDeclarationWageListDTO> taxDeclarationWageListDTOPageInfo = taxDeclarationDetailService.listDtoPageByParam4Wage(queryParam);
dtoPage.setList(taxDeclarationWageListDTOPageInfo.getList());
//weaTable = SalaryFormatUtil.<TaxDeclarationWageListDTO>getInstance().buildTable(TaxDeclarationWageListDTO.class, dtoPage);
}
// 劳务报酬所得
if (Objects.equals(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.REMUNERATION_FOR_LABOR.getValue())) {
PageInfo<TaxDeclarationLaborListDTO> taxDeclarationLaborListDTOPageInfo = taxDeclarationDetailService.listDtoPageByParam4Labor(queryParam);
dtoPage.setList(taxDeclarationLaborListDTOPageInfo.getList());
//weaTable = SalaryFormatUtil.<TaxDeclarationLaborListDTO>getInstance().buildTable(TaxDeclarationLaborListDTO.class, dtoPage);
}
return dtoPage;
}
}
*/

View File

@ -0,0 +1,290 @@
package com.engine.salary.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.SalaryItemBiz;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.common.LocalDateRange;
import com.engine.salary.component.WeaFormOption;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxdeclaration.TaxDeclaration;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationFormDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationInfoDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.*;
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.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.j2objc.annotations.AutoreleasePool;
import com.weaverboot.frame.ioc.anno.fieldAnno.WeaAutowired;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import weaver.hrm.User;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description: 个税申报表
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/23/22 5:50 PM
* @version:v1.0
*/
@Component
public class TaxDeclarationWrapper extends Service {
public TaxDeclarationWrapper() {
}
private TaxDeclarationService getTaxDeclarationService(User user) {
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
private TaxAgentService getTaxAgentService(User user) {
return (TaxAgentService) ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private TaxDeclarationMapper getTaxDeclarationMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationMapper.class);
}
private SalaryAcctRecordMapper getSalaryAcctRecordMapper() {
return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class);
}
// @Resource
private TaxAgentBiz taxAgentBiz = new TaxAgentBiz();
@Resource
private SalaryItemBiz salaryItemBiz;
@WeaAutowired
private TaxDeclarationDetailService taxDeclarationDetailService;
@Resource
private SalaryAcctResultService salaryAcctResultService;
@Resource
private SalaryAcctRecordService salaryAcctRecordService;
@Resource
private AddUpSituationMapper addUpSituationMapper;
@Resource
private TaxDeclarationMapper taxDeclarationMapper;
@Resource
private SalarySobService salarySobService;
/**
* 个税申报表列表
*
* @param queryParam 列表查询条件
* @param
* @return
*/
public PageInfo listPage(TaxDeclarationListQueryParam queryParam) {
EmployBiz employBiz = new EmployBiz();
// 询个税申报表分页
PageInfo<TaxDeclarationPO> page = getTaxDeclarationService(user).listPageByParam(queryParam);
PageInfo<TaxDeclarationListDTO> dtoPage = new PageInfo<TaxDeclarationListDTO>(TaxDeclarationListDTO.class);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
List<TaxDeclarationPO> list = page.getList();
if (CollectionUtils.isNotEmpty(list)) {
// 查询人员
List<Long> employeeIds = SalaryEntityUtil.properties(list, TaxDeclarationPO::getCreator, Collectors.toList());
List<DataCollectionEmployee> employeeComInfos = employBiz.getEmployeeByIdsAll(employeeIds);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(list, TaxDeclarationPO::getTaxAgentId);
//List<TaxAgent> taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds);
List<TaxAgent> taxAgentPOS = getTaxDeclarationService(user).countByTaxDeclarationId(taxAgentIds);
// 转换成列表dto
List<TaxDeclarationListDTO> taxDeclarationListDTOS = TaxDeclarationBO.convert2ListDTO(list, employeeComInfos, taxAgentPOS);
dtoPage.setList(taxDeclarationListDTOS);
}
return dtoPage;
}
public TaxDeclarationFormDTO getForm(Long id) {
TaxDeclarationFormDTO formDTO = new TaxDeclarationFormDTO();
if (Objects.nonNull(id)) {
// 查询个税申报表
TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id);
if (Objects.isNull(taxDeclaration)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
}
// 查询个税扣缴义务人
TaxAgent taxAgent = new TaxAgentBiz().getById(id);
// 转换成个税申报表详情dto
formDTO = TaxDeclarationFormDTO.builder()
.salaryMonth(SalaryDateUtil.localDate2YearMonth(taxDeclaration.getSalaryMonth()))
.taxAgentId(taxDeclaration.getTaxAgentId())
.taxAgentName(Optional.ofNullable(taxAgent).map(TaxAgent::getName).orElse(""))
.description(taxDeclaration.getDescription())
.build();
}
// 转换成前端所需的数据格式
// WeaForm weaForm = SalaryFormatUtil.<TaxDeclarationFormDTO>getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO);
// 查询租户所有的个税扣缴义务人
Collection<TaxAgent> taxAgentListDTOS = new TaxAgentBiz().listAll();
// 表单中个税扣缴义务人的可选项
List<WeaFormOption> weaFormOptions = Lists.newArrayListWithExpectedSize(taxAgentListDTOS.size());
for (TaxAgent taxAgent : taxAgentListDTOS) {
weaFormOptions.add(new WeaFormOption("" + taxAgent.getId(), taxAgent.getName()));
}
// weaForm.getItems().forEach((k, v) -> {
// if (StringUtils.equals("taxAgentId", k)) {
// v.setOptions(weaFormOptions);
// }
// if (StringUtils.equals("salaryMonth", k)) {
// Map<String, Object> otherParams = new HashMap<>();
// otherParams.put("type", "month");
// v.setOtherParams(otherParams);
// }
// });
return formDTO;
}
/*
*//**
* 查询个税申报表的基本信息
*
* @param id 个税申报表id
* @return
*/
public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id) {
// 查询个税申报表
//TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(id);
TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id);
if (Objects.isNull(taxDeclaration)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
}
// 查询个税扣缴义务人
TaxAgent taxAgentPO = new TaxAgentBiz().getById(taxDeclaration.getTaxAgentId());
return TaxDeclarationInfoDTO.builder()
.salaryMonth(SalaryDateUtil.localDate2YearMonth(taxDeclaration.getSalaryMonth()))
.taxAgentId(taxDeclaration.getTaxAgentId())
.taxAgentName(Optional.ofNullable(taxAgentPO).map(TaxAgent::getName).orElse(""))
.build();
}
/*
*//**
* 保存
*
* @param saveParam 保存参数
*/
@Transactional(rollbackFor = Exception.class)
public void save(TaxDeclarationSaveParam saveParam) {
//getTaxDeclarationService(user).save(saveParam);
EmployBiz employBiz = new EmployBiz();
// 薪资所属月的日期范围
LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2YearRange(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1)));
if (Objects.isNull(salaryMonthDateRange)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
// 查询薪资所属月已经生成过的个税申报表
List<TaxDeclarationPO> taxDeclarationPOS = listBySalaryMonthTax(salaryMonthDateRange);
// 已经生成过个税申报表不允许再次生成个税申报表
if (CollectionUtils.isNotEmpty(taxDeclarationPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98873, "{0}已经生成过个税申报表,不允许再次生成")
.replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 查询薪资所属月的薪资核算记录
List<SalaryAcctRecordPO> salaryAcctRecordPOS = listBySalaryMonth(salaryMonthDateRange);
// 无薪资核算记录不允许生成个税申报表
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据")
.replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 如果存在未归档的也不允许生成个税申报表
boolean notArchived = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> !Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue()));
if (notArchived) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}有未归档数据,请全部归档后再申报")
.replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 如果当前薪资所属月下存在不同的税款所属期属于异常业务场景不允许生成个税申报表
Date taxCycle = salaryAcctRecordPOS.get(0).getTaxCycle();
boolean differentTaxCycle = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> salaryAcctRecordPO.getTaxCycle().compareTo(taxCycle) != 0);
if (differentTaxCycle) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98876, "{0}存在不同的税款所属期,无法正常生成个税申报表,请调整账套设置,重新核算后再生成个税申报表")
.replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 查询薪资核算结果
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctResultPO> salaryAcctResultPOS = new SalaryAcctResultServiceImpl().listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 无薪资核算结果不允许生成个税申报表
if (CollectionUtils.isEmpty(salaryAcctResultPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据")
.replace("{0}", saveParam.getSalaryMonth().toString()));
}
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId);
List<SalarySobPO> salarySobPOS = new SalarySobServiceImpl().listByIds(salarySobIds);
//查询DataCollectionEmployee
//DataCollectionEmployee employeeId =
// 查询所有薪资项目
List<SalaryItemPO> salaryItemPOS = new SalaryItemBiz().listAll();
// 处理要保存的数据
TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, salaryItemPOS, salarySobPOS,salaryAcctResultPOS);
// 保存个税申报表
if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarations())) {
getTaxDeclarationMapper().batchInsert(result.getNeedInsertTaxDeclarations());
}
// 保存个税申报表明细
if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarationDetails())) {
new TaxDeclarationDetailServiceImpl().batchSave(result.getNeedInsertTaxDeclarationDetails());
}
// 保存累计情况
if (CollectionUtils.isNotEmpty(result.getNeedInsertAccumulatedSituations())) {
// TODO: 1/23/22 待修改不能直接调用mapper
// addUpSituationMapper.insertData(Lists.newArrayList(result.getNeedInsertAccumulatedSituations()));
}
// 更新薪资核算记录的状态
new SalaryAcctRecordServiceImpl().updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(result.getNeedInsertTaxDeclarations(), TaxDeclarationPO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgent::getId, TaxAgent::getName);
// 记录日志
/*for (TaxDeclarationPO taxDeclarationPO : result.getNeedInsertTaxDeclarations()) {
String targetName = SalaryDateUtil.toYearMonth(taxDeclarationPO.getSalaryMonth())
+ "(" + taxAgentNameMap.getOrDefault(taxDeclarationPO.getTaxAgentId(), StringUtils.EMPTY) + ")";
LoggerContext<TaxDeclarationPO> loggerContext = new LoggerContext<>();
loggerContext.setTargetId(String.valueOf(taxDeclarationPO.getId()));
loggerContext.setTargetName(targetName);
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(99815, "生成个税申报表"));
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(99815, "生成个税申报表"));
taxDeclarationLoggerTemplate.write(loggerContext);
}*/
}
public List<TaxDeclarationPO> listBySalaryMonthTax(LocalDateRange salaryMonthDateRange) {
return getTaxDeclarationMapper().listSome(TaxDeclarationPO.builder().salaryMonths(salaryMonthDateRange).build());
}
public List<SalaryAcctRecordPO> listBySalaryMonth(LocalDateRange salaryMonthDateRange) {
return getSalaryAcctRecordMapper().listSome(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).build());
}
}