Merge branch 'feature/qt' into develop

This commit is contained in:
钱涛 2022-03-10 18:00:21 +08:00
commit e3c602a8a0
40 changed files with 2752 additions and 91 deletions

View File

@ -0,0 +1,8 @@
package com.api.salary.web;
import javax.ws.rs.Path;
@Path("/bs/hrmsalary/otherDeduction")
public class OtherDeductionController extends com.engine.salary.web.OtherDeductionController {
}

View File

@ -1,5 +1,8 @@
package com.engine.salary.annotation;
import com.weaverboot.tools.enumTools.weaComponent.WeaTableTypeEnum;
import java.lang.annotation.*;
/**
@ -32,6 +35,12 @@ public @interface SalaryTable {
*/
String where() default "";
/**
* 分组
*/
String groupby() default "";
/**
* 排序
*/
@ -52,4 +61,9 @@ public @interface SalaryTable {
*/
SalaryTableOperate[] operates() default {};
/**
* 列表选择框
*/
WeaTableTypeEnum tableType() default WeaTableTypeEnum.NONE;
}

View File

@ -1,7 +1,6 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam;
@ -122,20 +121,6 @@ public class AddUpDeductionBiz extends BaseBean {
}
/**
* 查询人员列表
*
* @return
*/
public List<DataCollectionEmployee> listEmployee() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
return mapper.listEmployee();
} finally {
sqlSession.close();
}
}
/**
@ -146,14 +131,11 @@ public class AddUpDeductionBiz extends BaseBean {
*/
public XSSFWorkbook export(AddUpDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人");
//获取操作按钮资源
List<List<String>> rowList = getExcelRowList(title, param);
List<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList);
return ExcelUtil.genWorkbook(rowList,"累计专项附加扣除");
}
@ -162,7 +144,10 @@ public class AddUpDeductionBiz extends BaseBean {
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(List<String> title, AddUpDeductionQueryParam param) {
private List<List<String>> getExcelRowList(AddUpDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
List<AddUpDeductionDTO> list = list(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
@ -204,7 +189,7 @@ public class AddUpDeductionBiz extends BaseBean {
List<List<String>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList);
return ExcelUtil.genWorkbook(rowList,"累计专项附加扣除明细");
}

View File

@ -133,7 +133,7 @@ public class AddUpSituationBiz extends BaseBean {
List<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList);
return ExcelUtil.genWorkbook(rowList,"累计情况");
}
@ -196,7 +196,7 @@ public class AddUpSituationBiz extends BaseBean {
List<List<String>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList);
return ExcelUtil.genWorkbook(rowList,"累计情况明细");
}
@ -209,7 +209,7 @@ public class AddUpSituationBiz extends BaseBean {
private List<List<String>> getExcelRowDetailList(AddUpSituationQueryParam param) {
//excel标题
List<String> title = Arrays.asList("税款所属期", "个税扣缴义务人", "部门", "工号", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人");
List<String> title = Arrays.asList("姓名", "税款所属期", "个税扣缴义务人", "部门", "手机号", "工号", "累计收入额", "累计减除费用", "累计社保个人合计", "累计公积金个人合计", "累计子女教育", "累计继续教育", "累计住房贷款利息", "累计住房租金", "累计赡养老人", "累计企业(职业)年金及其他福利", "累计其他扣除", "累计免税收入", "累计准予扣除的捐赠额", "累计已预扣预缴税额");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息

View File

@ -0,0 +1,37 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.mapper.datacollection.EmployMapper;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import java.util.List;
public class EmployBiz extends BaseBean {
/**
* 查询人员列表
*
* @return
*/
public List<DataCollectionEmployee> listEmployee() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.listEmployee();
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> getEmployeeByIds(List<Long> list) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getEmployeeByIds(list);
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,294 @@
package com.engine.salary.biz;
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.util.excel.ExcelUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.conn.mybatis.MyBatisFactory;
import weaver.general.BaseBean;
import weaver.general.Util;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
public class OtherDeductionBiz extends BaseBean {
/**
* 关联查询查询列表
*
* @param param
* @return
*/
public List<OtherDeductionListDTO> list(OtherDeductionQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
return mapper.list(param);
} finally {
sqlSession.close();
}
}
/**
* 条件查询
*
* @param param
* @return
*/
public List<OtherDeductionPO> listSome(OtherDeductionPO param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
return mapper.listSome(param);
} finally {
sqlSession.close();
}
}
/**
* 根据id获取
*
* @param id
* @return
*/
public OtherDeductionPO getById(Long id) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
return mapper.getById(id);
} finally {
sqlSession.close();
}
}
/**
* 详情列表
*
* @param param
* @return
*/
public List<OtherDeductionRecordDTO> recordList(OtherDeductionQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
return mapper.recordList(param);
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchSave(List<OtherDeductionPO> param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
mapper.insertData(param);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 批量插入
*
* @param param
* @return
*/
public void batchUpdate(List<OtherDeductionPO> param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
mapper.updateData(param);
sqlSession.commit();
} finally {
sqlSession.close();
}
}
/**
* 导出
*
* @param param
* @return
*/
public XSSFWorkbook export(OtherDeductionQueryParam param) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除");
}
/**
* 获取excel数据行
*
* @return 导出数据行集合
*/
private List<List<String>> getExcelRowList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "入职日期", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
List<OtherDeductionListDTO> list = list(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getIdNo()));
cellList.add(dto.getHiredate() == null ? "" : formatter.format(dto.getHiredate()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
}
/**
* 导出详情列表
*
* @param param
* @return
*/
public XSSFWorkbook exportDetail(OtherDeductionQueryParam param) {
//获取操作按钮资源
List<List<String>> rowList = getExcelRowDetailList(param);
//获取excel
return ExcelUtil.genWorkbook(rowList,"其他免税扣除明细");
}
/**
* 导出详情
*
* @param param
* @return
*/
private List<List<String>> getExcelRowDetailList(OtherDeductionQueryParam param) {
//excel标题
List<String> title = Arrays.asList("姓名", "申报月份", "个税扣缴义务人", "部门", "手机号", "工号", "商业健康保险", "税延养老保险", "其他", "准予扣除的捐赠额");
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
//查询详细信息
List<OtherDeductionRecordDTO> list = recordList(param);
final List<List<String>> dataRowList = Optional.ofNullable(list)
.map(List::stream)
.map(operatorStream -> operatorStream.map(dto -> {
List<String> cellList = new ArrayList<>();
cellList.add(Util.null2String(dto.getUsername()));
cellList.add(Util.null2String(dto.getDeclareMonth() == null ? "" : formatter.format(dto.getDeclareMonth())));
cellList.add(Util.null2String(dto.getTaxAgentName()));
cellList.add(Util.null2String(dto.getDepartmentName()));
cellList.add(Util.null2String(dto.getMobile()));
cellList.add(Util.null2String(dto.getJobNum()));
cellList.add(Util.null2String(dto.getBusinessHealthyInsurance()));
cellList.add(Util.null2String(dto.getTaxDelayEndowmentInsurance()));
cellList.add(Util.null2String(dto.getOtherDeduction()));
cellList.add(Util.null2String(dto.getDeductionAllowedDonation()));
return cellList;
}).collect(Collectors.toList()))
.orElse(Collections.emptyList());
List<List<String>> rowList = new ArrayList<>();
rowList.add(title);
rowList.addAll(dataRowList);
return rowList;
}
/**
* 处理导入数据
*
* @param pos
*/
public void handleImportData(List<OtherDeductionPO> pos) {
if (CollectionUtils.isEmpty(pos)) {
return;
}
OtherDeductionPO po = pos.get(0);
// 多条相同人的则以第一条为准如果逆序排列用于重复的则以最后一条为准Collections.reverse(pos);
// 去重通过记录的唯一条件(申报月份人员id个税扣缴义务人id)拼接
List<OtherDeductionPO> finalPos = pos.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getEmployeeId() + "-" + f.getTaxAgentId()))), ArrayList::new));
// 查询已有数据
List<OtherDeductionPO> list = listSome(OtherDeductionPO.builder().declareMonth(po.getDeclareMonth()).build());
// 待修改的 本地已存在则更新交集
List<OtherDeductionPO> updateList = list.stream().map(m -> {
Optional<OtherDeductionPO> optional = finalPos.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
OtherDeductionPO temp = null;
if (optional.isPresent()) {
temp = optional.get();
// 换成本地库的id
temp.setId(m.getId());
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 待新增的 导入比本地多则新增差集(导入 - local)
List<OtherDeductionPO> saveList = finalPos.stream().map(m -> {
Optional<OtherDeductionPO> optional = list.stream().filter(p -> (p.getEmployeeId() + "-" + p.getTaxAgentId()).equals(m.getEmployeeId() + "-" + m.getTaxAgentId())).findFirst();
OtherDeductionPO temp = null;
if (!optional.isPresent()) {
temp = m;
}
return temp;
}).filter(Objects::nonNull).collect(Collectors.toList());
// 修改
if (CollectionUtils.isNotEmpty(updateList)) {
batchUpdate(updateList);
}
// 保存
if (CollectionUtils.isNotEmpty(saveList)) {
batchSave(saveList);
}
// 记录操作日志
// saveList.addAll(updateList);
//
// if (CollectionUtils.isNotEmpty(saveList)) {
// LoggerContext loggerContext = new LoggerContext();
// loggerContext.setTargetId(String.valueOf(IdGenerator.generate()));
// loggerContext.setTargetName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
// loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
// loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
// loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(message.getTenantKey(), message.getUserId(), 100351, "导入累计专项附加扣除"));
// loggerContext.setNewValueList(saveList);
// loggerContext.setTenant_key(message.getTenantKey());
// loggerContext.setOperator(message.getUserId().toString());
// loggerContext.setOperatorName(message.getOpreator());
// loggerContext.setClientIp(message.getClientIp());
// addUpDeductionLoggerTemplate.write(loggerContext);
// }
}
}

View File

@ -56,7 +56,7 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
queryParam.setEmployeeId(po.getEmployeeId());
String fileds = " t1.id," +
String fields = " t1.id," +
" t1.declare_month as declareMonth," +
" t1.employee_id as employeeId," +
" e.lastname as username," +
@ -78,7 +78,7 @@ public class AddUpDeductionGetDetailListCmd extends AbstractCommonCommand<Map<St
" LEFT JOIN hrmdepartment d ON e.departmentid = d.id";
SalaryWeaTable<AddUpDeductionRecordDTO> table = new SalaryWeaTable<AddUpDeductionRecordDTO>(user, AddUpDeductionRecordDTO.class);
table.setBackfields(fileds);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere(queryParam));
table.setSqlorderby("t1.declare_month DESC");

View File

@ -4,6 +4,7 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -51,6 +52,7 @@ public class AddUpDeductionImportCmd extends AbstractCommonCommand<Map<String, O
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
EmployBiz employBiz = new EmployBiz();
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
//检验参数
@ -83,7 +85,7 @@ public class AddUpDeductionImportCmd extends AbstractCommonCommand<Map<String, O
int errorCount = 0;
//人员信息
List<DataCollectionEmployee> employees = addUpDeductionBiz.listEmployee();
List<DataCollectionEmployee> employees = employBiz.listEmployee();
List<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
//税款所属期

View File

@ -1,5 +1,6 @@
package com.engine.salary.cmd.datacollection;
import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
@ -29,7 +30,7 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand<Map<String, Obj
@Override
public Map<String, Object> execute(CommandContext commandContext) {
String fileds = " t1.id," +
String fields = " t1.id," +
" t1.declare_month as declareMonth," +
" t1.employee_id as employeeId," +
" e.lastname as username," +
@ -51,15 +52,19 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand<Map<String, Obj
" LEFT JOIN hrmdepartment d ON e.departmentid = d.id";
SalaryWeaTable<AddUpDeductionDTO> table = new SalaryWeaTable<AddUpDeductionDTO>(user, AddUpDeductionDTO.class);
table.setBackfields(fileds);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlorderby("t1.id DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
table.setCheckboxList(new ArrayList<>());
table.setCheckboxpopedom(null);
//设置check是否可用
List<WeaTableCheckboxpopedom> checkboxpopedomList = new ArrayList<>();
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setPopedompara("column:enable");
checkboxpopedomList.add(checkboxpopedom);
table.setCheckboxList(checkboxpopedomList);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());

View File

@ -29,7 +29,7 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
@Override
public Map<String, Object> execute(CommandContext commandContext) {
String fileds = " t1.id," +
String fields = " t1.id," +
" t1.tax_year_month," +
" t1.employee_id as employeeId," +
" e.lastname as username," +
@ -63,7 +63,7 @@ public class AddUpSituationGetDetailListCmd extends AbstractCommonCommand<Map<St
" LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id";
SalaryWeaTable<AddUpSituationRecordDTO> table = new SalaryWeaTable<AddUpSituationRecordDTO>(user, AddUpSituationRecordDTO.class);
table.setBackfields(fileds);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlorderby("t1.id DESC");

View File

@ -3,8 +3,8 @@ package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.AddUpDeductionBiz;
import com.engine.salary.biz.AddUpSituationBiz;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
@ -49,7 +49,7 @@ public class AddUpSituationImportCmd extends AbstractCommonCommand<Map<String, O
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
AddUpDeductionBiz addUpDeductionBiz = new AddUpDeductionBiz();
EmployBiz employBiz = new EmployBiz();
AddUpSituationBiz biz = new AddUpSituationBiz();
//检验参数
@ -80,7 +80,7 @@ public class AddUpSituationImportCmd extends AbstractCommonCommand<Map<String, O
int errorCount = 0;
//人员信息
List<DataCollectionEmployee> employees = addUpDeductionBiz.listEmployee();
List<DataCollectionEmployee> employees = employBiz.listEmployee();
List<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
//税款所属期

View File

@ -1,5 +1,6 @@
package com.engine.salary.cmd.datacollection;
import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
@ -29,7 +30,7 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
@Override
public Map<String, Object> execute(CommandContext commandContext) {
String fileds = " t1.id," +
String fields = " t1.id," +
" t1.tax_year_month," +
" t1.employee_id as employeeId," +
" e.lastname as username," +
@ -63,15 +64,19 @@ public class AddUpSituationListCmd extends AbstractCommonCommand<Map<String, Obj
" LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id";
SalaryWeaTable<AddUpSituationDTO> table = new SalaryWeaTable<AddUpSituationDTO>(user, AddUpSituationDTO.class);
table.setBackfields(fileds);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlorderby("t1.id DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
table.setCheckboxList(new ArrayList<>());
table.setCheckboxpopedom(null);
//设置check是否可用
List<WeaTableCheckboxpopedom> checkboxpopedomList = new ArrayList<>();
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setPopedompara("column:enable");
checkboxpopedomList.add(checkboxpopedom);
table.setCheckboxList(checkboxpopedomList);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());

View File

@ -4,14 +4,17 @@ import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.entity.datacollection.dto.AddUpSituationDTO;
import com.engine.salary.entity.datacollection.param.AddUpSituationImportParam;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.excel.ExcelParseHelper;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
@ -37,13 +40,21 @@ public class AddUpSituationPreviewCmd extends AbstractCommonCommand<Map<String,
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
//检验参数
checkImportParam();
//导入参数
AddUpSituationImportParam importParam = (AddUpSituationImportParam) params.get("importParam");
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
InputStream fileInputStream = null;
try {
// fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId));
fileInputStream = new FileInputStream("C:\\Users\\钱涛\\Desktop\\salary\\addUpSituation\\importTemplate.xlsx");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
// try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId));
// fileInputStream = new FileInputStream("C:\\Users\\钱涛\\Desktop\\salary\\addUpSituation\\importTemplate.xlsx");
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// }
try {
List<AddUpSituationDTO> excelDates = ExcelParseHelper.parse(fileInputStream, AddUpSituationDTO.class, 0, 1, 21, "template.xlsx");
apidatas.put("preview", excelDates);
@ -53,4 +64,22 @@ public class AddUpSituationPreviewCmd extends AbstractCommonCommand<Map<String,
return apidatas;
}
private void checkImportParam() {
AddUpSituationImportParam importParam = (AddUpSituationImportParam) params.get("importParam");
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
//税款所属期
String declareMonthStr = Util.null2String(importParam.getTaxYearMonth());
if (StringUtils.isBlank(imageId)) {
throw new SalaryRunTimeException("文件不存在");
}
if (StringUtils.isBlank(declareMonthStr)) {
throw new SalaryRunTimeException("税款所属期为空");
}
}
}

View File

@ -0,0 +1,34 @@
package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Map;
public class OtherDeductionExportCmd extends AbstractCommonCommand<XSSFWorkbook> {
public OtherDeductionExportCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public XSSFWorkbook execute(CommandContext commandContext) {
OtherDeductionQueryParam OtherDeductionQueryParam = (OtherDeductionQueryParam) params.get("queryParam");
OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz();
XSSFWorkbook workbook = OtherDeductionBiz.export(OtherDeductionQueryParam);
return workbook;
}
}

View File

@ -0,0 +1,46 @@
package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.util.Map;
public class OtherDeductionExportDetailCmd extends AbstractCommonCommand<XSSFWorkbook> {
public OtherDeductionExportDetailCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@Override
public XSSFWorkbook execute(CommandContext commandContext) {
OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam");
OtherDeductionBiz biz = new OtherDeductionBiz();
Long id = queryParam.getOtherTaxExemptDeductionId();
if (id == null) {
throw new SalaryRunTimeException("id不能为空");
}
OtherDeductionPO po = biz.getById(id);
if (po == null) {
throw new SalaryRunTimeException(String.format("其他免税扣除不存在"+"[id:%s]", id));
}
XSSFWorkbook workbook = biz.exportDetail(queryParam);
return workbook;
}
}

View File

@ -0,0 +1,170 @@
package com.engine.salary.cmd.datacollection;
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.biz.EmployBiz;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.exception.SalaryRunTimeException;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
public class OtherDeductionGetDetailListCmd extends AbstractCommonCommand<Map<String, Object>> {
public OtherDeductionGetDetailListCmd(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) {
EmployBiz employBiz = new EmployBiz();
OtherDeductionBiz biz = new OtherDeductionBiz();
OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam");
if (queryParam == null) {
throw new SalaryRunTimeException("参数异常");
}
Long id = queryParam.getOtherTaxExemptDeductionId();
if (id == null) {
throw new SalaryRunTimeException("其他免税扣除id不能为空");
}
OtherDeductionPO po = biz.getById(id);
if (po == null) {
throw new SalaryRunTimeException(String.format("其他免税扣除不存在[id:%s]", id));
}
List<DataCollectionEmployee> employeeList = employBiz.getEmployeeByIds(Collections.singletonList(po.getEmployeeId()));
if (CollectionUtils.isEmpty(employeeList)) {
throw new SalaryRunTimeException("员工信息不存在");
}
queryParam.setEmployeeId(po.getEmployeeId());
String fields = " t1.id," +
" t1.declare_month," +
" t1.employee_id," +
" t2.name AS tax_agent_name," +
" e.lastname as username," +
" d.departmentname AS departmentName," +
" e.mobile," +
" e.workcode as job_num," +
" e.companystartdate as hiredate," +
" t1.business_healthy_insurance," +
" t1.tax_delay_endowment_insurance," +
" t1.other_deduction," +
" t1.deduction_allowed_donation";
String fromSql = " FROM" +
" hrsa_other_deduction t1" +
" LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" +
" LEFT JOIN hrmresource e ON e.id = t1.employee_id" +
" LEFT JOIN hrmdepartment d ON d.id = e.departmentid";
SalaryWeaTable<AddUpDeductionRecordDTO> table = new SalaryWeaTable<AddUpDeductionRecordDTO>(user, AddUpDeductionRecordDTO.class);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere(queryParam));
table.setSqlorderby("t1.declare_month DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
table.setCheckboxList(new ArrayList<>());
table.setCheckboxpopedom(null);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
}
private String makeSqlWhere(OtherDeductionQueryParam queryParam) {
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0";
Collection<Long> ids = queryParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND t1.id IN (" + idsStr + ")";
}
Long employeeId = queryParam.getEmployeeId();
if (employeeId != null) {
sqlWhere += " AND t1.employee_id =" + employeeId;
}
String keyword = queryParam.getKeyword();
if (StringUtils.isNotBlank(keyword)) {
sqlWhere += " AND (" +
" e.lastname like '%" + keyword + "%'" +
" OR d.departmentname like '%" + keyword + "%'" +
" OR e.workcode like ''%" + keyword + "%'" +
" )";
}
// 申报月份
List<String> declareMonths = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonths)) {
if (declareMonths.size() == 1) {
sqlWhere += " AND t1.declare_month = '" + declareMonths.get(0) + ",";
}
if (declareMonths.size() == 2) {
sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonths.get(0) + "' AND '" + declareMonths.get(1) + "')";
}
}
//姓名
String username = queryParam.getUsername();
if (StringUtils.isNotBlank(username)) {
sqlWhere += " AND e.lastname like '%" + username + "%'";
}
//个税扣缴义务人
Long taxAgentId = queryParam.getTaxAgentId();
if (taxAgentId != null) {
sqlWhere += " AND t1.tax_agent_id = " + taxAgentId;
}
//部门
List<Long> departmentIds = queryParam.getDepartmentIds();
if (CollectionUtils.isNotEmpty(departmentIds)) {
String departmentStrIds = departmentIds.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND d.id IN (" + departmentStrIds + ")";
}
//工号
String jobNum = queryParam.getJobNum();
if (StringUtils.isNotBlank(jobNum)) {
sqlWhere += " AND e.workcode like '%" + jobNum + "%'";
}
//入职日期
List<Date> hiredate = queryParam.getHiredate();
if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) {
sqlWhere += " AND (e.companystartdate BETWEEN " + hiredate.get(0) + " AND " + hiredate.get(1) + ")";
}
//手机号
String mobile = queryParam.getMobile();
if (StringUtils.isNotBlank(mobile)) {
sqlWhere += " AND e.mobile like '%" + mobile + "%'";
}
return sqlWhere;
}
}

View File

@ -0,0 +1,105 @@
package com.engine.salary.cmd.datacollection;
import com.api.browser.bean.SearchConditionGroup;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import weaver.hrm.User;
import weaver.systeminfo.SystemEnv;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OtherDeductionGetSearchConditionCmd extends AbstractCommonCommand<Map<String, Object>> {
public OtherDeductionGetSearchConditionCmd(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>();
ConditionFactory conditionFactory = new ConditionFactory(user);
//条件组
List<SearchConditionGroup> addGroups = new ArrayList<SearchConditionGroup>();
List<SearchConditionItem> conditionItems = new ArrayList<SearchConditionItem>();
//文本输入框
SearchConditionItem username = conditionFactory.createCondition(ConditionType.INPUT,25034, "username");
username.setColSpan(2);//定义一行显示条件数默认值为2,当值为1时标识该条件单独占一行
username.setFieldcol(16); //条件输入框所占宽度默认值18
username.setLabelcol(8);
username.setViewAttr(2); // 编辑权限 1只读2可编辑 3必填 默认2
username.setLabel("姓名"); //设置文本值 这个将覆盖多语言标签的值
conditionItems.add(username);
SearchConditionItem departmentName = conditionFactory.createCondition(ConditionType.BROWSER,502227,"departmentName","4");
departmentName.setColSpan(2);
departmentName.setFieldcol(12);
departmentName.setLabelcol(6);
departmentName.setViewAttr(2);
departmentName.setIsQuickSearch(false);
departmentName.setLabel("部门");
conditionItems.add(departmentName);
SearchConditionItem jobNum = conditionFactory.createCondition(ConditionType.INPUT,25034, "jobNum");
jobNum.setColSpan(2);
jobNum.setFieldcol(16);
jobNum.setLabelcol(8);
jobNum.setViewAttr(2);
jobNum.setLabel("工号");
conditionItems.add(jobNum);
SearchConditionItem idNo = conditionFactory.createCondition(ConditionType.INPUT,25034, "idNo");
idNo.setColSpan(2);
idNo.setFieldcol(16);
idNo.setLabelcol(8);
idNo.setViewAttr(2);
idNo.setLabel("证件号码");
conditionItems.add(idNo);
//日期范围选项
List<SearchConditionOption> dateOptions = new ArrayList<SearchConditionOption>();
dateOptions.add(new SearchConditionOption("6", SystemEnv.getHtmlLabelName(32530, user.getLanguage()),true));//指定日期范围(必须为6)
SearchConditionItem hiredate = conditionFactory.createCondition(ConditionType.RANGEPICKER, 18648, new String[]{"hiredate","hiredate"});
hiredate.setFieldcol(16);
hiredate.setLabelcol(8);
hiredate.setViewAttr(2);
hiredate.setLabel("入职日期");
hiredate.setOptions(dateOptions);
conditionItems.add(hiredate);
SearchConditionItem mobile = conditionFactory.createCondition(ConditionType.INPUT,25034, "mobile");
mobile.setColSpan(2);
mobile.setFieldcol(16);
mobile.setLabelcol(8);
mobile.setViewAttr(2);
mobile.setLabel("手机号");
conditionItems.add(mobile);
addGroups.add(new SearchConditionGroup("常用条件",true,conditionItems));
apidatas.put("condition",addGroups);
return apidatas;
}
}

View File

@ -0,0 +1,237 @@
package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.biz.OtherDeductionBiz;
import com.engine.salary.biz.TaxAgentBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.google.common.collect.Maps;
import lombok.SneakyThrows;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.util.IOUtils;
import weaver.general.Util;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.constant.SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY;
public class OtherDeductionImportCmd extends AbstractCommonCommand<Map<String, Object>> {
protected HttpServletRequest request;
public OtherDeductionImportCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@SneakyThrows
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
EmployBiz employBiz = new EmployBiz();
OtherDeductionBiz OtherDeductionBiz = new OtherDeductionBiz();
//检验参数
checkImportParam();
//导入参数
OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam");
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
Validate.notBlank(imageId, "imageId为空");
//税款所属期
String declareMonthStr = Util.null2String(importParam.getDeclareMonth());
//个税扣缴义务人
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
InputStream fileInputStream = null;
// fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId));
try {
fileInputStream = new FileInputStream("C:\\Users\\钱涛\\Desktop\\salary\\OtherDeduction\\importTemplate.xlsx");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
int total = OtherDeductions.size();
int index = 0;
int successCount = 0;
int errorCount = 0;
//人员信息
List<DataCollectionEmployee> employees = employBiz.listEmployee();
List<TaxAgent> taxAgents = new TaxAgentBiz().listAll();
//税款所属期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date declareMonth = simpleDateFormat.parse(declareMonthStr + "-01");
// 错误excel内容
List<Map> errorData = new ArrayList<>();
//合规数据
List<OtherDeductionPO> eligibleData = new ArrayList<>();
for (int i = 0; i < OtherDeductions.size(); i++) {
OtherDeductionListDTO dto = OtherDeductions.get(i);
Date now = new Date();
//待插入数据库对象
OtherDeductionPO po = OtherDeductionPO.builder()
.tenantKey(DEFAULT_TENANT_KEY)
.createTime(now)
.updateTime(now)
.creator((long) user.getUID())
.declareMonth(declareMonth).build();
//异常点数量
int errorSum = 0;
//行号
String rowIndex = String.format("第%s行", i + 2);
//相同的姓名
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
List<Long> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDeparmentName(), deparmentName))).map(DataCollectionEmployee::getEmployeeId)
.collect(Collectors.toList());
if (StringUtils.isBlank(userName)) {
//姓名 不能为空
//错误消息对象
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "员工信息不能为空且不可重复(姓名与部门同时确认唯一)");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0) : null;
if (employeeId != null && employeeId > 0) {
po.setEmployeeId(employeeId);
} else {
//姓名错误系统内不存在该姓名
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
String taxAgentName = dto.getTaxAgentName();
if (StringUtils.isBlank(taxAgentName)) {
//个税扣缴义务人不能为空
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不能为空");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
Optional<TaxAgent> optionalTemp = taxAgents.stream().filter(m -> m.getName().equals(taxAgentName)).findFirst();
if (optionalTemp.isPresent()) {
if (StringUtils.isNotEmpty(taxAgentId) && !optionalTemp.get().getId().equals(Long.valueOf(taxAgentId))) {
//个税扣缴义务人与导入时选择的不一致
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人与导入时选择的不一致");
errorData.add(errorMessageMap);
errorSum += 1;
} else {
po.setTaxAgentId(optionalTemp.get().getId());
}
} else {
//个税扣缴义务人不存在
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + "个税扣缴义务人不存在");
errorData.add(errorMessageMap);
errorSum += 1;
}
}
//商业健康保险
String businessHealthyInsurance = dto.getBusinessHealthyInsurance();
po.setBusinessHealthyInsurance(businessHealthyInsurance);
//税延养老保险
String taxDelayEndowmentInsurance = dto.getTaxDelayEndowmentInsurance();
po.setTaxDelayEndowmentInsurance(taxDelayEndowmentInsurance);
//其他
String otherDeduction = dto.getOtherDeduction();
po.setOtherDeduction(otherDeduction);
//准予扣除的捐赠额
String deductionAllowedDonation = dto.getDeductionAllowedDonation();
po.setDeductionAllowedDonation(deductionAllowedDonation);
if (errorSum == 0) {
successCount += 1;
// 合格数据
eligibleData.add(po);
} else {
errorCount += 1;
// 添加错误数据
}
}
//入库
OtherDeductionBiz.handleImportData(eligibleData);
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorData", errorData);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
private void checkImportParam() {
OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam");
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
//税款所属期
String declareMonthStr = Util.null2String(importParam.getDeclareMonth());
//个税扣缴义务人
String taxAgentId = Util.null2String(importParam.getTaxAgentId());
if (StringUtils.isBlank(imageId)) {
throw new SalaryRunTimeException("文件不存在");
}
if (StringUtils.isBlank(declareMonthStr)) {
throw new SalaryRunTimeException("税款所属期为空");
}
}
}

View File

@ -0,0 +1,146 @@
package com.engine.salary.cmd.datacollection;
import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom;
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.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
public class OtherDeductionListCmd extends AbstractCommonCommand<Map<String, Object>> {
public OtherDeductionListCmd(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) {
String fields = " t1.id," +
" t1.declare_month," +
" t1.employee_id," +
" t2.name AS tax_agent_name," +
" e.lastname as username," +
" d.departmentname AS departmentName," +
" e.mobile," +
" e.workcode as job_num," +
" e.companystartdate as hiredate," +
" t1.business_healthy_insurance," +
" t1.tax_delay_endowment_insurance," +
" t1.other_deduction," +
" t1.deduction_allowed_donation";
String fromSql = " FROM" +
" hrsa_other_deduction t1" +
" LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" +
" LEFT JOIN hrmresource e ON e.id = t1.employee_id" +
" LEFT JOIN hrmdepartment d ON d.id = e.departmentid";
SalaryWeaTable<OtherDeductionListDTO> table = new SalaryWeaTable<OtherDeductionListDTO>(user, OtherDeductionListDTO.class);
table.setBackfields(fields);
table.setSqlform(fromSql);
table.setSqlwhere(makeSqlWhere());
table.setSqlorderby("t1.id DESC");
table.setSqlprimarykey("t1.id");
table.setSqlisdistinct("false");
//设置check是否可用
List<WeaTableCheckboxpopedom> checkboxpopedomList = new ArrayList<>();
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setPopedompara("column:enable");
checkboxpopedomList.add(checkboxpopedom);
table.setCheckboxList(checkboxpopedomList);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
return result.getResultMap();
}
private String makeSqlWhere() {
OtherDeductionQueryParam queryParam = (OtherDeductionQueryParam) params.get("queryParam");
//申报月份
List<String> declareMonth = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth)) {
queryParam.setDeclareMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList()));
}
String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0 AND e.status not in (7)";
Collection<Long> ids = queryParam.getIds();
if (CollectionUtils.isNotEmpty(ids)) {
String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND t1.id IN (" + idsStr + ")";
}
Long employeeId = queryParam.getEmployeeId();
if (employeeId != null) {
sqlWhere += " AND t1.employee_id =" + employeeId;
}
String keyword = queryParam.getKeyword();
if (StringUtils.isNotBlank(keyword)) {
sqlWhere += " AND (" +
" e.lastname like '%" + keyword + "%'" +
" OR d.departmentname like '%" + keyword + "%'" +
" OR e.workcode like ''%" + keyword + "%'" +
" )";
}
// 税款所属期
List<String> declareMonth1 = queryParam.getDeclareMonth();
if (CollectionUtils.isNotEmpty(declareMonth1)) {
if (declareMonth1.size() == 1) {
sqlWhere += " AND t1.declare_month = '" + declareMonth1.get(0) + "'";
}
if (declareMonth1.size() == 2) {
sqlWhere += " AND (t1.declare_month BETWEEN '" + declareMonth1.get(0) + "' AND '" + declareMonth1.get(1) + "')";
}
}
//姓名
String username = queryParam.getUsername();
if (StringUtils.isNotBlank(username)) {
sqlWhere += " AND e.lastname like '%" + username + "%'";
}
//个税扣缴义务人
Long taxAgentId = queryParam.getTaxAgentId();
if (taxAgentId != null) {
sqlWhere += " AND t1.tax_agent_id = " + taxAgentId;
}
//部门
List<Long> departmentIds = queryParam.getDepartmentIds();
if (CollectionUtils.isNotEmpty(departmentIds)) {
String departmentStrIds = departmentIds.stream().map(String::valueOf).collect(Collectors.joining(","));
sqlWhere += " AND d.id IN (" + departmentStrIds + ")";
}
//工号
String jobNum = queryParam.getJobNum();
if (StringUtils.isNotBlank(jobNum)) {
sqlWhere += " AND e.workcode like '%" + jobNum + "%'";
}
//入职日期
List<Date> hiredate = queryParam.getHiredate();
if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) {
sqlWhere += " AND (e.companystartdate BETWEEN '" + hiredate.get(0) + "' AND '" + hiredate.get(1) + "')";
}
//手机号
String mobile = queryParam.getMobile();
if (StringUtils.isNotBlank(mobile)) {
sqlWhere += " AND e.mobile like '%" + mobile + "%'";
}
return sqlWhere;
}
}

View File

@ -0,0 +1,66 @@
package com.engine.salary.cmd.datacollection;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
import com.engine.salary.util.excel.ExcelParseHelper;
import lombok.SneakyThrows;
import org.apache.commons.lang3.Validate;
import org.apache.poi.util.IOUtils;
import weaver.general.Util;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OtherDeductionPreviewCmd extends AbstractCommonCommand<Map<String, Object>> {
protected HttpServletRequest request;
public OtherDeductionPreviewCmd(Map<String, Object> params, User user) {
this.user = user;
this.params = params;
}
@Override
public BizLogContext getLogContext() {
return null;
}
@SneakyThrows
@Override
public Map<String, Object> execute(CommandContext commandContext) {
Map<String, Object> apidatas = new HashMap<String, Object>();
//导入参数
OtherDeductionImportParam importParam = (OtherDeductionImportParam) params.get("importParam");
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
Validate.notBlank(imageId, "imageId为空");
InputStream fileInputStream = null;
// fileInputStream = ImageFileManager.getInputStreamById(Integer.valueOf(imageId));
try {
fileInputStream = new FileInputStream("C:\\Users\\钱涛\\Desktop\\salary\\OtherDeduction\\importTemplate.xlsx");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
List<OtherDeductionListDTO> OtherDeductions = ExcelParseHelper.parse(fileInputStream, OtherDeductionListDTO.class, 0, 1, 11, "OtherDeductionTemplate.xlsx");
apidatas.put("preview", OtherDeductions);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
}

View File

@ -1,13 +1,11 @@
package com.engine.salary.component;
import com.cloudstore.eccom.constant.WeaBoolAttr;
import com.cloudstore.eccom.pc.table.WeaTable;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.pc.table.WeaTableOperate;
import com.cloudstore.eccom.pc.table.WeaTableOperates;
import com.cloudstore.eccom.pc.table.*;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import com.weaverboot.tools.enumTools.weaComponent.WeaTableTypeEnum;
import org.apache.commons.lang3.StringUtils;
import weaver.general.PageIdConst;
import weaver.hrm.User;
@ -36,13 +34,23 @@ public class SalaryWeaTable<T> extends WeaTable {
String sql = table.fromSql();
super.setSqlform(sql);
String where = table.where();
super.setSqlwhere(where);
if (StringUtils.isNotBlank(where)) {
super.setSqlwhere(where);
}
String orderby = table.orderby();
super.setSqlorderby(orderby);
if (StringUtils.isNotBlank(orderby)) {
super.setSqlorderby(orderby);
}
String groupby = table.groupby();
if (StringUtils.isNotBlank(groupby)) {
super.setSqlgroupby(groupby);
}
boolean distinct = table.distinct();
super.setSqlisdistinct(String.valueOf(distinct));
String primarykey = table.primarykey();
super.setSqlprimarykey(primarykey);
if (StringUtils.isNotBlank(primarykey)) {
super.setSqlprimarykey(primarykey);
}
SalaryTableOperate[] operates = table.operates();
if (operates != null && operates.length > 0) {
List<WeaTableOperate> operateList = new ArrayList<>();
@ -61,9 +69,14 @@ public class SalaryWeaTable<T> extends WeaTable {
super.setOperates(weaTableOperates);
}
WeaTableTypeEnum weaTableTypeEnum = table.tableType();
//设置check是否可用
super.setCheckboxList(null);
super.setCheckboxpopedom(null);
if (weaTableTypeEnum == WeaTableTypeEnum.CHECKBOX) {
WeaTableCheckboxpopedom checkboxpopedom = new WeaTableCheckboxpopedom();
checkboxpopedom.setShowmethod("true");
super.setCheckboxpopedom(checkboxpopedom);
}
}
Field[] fields = clazz.getDeclaredFields();
@ -83,7 +96,7 @@ public class SalaryWeaTable<T> extends WeaTable {
boolean display = columnAnn.display();
WeaTableColumn weaTableColumn = new WeaTableColumn(width, text, column, orderkey);
String transmethod = columnAnn.transmethod();
if(StringUtils.isNotBlank(transmethod)){
if (StringUtils.isNotBlank(transmethod)) {
weaTableColumn.setTransmethod(transmethod);
}
if (!display) {

View File

@ -5,6 +5,7 @@ import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.util.excel.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.weaverboot.tools.enumTools.weaComponent.WeaTableTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -25,7 +26,7 @@ import java.util.Date;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8", operates = {
@SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8", tableType = WeaTableTypeEnum.CHECKBOX, operates = {
@SalaryTableOperate(text = "查看明细")
})
public class AddUpDeductionDTO {
@ -88,7 +89,7 @@ public class AddUpDeductionDTO {
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@ExcelProperty(index = 6)
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate",transmethod="com.engine.salary.transmethod.TransMethod.timeToDate")
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate", transmethod = "com.engine.salary.transmethod.TransMethod.timeToDate")
private Date hiredate;
/**

View File

@ -20,6 +20,7 @@ import java.util.Date;
//数据采集-累计专项附加扣除记录
@SalaryTable(pageId = "a4f85287-3354-4275-adn9-7d06e54y6rj8")
public class AddUpDeductionRecordDTO {
//主键id
@SalaryTableColumn(column = "id", display = false)
private Long id;
@ -27,20 +28,24 @@ public class AddUpDeductionRecordDTO {
//员工id
private Long employeeId;
@ExcelProperty(index = 0)
private String username;
//申报月份
@JsonFormat(pattern = "yyyy-MM")
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate",transmethod="com.engine.salary.transmethod.TransMethod.timeToMoth")
@SalaryTableColumn(text = "申报月份", width = "10%", column = "hiredate", transmethod = "com.engine.salary.transmethod.TransMethod.timeToMoth")
@ExcelProperty(index = 1)
private Date declareMonth;
//个税扣缴义务人
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
@ExcelProperty(index = 2)
private String taxAgentName;
@SalaryTableColumn(text = "姓名", width = "10%", column = "username")
private String username;
//部门
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
@ExcelProperty(index = 3)
private String departmentName;
//手机号
@ -49,40 +54,41 @@ public class AddUpDeductionRecordDTO {
//工号
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
@ExcelProperty(index = 4)
private String jobNum;
/**
* 累计子女教育
*/
@ExcelProperty(index = 7)
@ExcelProperty(index = 5)
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
private BigDecimal addUpChildEducation;
/**
* 累计继续教育
*/
@ExcelProperty(index = 8)
@ExcelProperty(index = 6)
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
private BigDecimal addUpContinuingEducation;
/**
* 累计住房贷款利息
*/
@ExcelProperty(index = 9)
@ExcelProperty(index = 7)
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
private BigDecimal addUpHousingLoanInterest;
/**
* 累计住房租金
*/
@ExcelProperty(index = 10)
@ExcelProperty(index = 8)
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
private BigDecimal addUpHousingRent;
/**
* 累计赡养老人
*/
@ExcelProperty(index = 11)
@ExcelProperty(index = 9)
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
private BigDecimal addUpSupportElderly;

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.util.excel.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -27,65 +28,85 @@ public class AddUpSituationRecordDTO {
@SalaryTableColumn(column = "id", display = false)
private Long id;
@ExcelProperty(index = 0)
private String username;
@JsonFormat(pattern = "yyyy-MM")
@SalaryTableColumn(text = "税款所属期", width = "10%", column = "taxYearMonth", transmethod = "com.engine.salary.transmethod.TransMethod.timeToMoth")
@ExcelProperty(index = 1)
private Date taxYearMonth;
private Long employeeId;
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
@ExcelProperty(index = 2)
private String taxAgentName;
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
@ExcelProperty(index = 3)
private String departmentName;
@SalaryTableColumn(text = "手机号", width = "10%", column = "mobile")
@ExcelProperty(index = 4)
private String mobile;
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
@ExcelProperty(index = 5)
private String jobNum;
@SalaryTableColumn(text = "累计收入额", width = "10%", column = "addUpIncome")
@ExcelProperty(index = 6)
private String addUpIncome;
@SalaryTableColumn(text = "累计减除费用", width = "10%", column = "addUpSubtraction")
@ExcelProperty(index = 7)
private String addUpSubtraction;
@SalaryTableColumn(text = "累计社保个人合计", width = "10%", column = "addUpSocialSecurityTotal")
@ExcelProperty(index = 8)
private String addUpSocialSecurityTotal;
@SalaryTableColumn(text = "累计公积金个人合计", width = "10%", column = "addUpAccumulationFundTotal")
@ExcelProperty(index = 9)
private String addUpAccumulationFundTotal;
@ExcelProperty(index = 10)
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
private String addUpChildEducation;
@ExcelProperty(index = 11)
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
private String addUpContinuingEducation;
@ExcelProperty(index = 12)
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
private String addUpHousingLoanInterest;
@ExcelProperty(index = 13)
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
private String addUpHousingRent;
@ExcelProperty(index = 14)
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
private String addUpSupportElderly;
@ExcelProperty(index = 15)
@SalaryTableColumn(text = "累计企业(职业)年金及其他福利", width = "10%", column = "addUpEnterpriseAndOther")
private String addUpEnterpriseAndOther;
@ExcelProperty(index = 16)
@SalaryTableColumn(text = "累计其他扣除", width = "10%", column = "addUpOtherDeduction")
private String addUpOtherDeduction;
@ExcelProperty(index = 17)
@SalaryTableColumn(text = "累计免税收入", width = "10%", column = "addUpTaxExemptIncome")
private String addUpTaxExemptIncome;
@ExcelProperty(index = 18)
@SalaryTableColumn(text = "累计准予扣除的捐赠额", width = "10%", column = "addUpAllowedDonation")
private String addUpAllowedDonation;
@ExcelProperty(index = 19)
@SalaryTableColumn(text = "累计已预扣预缴税额", width = "10%", column = "addUpAdvanceTax")
private String addUpAdvanceTax;
}

View File

@ -0,0 +1,85 @@
package com.engine.salary.entity.datacollection.dto;
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;
import java.time.LocalDate;
/**
* 数据采集-其他免税扣除列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a4f85287-e3f9-6612-adn9-7d06e54y6rj8", operates = {
@SalaryTableOperate(text = "查看明细")
})
public class OtherDeductionListDTO {
//主键id
@SalaryTableColumn(column = "id", display = false)
private Long id;
//员工id
private Long employeeId;
//姓名
@SalaryTableColumn(text = "姓名", width = "10%", column = "username")
private String username;
//个税扣缴义务人
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
private String taxAgentName;
//部门
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
private String departmentName;
//手机号
@SalaryTableColumn(text = "手机号", width = "10%", column = "mobile")
private String mobile;
//工号
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
private String jobNum;
//证件号码
@SalaryTableColumn(text = "证件号码", width = "10%", column = "idNo")
private String idNo;
//入职日期
@SalaryTableColumn(text = "入职日期", width = "10%", column = "hiredate", transmethod = "com.engine.salary.transmethod.TransMethod.timeToDate")
private LocalDate hiredate;
//商业健康保险
@SalaryTableColumn(text = "商业健康保险", width = "10%", column = "businessHealthyInsurance")
private String businessHealthyInsurance;
//税延养老保险
@SalaryTableColumn(text = "税延养老保险", width = "10%", column = "taxDelayEndowmentInsurance")
private String taxDelayEndowmentInsurance;
//其他
@SalaryTableColumn(text = "其他", width = "10%", column = "otherDeduction")
private String otherDeduction;
//准予扣除的捐赠额
@SalaryTableColumn(text = "准予扣除的捐赠额", width = "10%", column = "deductionAllowedDonation")
private String deductionAllowedDonation;
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
private String operate;
}

View File

@ -0,0 +1,72 @@
package com.engine.salary.entity.datacollection.dto;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 其他免税扣除记录列表
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@SalaryTable(pageId = "a4f85287-e3f9-6612-adn9-7d98e54y6rj8")
public class OtherDeductionRecordDTO {
//主键id
@SalaryTableColumn(column = "id", display = false)
private Long id;
//申报月份
@SalaryTableColumn(text = "申报月份", width = "10%", column = "declareMonth", transmethod = "com.engine.salary.transmethod.TransMethod.timeToMoth")
private Date declareMonth;
//员工id
private Long employeeId;
private String username;
//个税扣缴义务人
@SalaryTableColumn(text = "个税扣缴义务人", width = "10%", column = "taxAgentName")
private String taxAgentName;
//部门
@SalaryTableColumn(text = "部门", width = "10%", column = "departmentName")
private String departmentName;
//手机号
@SalaryTableColumn(text = "手机号", width = "10%", column = "mobile")
private String mobile;
//工号
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
private String jobNum;
//商业健康保险
@SalaryTableColumn(text = "商业健康保险", width = "10%", column = "businessHealthyInsurance")
private String businessHealthyInsurance;
//税延养老保险
@SalaryTableColumn(text = "税延养老保险", width = "10%", column = "taxDelayEndowmentInsurance")
private String taxDelayEndowmentInsurance;
//其他
@SalaryTableColumn(text = "其他", width = "10%", column = "otherDeduction")
private String otherDeduction;
//准予扣除的捐赠额
@SalaryTableColumn(text = "准予扣除的捐赠额", width = "10%", column = "deductionAllowedDonation")
private String deductionAllowedDonation;
}

View File

@ -0,0 +1,31 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 数据采集-累计专项附加扣除导入参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OtherDeductionImportParam {
//上传文件id
String imageId;
//税款所属期
String declareMonth;
//个税扣缴义务人
String taxAgentId;
}

View File

@ -0,0 +1,58 @@
package com.engine.salary.entity.datacollection.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
//数据采集-其他免税扣除查询参数
public class OtherDeductionQueryParam {
//主键id
private Collection<Long> ids;
//关键字姓名部门工号
private String keyword;
//主键id
private Long id;
//申报年月
private List<String> declareMonth;
//姓名
private String username;
//员工id
private Long employeeId;
//个税扣缴义务人的主键id
private Long taxAgentId;
//部门id
private List<Long> departmentIds;
//工号
private String jobNum;
//证件号
private String idNo;
//入职日期
private List<Date> hiredate;
//手机号
private String mobile;
//其他免税扣除id获取明细
private Long otherTaxExemptDeductionId;
}

View File

@ -0,0 +1,74 @@
package com.engine.salary.entity.datacollection.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* 数据采集-其他免税扣除表
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class OtherDeductionPO {
/**
* 主键
*/
private Long id;
/**
* 人员信息表的主键id
*/
private Long employeeId;
/**
* 个税扣缴义务人的主键id
*/
private Long taxAgentId;
/**
* 申报年月
*/
private Date declareMonth;
/**
* 商业健康保险
*/
private String businessHealthyInsurance;
/**
* 税延养老保险
*/
private String taxDelayEndowmentInsurance;
/**
* 其他
*/
private String otherDeduction;
/**
* 准予扣除的捐赠额
*/
private String deductionAllowedDonation;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Long creator;
/**
* 是否已删除0未删除1已删除
*/
private Integer deleteType;
/**
* 租户ID
*/
private String tenantKey;
private List<Long> employeeIds;
}

View File

@ -453,9 +453,9 @@
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like CONCAT('%',#{param.keyword},'%')
OR d.name like CONCAT('%',#{param.keyword},'%')
OR e.job_num like CONCAT('%',#{param.keyword},'%')
e.lastname like CONCAT('%',#{param.keyword},'%')
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
OR e.workcode like CONCAT('%',#{param.keyword},'%')
)
</if>
<!-- 税款所属期 -->
@ -469,7 +469,7 @@
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.username like CONCAT('%',#{param.username},'%')
AND e.lastname like CONCAT('%',#{param.username},'%')
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
@ -483,11 +483,11 @@
</if>
<!-- 工号 -->
<if test="param.jobNum != null and param.jobNum != ''">
AND e.job_num like CONCAT('%',#{param.jobNum},'%')
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
</if>
<!-- 入职日期 -->
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<!-- 手机号 -->
<if test="param.mobile != null and param.mobile != ''">
@ -511,9 +511,9 @@
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like '%'||#{param.keyword}||'%'
OR d.name like '%'||#{param.keyword}||'%'
OR e.job_num like '%'||#{param.keyword}||'%'
e.lastname like '%'||#{param.keyword}||'%'
OR d.departmentname like '%'||#{param.keyword}||'%'
OR e.workcode like '%'||#{param.keyword}||'%'
)
</if>
@ -527,7 +527,7 @@
</if>
<if test="param.username != null and param.username != ''">
AND e.username like '%'||#{param.username}||'%'
AND e.lastname like '%'||#{param.username}||'%'
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
@ -541,11 +541,11 @@
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.job_num like '%'||#{param.jobNum}||'%'
AND e.workcode like '%'||#{param.jobNum}||'%'
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<if test="param.mobile != null and param.mobile != ''">
@ -569,9 +569,9 @@
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.username like '%'+#{param.keyword}+'%'
OR d.name like '%'+#{param.keyword}+'%'
OR e.job_num like '%'+#{param.keyword}+'%'
e.lastname like '%'+#{param.keyword}+'%'
OR d.departmentname like '%'+#{param.keyword}+'%'
OR e.workcode like '%'+#{param.keyword}+'%'
)
</if>
@ -585,7 +585,7 @@
</if>
<if test="param.username != null and param.username != ''">
AND e.username like '%'+#{param.username}+'%'
AND e.lastname like '%'+#{param.username}+'%'
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
@ -599,11 +599,11 @@
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.job_num like '%'+#{param.jobNum}+'%'
AND e.workcode like '%'+#{param.jobNum}+'%'
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.hiredate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<if test="param.mobile != null and param.mobile != ''">

View File

@ -0,0 +1,18 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface EmployMapper {
/**
* 获取所有员工
* @return
*/
List<DataCollectionEmployee> listEmployee();
List<DataCollectionEmployee> getEmployeeByIds(@Param("collection") List<Long> ids);
}

View File

@ -0,0 +1,28 @@
<?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.datacollection.EmployMapper">
<!-- 员工基本信息 -->
<select id="listEmployee" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.ID as employeeId,
e.LASTNAME as username,
d.DEPARTMENTNAME as deparmentName
from hrmresource e
left join hrmdepartment d on e.departmentid = d.id
where e.status not in (7)
</select>
<select id="getEmployeeByIds" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.ID as employeeId,
e.LASTNAME as username
from hrmresource e
where e.status not in (7)
<if test="collection != null and collection.size()>0">
AND d.id IN
<foreach collection="collection" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
</select>
</mapper>

View File

@ -0,0 +1,87 @@
package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO;
import com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface OtherDeductionMapper {
/**
* 查询所有记录
*
* @return 返回集合没有返回空List
*/
List<OtherDeductionPO> listAll();
/**
* 根据主键查询
*
* @param id 主键
* @return 返回记录没有返回null
*/
OtherDeductionPO getById(Long id);
/**
* 新增忽略null字段
*
* @param OtherDeductionPO 新增的记录
* @return 返回影响行数
*/
int insertIgnoreNull(OtherDeductionPO OtherDeductionPO);
/**
* 修改修改所有字段
*
* @param OtherDeductionPO 修改的记录
* @return 返回影响行数
*/
int update(OtherDeductionPO OtherDeductionPO);
/**
* 修改忽略null字段
*
* @param OtherDeductionPO 修改的记录
* @return 返回影响行数
*/
int updateIgnoreNull(OtherDeductionPO OtherDeductionPO);
/**
* 删除记录
*
* @param OtherDeductionPO 待删除的记录
* @return 返回影响行数
*/
int delete(OtherDeductionPO OtherDeductionPO);
/**
* 查询数据采集-其他免税扣除列表
* @param param
* @return
*/
List<OtherDeductionListDTO> list(@Param("param") OtherDeductionQueryParam param);
List<OtherDeductionRecordDTO> recordList(@Param("param") OtherDeductionQueryParam param);
List<OtherDeductionPO> listSome(@Param("param") OtherDeductionPO param);
/**
* 批量插入
* @param pos
*/
void insertData(@Param("collection") List<OtherDeductionPO> pos);
/**
* 批量修改
* @param pos
*/
void updateData(@Param("collection") List<OtherDeductionPO> pos);
}

View File

@ -0,0 +1,592 @@
<?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.datacollection.OtherDeductionMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
<result column="id" property="id"/>
<result column="employee_id" property="employeeId"/>
<result column="tax_agent_id" property="taxAgentId"/>
<result column="declare_month" property="declareMonth"/>
<result column="business_healthy_insurance" property="businessHealthyInsurance"/>
<result column="tax_delay_endowment_insurance" property="taxDelayEndowmentInsurance"/>
<result column="other_deduction" property="otherDeduction"/>
<result column="deduction_allowed_donation" property="deductionAllowedDonation"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.employee_id
, t.tax_agent_id
, t.declare_month
, t.business_healthy_insurance
, t.tax_delay_endowment_insurance
, t.other_deduction
, t.deduction_allowed_donation
, t.create_time
, t.update_time
, t.creator
, t.delete_type
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_other_deduction t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_other_deduction t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
INSERT INTO hrsa_other_deduction
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="employeeId != null">
employee_id,
</if>
<if test="taxAgentId != null">
tax_agent_id,
</if>
<if test="declareMonth != null">
declare_month,
</if>
<if test="businessHealthyInsurance != null">
business_healthy_insurance,
</if>
<if test="taxDelayEndowmentInsurance != null">
tax_delay_endowment_insurance,
</if>
<if test="otherDeduction != null">
other_deduction,
</if>
<if test="deductionAllowedDonation != null">
deduction_allowed_donation,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="employeeId != null">
#{employeeId},
</if>
<if test="taxAgentId != null">
#{taxAgentId},
</if>
<if test="declareMonth != null">
#{declareMonth},
</if>
<if test="businessHealthyInsurance != null">
#{businessHealthyInsurance},
</if>
<if test="taxDelayEndowmentInsurance != null">
#{taxDelayEndowmentInsurance},
</if>
<if test="otherDeduction != null">
#{otherDeduction},
</if>
<if test="deductionAllowedDonation != null">
#{deductionAllowedDonation},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
UPDATE hrsa_other_deduction
<set>
employee_id=#{employeeId},
tax_agent_id=#{taxAgentId},
declare_month=#{declareMonth},
business_healthy_insurance=#{businessHealthyInsurance},
tax_delay_endowment_insurance=#{taxDelayEndowmentInsurance},
other_deduction=#{otherDeduction},
deduction_allowed_donation=#{deductionAllowedDonation},
create_time=#{createTime},
update_time=#{updateTime},
creator=#{creator},
delete_type=#{deleteType},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
UPDATE hrsa_other_deduction
<set>
<if test="employeeId != null">
employee_id=#{employeeId},
</if>
<if test="taxAgentId != null">
tax_agent_id=#{taxAgentId},
</if>
<if test="declareMonth != null">
declare_month=#{declareMonth},
</if>
<if test="businessHealthyInsurance != null">
business_healthy_insurance=#{businessHealthyInsurance},
</if>
<if test="taxDelayEndowmentInsurance != null">
tax_delay_endowment_insurance=#{taxDelayEndowmentInsurance},
</if>
<if test="otherDeduction != null">
other_deduction=#{otherDeduction},
</if>
<if test="deductionAllowedDonation != null">
deduction_allowed_donation=#{deductionAllowedDonation},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete" parameterType="com.engine.salary.entity.datacollection.po.OtherDeductionPO">
UPDATE hrsa_other_deduction
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
<sql id="otherDeductionColumn">
t1
.
id
,
t1.declare_month,
t1.employee_id,
t2.name AS tax_agent_name,
e.lastname as username,
d.departmentname AS departmentName,
e.mobile,
e.workcode as job_num,
e.companystartdate as hiredate,
t1.business_healthy_insurance,
t1.tax_delay_endowment_insurance,
t1.other_deduction,
t1.deduction_allowed_donation
</sql>
<sql id="paramSql">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<!-- 关键字(姓名、部门、工号 -->
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.lastname like CONCAT('%',#{param.keyword},'%')
OR d.departmentname like CONCAT('%',#{param.keyword},'%')
OR e.workcode like CONCAT('%',#{param.keyword},'%')
)
</if>
<!-- 申报月份 -->
<if test="param.declareMonth != null">
<if test="param.declareMonth.size() == 1">
AND t1.declare_month = #{param.declareMonth[0]}
</if>
<if test="param.declareMonth.size() == 2">
AND (t1.declare_month BETWEEN #{param.declareMonth[0]} AND #{param.declareMonth[1]})
</if>
</if>
<!-- 姓名 -->
<if test="param.username != null and param.username != ''">
AND e.lastname like CONCAT('%',#{param.username},'%')
</if>
<!-- 个税扣缴义务人 -->
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<!-- 工号 -->
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like CONCAT('%',#{param.jobNum},'%')
</if>
<!-- 入职日期 -->
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<!-- 手机号 -->
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like CONCAT('%',#{param.mobile},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.lastname like '%'||#{param.keyword}||'%'
OR d.departmentname like '%'||#{param.keyword}||'%'
OR e.workcode like '%'||#{param.keyword}||'%'
)
</if>
<if test="param.declareMonth != null">
<if test="param.declareMonth.size() == 1">
AND t1.declare_month = #{param.declareMonth[0]}
</if>
<if test="param.declareMonth.size() == 2">
AND (t1.declare_month BETWEEN #{param.declareMonth[0]} AND #{param.declareMonth[1]})
</if>
</if>
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'||#{param.username}||'%'
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like '%'||#{param.jobNum}||'%'
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like '%'||#{param.mobile}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.ids != null and param.ids.size()>0">
AND t1.id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.employeeId != null">
AND t1.employee_id = #{param.employeeId}
</if>
<if test="param.keyword != null and param.keyword != ''">
AND
(
e.lastname like '%'+#{param.keyword}+'%'
OR d.departmentname like '%'+#{param.keyword}+'%'
OR e.workcode like '%'+#{param.keyword}+'%'
)
</if>
<if test="param.declareMonth != null">
<if test="param.declareMonth.size() == 1">
AND t1.declare_month = #{param.declareMonth[0]}
</if>
<if test="param.declareMonth.size() == 2">
AND (t1.declare_month BETWEEN #{param.declareMonth[0]} AND #{param.declareMonth[1]})
</if>
</if>
<if test="param.username != null and param.username != ''">
AND e.lastname like '%'+#{param.username}+'%'
</if>
<if test="param.taxAgentId != null">
AND t1.tax_agent_id = #{param.taxAgentId}
</if>
<if test="param.departmentIds != null and param.departmentIds.size()>0">
AND d.id IN
<foreach collection="param.departmentIds" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.jobNum != null and param.jobNum != ''">
AND e.workcode like '%'+#{param.jobNum}+'%'
</if>
<if test="param.hiredate != null and param.hiredate.size() == 2">
AND (e.companystartdate BETWEEN #{param.hiredate[0]} AND #{param.hiredate[1]})
</if>
<if test="param.mobile != null and param.mobile != ''">
AND e.mobile like '%'+#{param.mobile}+'%'
</if>
</sql>
<select id="list" resultType="com.engine.salary.entity.datacollection.dto.OtherDeductionListDTO">
SELECT
<include refid="otherDeductionColumn"/>
FROM
hrsa_other_deduction t1
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
LEFT JOIN hrmresource e ON e.id = t1.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
WHERE
t1.delete_type = 0 AND t2.delete_type = 0
<include refid="paramSql"/>
ORDER BY t1.id DESC
</select>
<select id="recordList" resultType="com.engine.salary.entity.datacollection.dto.OtherDeductionRecordDTO">
SELECT
<include refid="otherDeductionColumn"/>
FROM
hrsa_other_deduction t1
LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id
LEFT JOIN hrmresource e ON e.id = t1.employee_id
LEFT JOIN hrmdepartment d ON d.id = e.departmentid
WHERE
t1.delete_type = 0 AND t2.delete_type = 0
<include refid="paramSql"/>
ORDER BY t1.declare_month DESC
</select>
<select id="listSome" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_other_deduction t
WHERE delete_type = 0
<if test="param.declareMonth != null">
and declare_month = #{param.declareMonth}
</if>
<if test="param.employeeIds != null and param.employeeIds.size()>0">
AND t1.employee_id IN
<foreach collection="param.employeeIds" open="(" item="employeeId" separator="," close=")">
#{employeeId}
</foreach>
</if>
</select>
<insert id="insertData">
INSERT INTO hrsa_other_deduction(
id,
employee_id,
tax_agent_id,
declare_month,
business_healthy_insurance,
tax_delay_endowment_insurance,
other_deduction,
deduction_allowed_donation,
create_time,
update_time,
creator,
tenant_key
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.declareMonth},
#{item.businessHealthyInsurance},
#{item.taxDelayEndowmentInsurance},
#{item.otherDeduction},
#{item.deductionAllowedDonation},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<insert id="insertData" databaseId="oracle">
INSERT INTO hrsa_other_deduction(
id,
employee_id,
tax_agent_id,
declare_month,
business_healthy_insurance,
tax_delay_endowment_insurance,
other_deduction,
deduction_allowed_donation,
create_time,
update_time,
creator,
tenant_key
)
<foreach collection="collection" item="item" separator="union all">
select
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.declareMonth},
#{item.businessHealthyInsurance},
#{item.taxDelayEndowmentInsurance},
#{item.otherDeduction},
#{item.deductionAllowedDonation},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
from dual
</foreach>
</insert>
<insert id="insertData" databaseId="sqlserver">
INSERT INTO hrsa_other_deduction(
id,
employee_id,
tax_agent_id,
declare_month,
business_healthy_insurance,
tax_delay_endowment_insurance,
other_deduction,
deduction_allowed_donation,
create_time,
update_time,
creator,
tenant_key
)
VALUES
<foreach collection="collection" item="item" separator=",">
(
#{item.id},
#{item.employeeId},
#{item.taxAgentId},
#{item.declareMonth},
#{item.businessHealthyInsurance},
#{item.taxDelayEndowmentInsurance},
#{item.otherDeduction},
#{item.deductionAllowedDonation},
#{item.createTime},
#{item.updateTime},
#{item.creator},
#{item.tenantKey}
)
</foreach>
</insert>
<update id="updateData" parameterType="java.util.List">
update hrsa_other_deduction
<trim prefix="set" suffixOverrides=",">
<trim prefix="business_healthy_insurance =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.businessHealthyInsurance!=null">
when id=#{item.id} then #{item.businessHealthyInsurance}
</if>
</foreach>
</trim>
<trim prefix="tax_delay_endowment_insurance =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.taxDelayEndowmentInsurance!=null">
when id=#{item.id} then #{item.taxDelayEndowmentInsurance}
</if>
</foreach>
</trim>
<trim prefix="other_deduction =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.otherDeduction!=null">
when id=#{item.id} then #{item.otherDeduction}
</if>
</foreach>
</trim>
<trim prefix="deduction_allowed_donation =case" suffix="end,">
<foreach collection="collection" item="item" index="index">
<if test="item.deductionAllowedDonation!=null">
when id=#{item.id} then #{item.deductionAllowedDonation}
</if>
</foreach>
</trim>
</trim>
where
id in
<foreach collection="collection" item="item" index="index" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
</mapper>

View File

@ -15,4 +15,8 @@ public interface AddUpSituationService {
Map<String, Object> importAddUpSituation(Map<String, Object> params);
XSSFWorkbook exportDetail(Map<String, Object> params);
Map<String, Object> getDetailList(Map<String, Object> params);
Map<String, Object> preview(Map<String, Object> params);
}

View File

@ -0,0 +1,53 @@
package com.engine.salary.service;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
/**
* 数据采集-其他免税扣除
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public interface OtherDeductionService {
/**
* 数据采集-其他免税扣除列表的高级搜索
*/
Map<String, Object> getSearchCondition(Map<String, Object> params);
/**
* 数据采集-其他免税扣除列表
*/
Map<String, Object> list(Map<String, Object> params);
/**
* 获取数据采集-其他免税扣除表单
*/
Map<String, Object> getDetailList(Map<String, Object> params);
/**
* 预览
*/
Map<String, Object> preview(Map<String, Object> params);
/**
* 导入数据
*/
Map<String, Object> importData(Map<String, Object> params);
/**
* 导出
*/
XSSFWorkbook export(Map<String, Object> params);
/**
* 导出详情
*/
XSSFWorkbook exportDetail(Map<String, Object> params);
}

View File

@ -33,4 +33,14 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation
public XSSFWorkbook exportDetail(Map<String, Object> params) {
return commandExecutor.execute(new AddUpSituationExportDetailCmd(params, user));
}
@Override
public Map<String, Object> getDetailList(Map<String, Object> params) {
return commandExecutor.execute(new AddUpSituationGetDetailListCmd(params, user));
}
@Override
public Map<String, Object> preview(Map<String, Object> params) {
return commandExecutor.execute(new AddUpSituationPreviewCmd(params, user));
}
}

View File

@ -0,0 +1,51 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.cmd.datacollection.*;
import com.engine.salary.service.OtherDeductionService;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
public class OtherDeductionServiceImpl extends Service implements OtherDeductionService {
@Override
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionGetSearchConditionCmd(params, user));
}
@Override
public Map<String, Object> list(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionListCmd(params, user));
}
@Override
public Map<String, Object> preview(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionPreviewCmd(params, user));
}
@Override
public Map<String, Object> importData(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionImportCmd(params, user));
}
@Override
public XSSFWorkbook export(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionExportCmd(params, user));
}
@Override
public XSSFWorkbook exportDetail(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionExportDetailCmd(params, user));
}
@Override
public Map<String, Object> getDetailList(Map<String, Object> params) {
return commandExecutor.execute(new OtherDeductionGetDetailListCmd(params, user));
}
}

View File

@ -14,7 +14,7 @@ public class ExcelUtil {
* @param rowList
* @return
*/
public static XSSFWorkbook genWorkbook(List<List<String>> rowList) {
public static XSSFWorkbook genWorkbook(List<List<String>> rowList,String sheetName) {
XSSFWorkbook workbook = new XSSFWorkbook();
// 设置title样式
@ -36,7 +36,7 @@ public class ExcelUtil {
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet("累计专项附加扣除明细");
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽

View File

@ -0,0 +1,274 @@
package com.engine.salary.web;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.datacollection.param.OtherDeductionQueryParam;
import com.engine.salary.entity.datacollection.param.OtherDeductionImportParam;
import com.engine.salary.service.OtherDeductionService;
import com.engine.salary.service.impl.OtherDeductionServiceImpl;
import com.engine.salary.util.ResponseResult;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.jetbrains.annotations.Nullable;
import weaver.general.GCONST;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
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.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 数据采集-其他免税扣除
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class OtherDeductionController {
private OtherDeductionService getService(User user) {
return (OtherDeductionService) ServiceUtil.getService(OtherDeductionServiceImpl.class, user);
}
/**
* 数据采集-累计专项附加扣除列表的高级搜索
*
* @return
*/
@GET
@Path("/getSearchCondition")
@Produces(MediaType.APPLICATION_JSON)
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
return ResponseResult.run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
}
@POST
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return ResponseResult.run(getService(user)::list, map);
}
@POST
@Path("/getDetailList")
@Produces(MediaType.APPLICATION_JSON)
public String getDetailList(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", queryParam);
return ResponseResult.run(getService(user)::getDetailList, map);
}
@GET
@Path("/downloadTemplate")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
//模板文件路径
String templateFilePath = GCONST.getRootPath() + "salary/otherDeduction/importTemplate.xlsx";
File file = new File(templateFilePath);
if (!file.exists()) {
return Response.status(Response.Status.NOT_FOUND).build();
}
String fileName = null;
try {
fileName = URLEncoder.encode("其他免税扣除导入模板.xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return Response
.ok(file)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
}
/**
* 导出
*
* @param
* @return
*/
@GET
@Path("/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
OtherDeductionQueryParam param = buildParam(request);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", param);
XSSFWorkbook workbook = getService(user).export(map);
String fileName = null;
try {
fileName = URLEncoder.encode("累计专项附加扣除.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();
}
@GET
@Path("/exportDetail")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
OtherDeductionQueryParam param = buildParam(request);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("queryParam", param);
XSSFWorkbook workbook = getService(user).exportDetail(map);
String fileName = null;
try {
fileName = URLEncoder.encode("累计专项附加扣除明细.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();
}
@Nullable
private OtherDeductionQueryParam buildParam(HttpServletRequest request) {
OtherDeductionQueryParam param = new OtherDeductionQueryParam();
String ids = request.getParameter("ids");
if(StringUtils.isNotBlank(ids)){
param.setIds( Arrays.stream(ids.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String keyword = request.getParameter("keyword");
if(StringUtils.isNotBlank(keyword)){
param.setKeyword(keyword);
}
String id = request.getParameter("id");
if(StringUtils.isNotBlank(id)){
param.setId(Long.valueOf(id));
}
String declareMonth = request.getParameter("declareMonth");
if(StringUtils.isNotBlank(declareMonth)){
param.setDeclareMonth(Arrays.asList(declareMonth.split(",")));
}
String username = request.getParameter("username");
if(StringUtils.isNotBlank(username)){
param.setUsername(username);
}
String employeeId = request.getParameter("employeeId");
if(StringUtils.isNotBlank(employeeId)){
param.setEmployeeId(Long.valueOf(employeeId));
}
String taxAgentId = request.getParameter("taxAgentId");
if(StringUtils.isNotBlank(taxAgentId)){
param.setTaxAgentId(Long.valueOf(taxAgentId));
}
String departmentIds = request.getParameter("departmentIds");
if(StringUtils.isNotBlank(departmentIds)){
param.setDepartmentIds(Arrays.stream(departmentIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
}
String jobNum = request.getParameter("jobNum");
if(StringUtils.isNotBlank(jobNum)){
param.setJobNum(jobNum);
}
String idNo = request.getParameter("idNo");
if(StringUtils.isNotBlank(idNo)){
param.setIdNo(idNo);
}
String hiredate = request.getParameter("hiredate");
if(StringUtils.isNotBlank(hiredate)){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
List<Date> dates = Arrays.stream(hiredate.split(",")).map(d -> {
try {
return format.parse(d);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}).collect(Collectors.toList());
param.setHiredate(dates);
}
String mobile = request.getParameter("mobile");
if(StringUtils.isNotBlank(mobile)){
param.setMobile(mobile);
}
String otherTaxExemptDeductionId = request.getParameter("otherTaxExemptDeductionId");
if(StringUtils.isNotBlank(otherTaxExemptDeductionId)){
param.setOtherTaxExemptDeductionId(Long.valueOf(otherTaxExemptDeductionId));
}
return param;
}
@POST
@Path("/preview")
@Produces(MediaType.APPLICATION_JSON)
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("importParam", importParam);
return ResponseResult.run(getService(user)::preview, map);
}
@POST
@Path("/importData")
@Produces(MediaType.APPLICATION_JSON)
public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody OtherDeductionImportParam importParam) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
map.put("importParam", importParam);
return ResponseResult.run(getService(user)::importData, map);
}
}