导出日志和申报表异常
This commit is contained in:
parent
525fcc49a7
commit
b0b18ecb5e
|
|
@ -16,7 +16,9 @@
|
|||
|
||||
<!-- 表字段 -->
|
||||
<sql id="baseColumns">
|
||||
t.create_time
|
||||
t
|
||||
.
|
||||
create_time
|
||||
, t.creator
|
||||
, t.delete_type
|
||||
, t.employee_id
|
||||
|
|
@ -46,22 +48,22 @@
|
|||
<select id="countEmployeeId" resultType="int">
|
||||
SELECT count(DISTINCT employee_id)
|
||||
FROM hrsa_tax_declaration_detail
|
||||
WHERE delete_type = 0
|
||||
WHERE delete_type = 0
|
||||
AND tax_declaration_id = #{taxDeclarationId}
|
||||
</select>
|
||||
<select id="listEmployeeId" resultType="long">
|
||||
SELECT DISTINCT employee_id
|
||||
FROM hrsa_tax_declaration_detail
|
||||
WHERE delete_type = 0
|
||||
WHERE delete_type = 0
|
||||
AND tax_declaration_id = #{taxDeclarationId}
|
||||
</select>
|
||||
<select id="listByTaxDeclarationIdAndEmployeeIds"
|
||||
resultType="com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_tax_declaration_detail t
|
||||
WHERE delete_type = 0
|
||||
AND tax_declaration_id = #{taxDeclarationId}
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_tax_declaration_detail t
|
||||
WHERE delete_type = 0
|
||||
AND tax_declaration_id = #{taxDeclarationId}
|
||||
<if test="collection != null and collection.size()>0">
|
||||
AND employee_id IN
|
||||
<foreach collection="collection" open="(" item="id" separator="," close=")">
|
||||
|
|
@ -193,6 +195,46 @@
|
|||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_tax_declaration_detail
|
||||
(id, tax_declaration_id, employee_id, field_code, field_value, creator,
|
||||
create_time, update_time, delete_type, tenant_key)
|
||||
|
||||
<foreach collection="collection" item="item" separator="union all">
|
||||
select
|
||||
#{item.id},
|
||||
#{item.taxDeclarationId},
|
||||
#{item.employeeId},
|
||||
#{item.fieldCode},
|
||||
#{item.fieldValue},
|
||||
#{item.creator},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
from dual
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
<foreach collection="collection" item="item" separator=";">
|
||||
INSERT INTO hrsa_tax_declaration_detail
|
||||
(tax_declaration_id, employee_id, field_code, field_value, creator,
|
||||
create_time, update_time, delete_type, tenant_key)
|
||||
VALUES
|
||||
(
|
||||
#{item.taxDeclarationId},
|
||||
#{item.employeeId},
|
||||
#{item.fieldCode},
|
||||
#{item.fieldValue},
|
||||
#{item.creator},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.deleteType},
|
||||
#{item.tenantKey}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 更新,更新全部字段 -->
|
||||
<update id="update" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail">
|
||||
UPDATE hrsa_tax_declaration_detail
|
||||
|
|
|
|||
|
|
@ -27,13 +27,7 @@ public interface TaxDeclarationMapper {
|
|||
*/
|
||||
TaxDeclaration getById(Long id);
|
||||
|
||||
/**
|
||||
* 新增,插入所有字段
|
||||
*
|
||||
* @param taxDeclaration 新增的记录
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
int insert(TaxDeclaration taxDeclaration);
|
||||
|
||||
|
||||
/**
|
||||
* 新增,忽略null字段
|
||||
|
|
|
|||
|
|
@ -59,12 +59,11 @@
|
|||
ORDER BY id DESC
|
||||
</select>
|
||||
<insert id="batchInsert">
|
||||
INSERT INTO hrsa_tax_declaration(id, salary_month, tax_cycle, tax_agent_id, description,
|
||||
INSERT INTO hrsa_tax_declaration( salary_month, tax_cycle, tax_agent_id, description,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
VALUES
|
||||
<foreach collection="collection" separator="," item="item">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.salaryMonth},
|
||||
#{item.taxCycle},
|
||||
#{item.taxAgentId},
|
||||
|
|
@ -78,12 +77,11 @@
|
|||
</foreach>
|
||||
</insert>
|
||||
<insert id="batchInsert" databaseId="oracle">
|
||||
INSERT INTO hrsa_tax_declaration(id, salary_month, tax_cycle, tax_agent_id, description,
|
||||
INSERT INTO hrsa_tax_declaration(salary_month, tax_cycle, tax_agent_id, description,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
|
||||
<foreach collection="collection" separator="union all" item="item">
|
||||
select
|
||||
#{item.id},
|
||||
#{item.salaryMonth},
|
||||
#{item.taxCycle},
|
||||
#{item.taxAgentId},
|
||||
|
|
@ -98,11 +96,10 @@
|
|||
</insert>
|
||||
<insert id="batchInsert" databaseId="sqlserver">
|
||||
<foreach collection="collection" separator=";" item="item">
|
||||
INSERT INTO hrsa_tax_declaration(id, salary_month, tax_cycle, tax_agent_id, description,
|
||||
INSERT INTO hrsa_tax_declaration(salary_month, tax_cycle, tax_agent_id, description,
|
||||
creator, create_time, update_time, delete_type, tenant_key)
|
||||
VALUES
|
||||
(
|
||||
#{item.id},
|
||||
#{item.salaryMonth},
|
||||
#{item.taxCycle},
|
||||
#{item.taxAgentId},
|
||||
|
|
@ -116,36 +113,7 @@
|
|||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 插入全部字段 -->
|
||||
<insert id="insert" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclaration"
|
||||
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
|
||||
>
|
||||
INSERT INTO hrsa_tax_declaration
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
create_time,
|
||||
creator,
|
||||
delete_type,
|
||||
description,
|
||||
id,
|
||||
salary_month,
|
||||
tax_agent_id,
|
||||
tax_cycle,
|
||||
tenant_key,
|
||||
update_time,
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
#{createTime},
|
||||
#{creator},
|
||||
#{deleteType},
|
||||
#{description},
|
||||
#{id},
|
||||
#{salaryMonth},
|
||||
#{taxAgentId},
|
||||
#{taxCycle},
|
||||
#{tenantKey},
|
||||
#{updateTime},
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 插入不为NULL的字段 -->
|
||||
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclaration"
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
.setMessage(StringUtils.EMPTY);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 100);
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 500);
|
||||
// 12.1、监控子线程的任务执行
|
||||
CountDownLatch childMonitor = new CountDownLatch(partition.size());
|
||||
// 12.2、记录子线程的执行结果
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.engine.salary.service.AddUpDeductionService;
|
|||
import com.engine.salary.service.impl.AddUpDeductionServiceImpl;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -35,6 +36,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class AddUpDeductionController {
|
||||
|
||||
private AddUpDeductionService getService(User user) {
|
||||
|
|
@ -51,7 +53,7 @@ public class AddUpDeductionController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -62,7 +64,7 @@ public class AddUpDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -70,22 +72,28 @@ public class AddUpDeductionController {
|
|||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
AddUpDeductionQueryParam queryParam = buildParam(request);
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(queryParam);
|
||||
String fileName = "累计专项附加扣除导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
AddUpDeductionQueryParam queryParam = buildParam(request);
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(queryParam);
|
||||
String fileName = "累计专项附加扣除导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计专项附加扣除导入模板异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -99,31 +107,37 @@ public class AddUpDeductionController {
|
|||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpDeductionQueryParam param = buildParam(request);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("addUpDeductionQueryParam", param);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).export(map);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("累计专项附加扣除.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpDeductionQueryParam param = buildParam(request);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("addUpDeductionQueryParam", param);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).export(map);
|
||||
|
||||
String fileName = "累计专项附加扣除" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计专项附加扣除导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -131,31 +145,38 @@ public class AddUpDeductionController {
|
|||
@Path("/exportDetail")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpDeductionQueryParam param = buildParam(request);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("addUpDeductionQueryParam", param);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).exportDetail(map);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("累计专项附加扣除明细.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpDeductionQueryParam param = buildParam(request);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("addUpDeductionQueryParam", param);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).exportDetail(map);
|
||||
|
||||
String fileName = "累计专项附加扣除明细" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计专项附加扣除明细导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -233,7 +254,7 @@ public class AddUpDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -243,7 +264,7 @@ public class AddUpDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importAddUpDeduction, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importAddUpDeduction, map);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -253,7 +274,7 @@ public class AddUpDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class AddUpSituationController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ public class AddUpSituationController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -74,7 +74,7 @@ public class AddUpSituationController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -82,30 +82,32 @@ public class AddUpSituationController {
|
|||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(queryParam);
|
||||
|
||||
String fileName = "往期累计情况导入模板" + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e.getMessage(),e);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(queryParam);
|
||||
|
||||
String fileName = "往期累计情况导入模板" + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("往期累计情况导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -119,30 +121,35 @@ public class AddUpSituationController {
|
|||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
map.put("queryParam", queryParam);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).export(map);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("累计情况.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
map.put("queryParam", queryParam);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).export(map);
|
||||
|
||||
String fileName = "累计情况" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计情况导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -156,30 +163,35 @@ public class AddUpSituationController {
|
|||
@Path("/exportDetail")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportDetail(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
map.put("queryParam", queryParam);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).exportDetail(map);
|
||||
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = URLEncoder.encode("累计情况明细.xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
AddUpSituationQueryParam queryParam = buildParam(request);
|
||||
map.put("queryParam", queryParam);
|
||||
|
||||
XSSFWorkbook workbook = getService(user).exportDetail(map);
|
||||
|
||||
String fileName = "累计情况明细" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计情况明细导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -263,7 +275,7 @@ public class AddUpSituationController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importAddUpSituation, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importAddUpSituation, map);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -273,9 +285,8 @@ public class AddUpSituationController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.engine.salary.wrapper.AttendQuoteFieldSettingWrapper;
|
|||
import com.engine.salary.wrapper.AttendQuoteFieldWrapper;
|
||||
import com.engine.salary.wrapper.AttendQuoteWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
|
|
@ -36,6 +37,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class AttendQuoteController {
|
||||
|
||||
private AttendQuoteWrapper getAttendQuoteWrapper(User user) {
|
||||
|
|
@ -112,33 +114,39 @@ public class AttendQuoteController {
|
|||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response downloadTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String salaryYearMonth = request.getParameter("salaryYearMonth");
|
||||
String salarySobId = request.getParameter("salarySobId");
|
||||
AttendQuoteDataExportTemplateParam param = AttendQuoteDataExportTemplateParam.builder()
|
||||
.salarySobId(Long.valueOf(salarySobId))
|
||||
.salaryYearMonth(YearMonth.parse(salaryYearMonth))
|
||||
.build();
|
||||
if (param.getSalaryYearMonth() == null || param.getSalarySobId() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100250, "薪资所属月和薪资账套id不能为空"));
|
||||
}
|
||||
XSSFWorkbook workbook = getAttendQuoteDataWrapper(user).downloadTemplate(param);
|
||||
String fileName = "考勤引用导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String salaryYearMonth = request.getParameter("salaryYearMonth");
|
||||
String salarySobId = request.getParameter("salarySobId");
|
||||
AttendQuoteDataExportTemplateParam param = AttendQuoteDataExportTemplateParam.builder()
|
||||
.salarySobId(Long.valueOf(salarySobId))
|
||||
.salaryYearMonth(YearMonth.parse(salaryYearMonth))
|
||||
.build();
|
||||
if (param.getSalaryYearMonth() == null || param.getSalarySobId() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100250, "薪资所属月和薪资账套id不能为空"));
|
||||
}
|
||||
XSSFWorkbook workbook = getAttendQuoteDataWrapper(user).downloadTemplate(param);
|
||||
String fileName = "考勤引用导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("考勤引用导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -217,26 +225,33 @@ public class AttendQuoteController {
|
|||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String attendQuoteId = request.getParameter("attendQuoteId");
|
||||
AttendQuoteDataQueryParam param = AttendQuoteDataQueryParam.builder().attendQuoteId(Long.valueOf(attendQuoteId)).build();
|
||||
XSSFWorkbook workbook = getAttendQuoteDataWrapper(user).export(param);
|
||||
String fileName = "考勤导出" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String attendQuoteId = request.getParameter("attendQuoteId");
|
||||
AttendQuoteDataQueryParam param = AttendQuoteDataQueryParam.builder().attendQuoteId(Long.valueOf(attendQuoteId)).build();
|
||||
XSSFWorkbook workbook = getAttendQuoteDataWrapper(user).export(param);
|
||||
String fileName = "考勤导出" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("考勤导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ 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 lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -43,6 +44,7 @@ import java.util.stream.Collectors;
|
|||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class OtherDeductionController {
|
||||
|
||||
private OtherDeductionService getService(User user) {
|
||||
|
|
@ -59,7 +61,7 @@ public class OtherDeductionController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getSearchCondition, ParamUtil.request2Map(request));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -70,7 +72,7 @@ public class OtherDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::list, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -81,7 +83,7 @@ public class OtherDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("queryParam", queryParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::getDetailList, map);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -89,24 +91,28 @@ public class OtherDeductionController {
|
|||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response getAll(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
OtherDeductionQueryParam param = buildParam(request);
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(param);
|
||||
String fileName = "其他免税扣除导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
OtherDeductionQueryParam param = buildParam(request);
|
||||
XSSFWorkbook workbook = getService(user).downloadTemplate(param);
|
||||
String fileName = "其他免税扣除导入模板" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("其他免税扣除导入模板异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -120,31 +126,36 @@ public class OtherDeductionController {
|
|||
@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();
|
||||
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("其他免税扣除" + LocalDate.now() + ".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();
|
||||
} catch (Exception e) {
|
||||
log.error("其他免税扣除导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -152,79 +163,85 @@ public class OtherDeductionController {
|
|||
@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();
|
||||
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 = "累计专项附加扣除明细" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output)
|
||||
.header("Content-disposition", "attachment;filename=" + fileName)
|
||||
.header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("累计专项附加扣除明细导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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()));
|
||||
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)){
|
||||
if (StringUtils.isNotBlank(keyword)) {
|
||||
param.setKeyword(keyword);
|
||||
}
|
||||
String id = request.getParameter("id");
|
||||
if(StringUtils.isNotBlank(id)){
|
||||
if (StringUtils.isNotBlank(id)) {
|
||||
param.setId(Long.valueOf(id));
|
||||
}
|
||||
String declareMonth = request.getParameter("declareMonth");
|
||||
if(StringUtils.isNotBlank(declareMonth)){
|
||||
if (StringUtils.isNotBlank(declareMonth)) {
|
||||
param.setDeclareMonth(Arrays.asList(declareMonth.split(",")));
|
||||
}
|
||||
|
||||
String username = request.getParameter("username");
|
||||
if(StringUtils.isNotBlank(username)){
|
||||
if (StringUtils.isNotBlank(username)) {
|
||||
param.setUsername(username);
|
||||
}
|
||||
String employeeId = request.getParameter("employeeId");
|
||||
if(StringUtils.isNotBlank(employeeId)){
|
||||
if (StringUtils.isNotBlank(employeeId)) {
|
||||
param.setEmployeeId(Long.valueOf(employeeId));
|
||||
}
|
||||
String taxAgentId = request.getParameter("taxAgentId");
|
||||
if(StringUtils.isNotBlank(taxAgentId)){
|
||||
if (StringUtils.isNotBlank(taxAgentId)) {
|
||||
param.setTaxAgentId(Long.valueOf(taxAgentId));
|
||||
}
|
||||
String departmentIds = request.getParameter("departmentIds");
|
||||
if(StringUtils.isNotBlank(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)){
|
||||
if (StringUtils.isNotBlank(jobNum)) {
|
||||
param.setJobNum(jobNum);
|
||||
}
|
||||
String idNo = request.getParameter("idNo");
|
||||
if(StringUtils.isNotBlank(idNo)){
|
||||
if (StringUtils.isNotBlank(idNo)) {
|
||||
param.setIdNo(idNo);
|
||||
}
|
||||
String hiredate = request.getParameter("hiredate");
|
||||
if(StringUtils.isNotBlank(hiredate)){
|
||||
if (StringUtils.isNotBlank(hiredate)) {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<Date> dates = Arrays.stream(hiredate.split(",")).map(d -> {
|
||||
try {
|
||||
|
|
@ -237,11 +254,11 @@ public class OtherDeductionController {
|
|||
param.setHiredate(dates);
|
||||
}
|
||||
String mobile = request.getParameter("mobile");
|
||||
if(StringUtils.isNotBlank(mobile)){
|
||||
if (StringUtils.isNotBlank(mobile)) {
|
||||
param.setMobile(mobile);
|
||||
}
|
||||
String otherTaxExemptDeductionId = request.getParameter("otherTaxExemptDeductionId");
|
||||
if(StringUtils.isNotBlank(otherTaxExemptDeductionId)){
|
||||
if (StringUtils.isNotBlank(otherTaxExemptDeductionId)) {
|
||||
param.setOtherTaxExemptDeductionId(Long.valueOf(otherTaxExemptDeductionId));
|
||||
}
|
||||
return param;
|
||||
|
|
@ -254,7 +271,7 @@ public class OtherDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::preview, map);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
|
@ -264,9 +281,8 @@ public class OtherDeductionController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("importParam", importParam);
|
||||
return new ResponseResult< Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importData, map);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::importData, map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.engine.salary.util.SalaryDateUtil;
|
|||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.wrapper.*;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -44,6 +45,7 @@ import java.util.stream.Collectors;
|
|||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SalaryAcctController {
|
||||
|
||||
private SalaryAcctRecordWrapper salaryAcctRecordWrapper;
|
||||
|
|
@ -226,23 +228,29 @@ public class SalaryAcctController {
|
|||
@Path("/acctemployee/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportSalaryAcctEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryAcctEmployeeQueryParam param = buildSalaryAcctEmployeeQueryParam(request);
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctEmployee(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "核算人员范围" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryAcctEmployeeQueryParam param = buildSalaryAcctEmployeeQueryParam(request);
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctEmployee(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "核算人员范围" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("核算人员范围导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -290,22 +298,27 @@ public class SalaryAcctController {
|
|||
@Path("/reducedemployee/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportReducedEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryAcctEmployeeQueryParam param = buildSalaryAcctEmployeeQueryParam(request);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportReducedEmployee(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "环比上月减少人员" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryAcctEmployeeQueryParam param = buildSalaryAcctEmployeeQueryParam(request);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportReducedEmployee(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "环比上月减少人员" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("环比上月减少人员导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -364,22 +377,27 @@ public class SalaryAcctController {
|
|||
@Path("/acctresult/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportSalaryAcctResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryAcctResultQueryParam param = new SalaryAcctResultQueryParam();
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctResult(param);
|
||||
String fileName = "薪资核算结果" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryAcctResultQueryParam param = new SalaryAcctResultQueryParam();
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportSalaryAcctResult(param);
|
||||
String fileName = "薪资核算结果" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("薪资核算结果导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -397,33 +415,39 @@ public class SalaryAcctController {
|
|||
@Path("/acctresult/importtemplate/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryAcctImportTemplateParam param = new SalaryAcctImportTemplateParam();
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
|
||||
String importType = request.getParameter("importType");
|
||||
if (StringUtils.isNotBlank(importType)) {
|
||||
param.setImportType(importType);
|
||||
}
|
||||
String salaryItemIds = request.getParameter("salaryItemIds");
|
||||
if (StringUtils.isNotBlank(salaryItemIds)) {
|
||||
param.setSalaryItemIds(Arrays.stream(salaryItemIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportImportTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "薪资核算导入模板" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryAcctImportTemplateParam param = new SalaryAcctImportTemplateParam();
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
|
||||
String importType = request.getParameter("importType");
|
||||
if (StringUtils.isNotBlank(importType)) {
|
||||
param.setImportType(importType);
|
||||
}
|
||||
String salaryItemIds = request.getParameter("salaryItemIds");
|
||||
if (StringUtils.isNotBlank(salaryItemIds)) {
|
||||
param.setSalaryItemIds(Arrays.stream(salaryItemIds.split(",")).map(Long::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportImportTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "薪资核算导入模板" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("薪资核算导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
//导入核算结果
|
||||
|
|
@ -536,33 +560,38 @@ public class SalaryAcctController {
|
|||
@Path("/comparisonresult/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportComparisonResult(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryComparisonResultQueryParam param = new SalaryComparisonResultQueryParam();
|
||||
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
String onlyDiffEmployee = request.getParameter("onlyDiffEmployee");
|
||||
if (StringUtils.isNotBlank(onlyDiffEmployee)) {
|
||||
param.setOnlyDiffEmployee(Boolean.parseBoolean(onlyDiffEmployee));
|
||||
}
|
||||
String onlyDiffSalaryItem = request.getParameter("onlyDiffSalaryItem");
|
||||
if (StringUtils.isNotBlank(onlyDiffSalaryItem)) {
|
||||
param.setOnlyDiffSalaryItem(Boolean.parseBoolean(onlyDiffSalaryItem));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResult(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "线下对比结果" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryComparisonResultQueryParam param = new SalaryComparisonResultQueryParam();
|
||||
|
||||
setSalaryAcctResultQueryParam(request, param);
|
||||
String onlyDiffEmployee = request.getParameter("onlyDiffEmployee");
|
||||
if (StringUtils.isNotBlank(onlyDiffEmployee)) {
|
||||
param.setOnlyDiffEmployee(Boolean.parseBoolean(onlyDiffEmployee));
|
||||
}
|
||||
String onlyDiffSalaryItem = request.getParameter("onlyDiffSalaryItem");
|
||||
if (StringUtils.isNotBlank(onlyDiffSalaryItem)) {
|
||||
param.setOnlyDiffSalaryItem(Boolean.parseBoolean(onlyDiffSalaryItem));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResult(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "线下对比结果" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("线下对比结果导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
private void setSalaryAcctResultQueryParam(HttpServletRequest request, SalaryAcctResultQueryParam param) {
|
||||
|
|
@ -608,27 +637,33 @@ public class SalaryAcctController {
|
|||
@Path("/comparisonresult/importtemplate/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportComparisonResultTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
SalaryComparisonResultExportParam param = new SalaryComparisonResultExportParam();
|
||||
String salaryAcctRecordId = request.getParameter("salaryAcctRecordId");
|
||||
if (StringUtils.isNotBlank(salaryAcctRecordId)) {
|
||||
param.setSalaryAcctRecordId(Long.parseLong(salaryAcctRecordId));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResultTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "线下对比结果导入模板" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
SalaryComparisonResultExportParam param = new SalaryComparisonResultExportParam();
|
||||
String salaryAcctRecordId = request.getParameter("salaryAcctRecordId");
|
||||
if (StringUtils.isNotBlank(salaryAcctRecordId)) {
|
||||
param.setSalaryAcctRecordId(Long.parseLong(salaryAcctRecordId));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSalaryAcctExcelWrapper(user).exportComparisonResultTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "线下对比结果导入模板" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("线下对比结果导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
//导入线下核算结果
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.engine.salary.wrapper.SalaryArchiveItemWrapper;
|
|||
import com.engine.salary.wrapper.SalaryArchiveTaxAgentWrapper;
|
||||
import com.engine.salary.wrapper.SalaryArchiveWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -42,6 +43,7 @@ import java.util.stream.Collectors;
|
|||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SalaryArchiveController {
|
||||
private SalaryArchiveWrapper getSalaryArchiveWrapper(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveWrapper.class, user);
|
||||
|
|
@ -81,25 +83,31 @@ public class SalaryArchiveController {
|
|||
@Path("/exportList")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
SalaryArchiveQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveWrapper(user).exportList(queryParam);
|
||||
|
||||
String fileName = "薪资档案" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
SalaryArchiveQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveWrapper(user).exportList(queryParam);
|
||||
|
||||
String fileName = "薪资档案" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("薪资档案导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -169,28 +177,33 @@ public class SalaryArchiveController {
|
|||
@Path("/downloadTemplate")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response downloadTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
SalaryArchiveQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveWrapper(user).downloadTemplate(queryParam);
|
||||
|
||||
SalaryArchiveImportTypeEnum importTypeEnum = SalaryArchiveImportTypeEnum.parseByValue(queryParam.getImportType());
|
||||
|
||||
String fileName = "薪资档案导入模板-" + importTypeEnum.getDefaultLabel() + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
SalaryArchiveQueryParam queryParam = buildParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveWrapper(user).downloadTemplate(queryParam);
|
||||
|
||||
SalaryArchiveImportTypeEnum importTypeEnum = SalaryArchiveImportTypeEnum.parseByValue(queryParam.getImportType());
|
||||
|
||||
String fileName = "薪资档案导入模板-" + importTypeEnum.getDefaultLabel() + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("薪资档案导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -438,29 +451,34 @@ public class SalaryArchiveController {
|
|||
@Path("/adjustRecord/exportSalaryItemList")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportSalaryItemList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
SalaryItemAdjustRecordQueryParam param = getSalaryItemAdjustRecordQueryParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveItemWrapper(user).exportAdjustRecordList(param);
|
||||
|
||||
String fileName = "薪资项目调整记录" + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
SalaryItemAdjustRecordQueryParam param = getSalaryItemAdjustRecordQueryParam(request);
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveItemWrapper(user).exportAdjustRecordList(param);
|
||||
|
||||
String fileName = "薪资项目调整记录" + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("薪资项目调整记录导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
|
@ -572,30 +590,34 @@ public class SalaryArchiveController {
|
|||
@Path("/adjustRecord/exportTaxAgentList")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportTaxAgentList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
TaxAgentAdjustRecordQueryParam param = new TaxAgentAdjustRecordQueryParam();
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveTaxAgentWrapper(user).exportAdjustRecordList(param);
|
||||
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "个税扣缴义务人调整记录" + time;
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
TaxAgentAdjustRecordQueryParam param = new TaxAgentAdjustRecordQueryParam();
|
||||
|
||||
XSSFWorkbook workbook = getSalaryArchiveTaxAgentWrapper(user).exportAdjustRecordList(param);
|
||||
|
||||
String fileName = "个税扣缴义务人调整记录" + LocalDate.now();
|
||||
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("个税扣缴义务人调整记录导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.engine.salary.util.page.PageInfo;
|
|||
import com.engine.salary.wrapper.TaxDeclarationDetailWrapper;
|
||||
import com.engine.salary.wrapper.TaxDeclarationWrapper;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -31,83 +32,91 @@ import javax.ws.rs.core.StreamingOutput;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class TaxDeclarationController {
|
||||
|
||||
// private BaseBean logger = new BaseBean();
|
||||
// private BaseBean logger = new BaseBean();
|
||||
|
||||
private TaxDeclarationService getService(User user) {
|
||||
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||
}
|
||||
private TaxDeclarationService getService(User user) {
|
||||
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private TaxDeclarationWrapper getTaxDeclarationWrapper(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationWrapper.class, user);
|
||||
}
|
||||
private TaxDeclarationExcelService getTaxDeclarationExcelService(User user) {
|
||||
return (TaxDeclarationExcelService)ServiceUtil.getService(TaxDeclarationExcelServiceImpl.class, user);
|
||||
}
|
||||
private TaxDeclarationDetailWrapper getTaxDeclarationDetailWrapper(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationDetailWrapper.class, user);
|
||||
}
|
||||
private TaxDeclarationWrapper getTaxDeclarationWrapper(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationWrapper.class, user);
|
||||
}
|
||||
|
||||
//个税申报表列表
|
||||
@POST
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr()==null?"":queryParam.getFromSalaryMonthStr()));
|
||||
queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr()==null?"":queryParam.getEndSalaryMonthStr()));
|
||||
return new ResponseResult<TaxDeclarationListQueryParam, PageInfo<TaxDeclarationListDTO>>(user).run(getTaxDeclarationWrapper(user)::listPage, queryParam);
|
||||
}
|
||||
private TaxDeclarationExcelService getTaxDeclarationExcelService(User user) {
|
||||
return (TaxDeclarationExcelService) ServiceUtil.getService(TaxDeclarationExcelServiceImpl.class, user);
|
||||
}
|
||||
|
||||
//个税申报表表单
|
||||
@GET
|
||||
@Path("/getForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, TaxDeclarationFormDTO>(user).run(getTaxDeclarationWrapper(user)::getForm, id);
|
||||
}
|
||||
//个税申报表相关信息
|
||||
@GET
|
||||
@Path("/getTaxDeclarationInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTaxDeclarationInfo(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, TaxDeclarationInfoDTO>(user).run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId);
|
||||
}
|
||||
//个税申报表生成
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationSaveParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
|
||||
param.setUser(user);
|
||||
return new ResponseResult<TaxDeclarationSaveParam, Long>(user).run(getTaxDeclarationWrapper(user)::save, param);
|
||||
}
|
||||
//个税申报表详情列表
|
||||
@POST
|
||||
@Path("/detail/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listTaxDeclarationDetail(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationDetailListQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
param.setTaxDeclarationId(Long.parseLong(param.getTaxDeclarationIdStr()));
|
||||
return new ResponseResult<TaxDeclarationDetailListQueryParam, Map<String, Object>>(user).run(getTaxDeclarationDetailWrapper(user)::listPage, param);
|
||||
}
|
||||
private TaxDeclarationDetailWrapper getTaxDeclarationDetailWrapper(User user) {
|
||||
return ServiceUtil.getService(TaxDeclarationDetailWrapper.class, user);
|
||||
}
|
||||
|
||||
//个税申报表相关信息
|
||||
@GET
|
||||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
||||
//个税申报表列表
|
||||
@POST
|
||||
@Path("/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr() == null ? "" : queryParam.getFromSalaryMonthStr()));
|
||||
queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr() == null ? "" : queryParam.getEndSalaryMonthStr()));
|
||||
return new ResponseResult<TaxDeclarationListQueryParam, PageInfo<TaxDeclarationListDTO>>(user).run(getTaxDeclarationWrapper(user)::listPage, queryParam);
|
||||
}
|
||||
|
||||
//个税申报表表单
|
||||
@GET
|
||||
@Path("/getForm")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, TaxDeclarationFormDTO>(user).run(getTaxDeclarationWrapper(user)::getForm, id);
|
||||
}
|
||||
|
||||
//个税申报表相关信息
|
||||
@GET
|
||||
@Path("/getTaxDeclarationInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getTaxDeclarationInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<Long, TaxDeclarationInfoDTO>(user).run(getTaxDeclarationWrapper(user)::getTaxDeclarationInfoById, taxDeclarationId);
|
||||
}
|
||||
|
||||
//个税申报表生成
|
||||
@POST
|
||||
@Path("/save")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String save(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationSaveParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
param.setSalaryMonth(SalaryDateUtil.String2YearMonth(param.getSalaryMonthStr()));
|
||||
param.setUser(user);
|
||||
return new ResponseResult<TaxDeclarationSaveParam, Long>(user).run(getTaxDeclarationWrapper(user)::save, param);
|
||||
}
|
||||
|
||||
//个税申报表详情列表
|
||||
@POST
|
||||
@Path("/detail/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listTaxDeclarationDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationDetailListQueryParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
param.setTaxDeclarationId(Long.parseLong(param.getTaxDeclarationIdStr()));
|
||||
return new ResponseResult<TaxDeclarationDetailListQueryParam, Map<String, Object>>(user).run(getTaxDeclarationDetailWrapper(user)::listPage, param);
|
||||
}
|
||||
|
||||
//个税申报表相关信息
|
||||
@GET
|
||||
@Path("/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getTaxDeclarationExcelService(user).exportTaxDeclaration(taxDeclarationId);
|
||||
|
||||
String fileName = "个税申报表";
|
||||
String fileName = "个税申报表" + LocalDate.now();
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
|
|
@ -120,6 +129,9 @@ public class TaxDeclarationController {
|
|||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("个税申报表导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue