From c8b05f5ef19b684397b7658181da278d7d75cf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 8 Mar 2022 13:17:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../engine/salary/biz/AddUpDeductionBiz.java | 1 + .../AddUpDeductionGetSearchConditionCmd.java | 2 +- .../datacollection/AddUpDeductionListCmd.java | 56 +----- .../AddUpSituationGetSearchConditionCmd.java | 105 +++++++++++ .../datacollection/AddUpSituationListCmd.java | 177 ++++++++++++++++++ .../param/AddUpDeductionQueryParam.java | 4 +- .../param/AddUpSituationQueryParam.java | 62 ++++++ .../datacollection/vo/AddUpDeductionVO.java | 43 +++++ .../datacollection/AddUpSituationMapper.java | 31 +++ .../salary/service/AddUpSituationService.java | 16 ++ .../impl/AddUpSituationServiceImpl.java | 34 ++++ .../salary/web/AddUpDeductionController.java | 82 +++++++- .../salary/web/AddUpSituationController.java | 98 +++++++++- 13 files changed, 652 insertions(+), 59 deletions(-) create mode 100644 src/com/engine/salary/cmd/datacollection/AddUpSituationGetSearchConditionCmd.java create mode 100644 src/com/engine/salary/cmd/datacollection/AddUpSituationListCmd.java create mode 100644 src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java create mode 100644 src/com/engine/salary/entity/datacollection/vo/AddUpDeductionVO.java create mode 100644 src/com/engine/salary/service/AddUpSituationService.java create mode 100644 src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java diff --git a/src/com/engine/salary/biz/AddUpDeductionBiz.java b/src/com/engine/salary/biz/AddUpDeductionBiz.java index dc5041f34..1377d138f 100644 --- a/src/com/engine/salary/biz/AddUpDeductionBiz.java +++ b/src/com/engine/salary/biz/AddUpDeductionBiz.java @@ -30,6 +30,7 @@ public class AddUpDeductionBiz extends BaseBean { * @return */ public List list(AddUpDeductionQueryParam param) { + //fixme 入职日期用的创建日期 SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); try { AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class); diff --git a/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetSearchConditionCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetSearchConditionCmd.java index e833f535c..9840a660e 100644 --- a/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetSearchConditionCmd.java +++ b/src/com/engine/salary/cmd/datacollection/AddUpDeductionGetSearchConditionCmd.java @@ -48,7 +48,7 @@ public class AddUpDeductionGetSearchConditionCmd extends AbstractCommonCommand> { @@ -55,19 +53,7 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand apidatas = new HashMap(16); - - WeaResultMsg result = new WeaResultMsg(false); - String pageID = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8"; - String pageUid = pageID + "_" + user.getUID(); - String pageSize = PageIdConst.getPageSize(pageID, user.getUID()); - - - WeaTable table = new WeaTable(); - table.setPageUID(pageUid); - table.setPageID(pageID); - table.setPagesize(pageSize); + SalaryWeaTable table = new SalaryWeaTable<>(user, AddUpDeductionVO.class); table.setBackfields(fileds); table.setSqlform(fromSql); table.setSqlwhere(makeSqlWhere()); @@ -75,30 +61,10 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand operateList = new ArrayList<>(); - WeaTableOperate delete = new WeaTableOperate("删除", "", "0"); - operateList.add(delete); - WeaTableOperates weaTableOperates = new WeaTableOperates(); - weaTableOperates.setOperate(operateList); - table.setOperates(weaTableOperates); - - //设置check是否可用 - table.setCheckboxList(null); - table.setCheckboxpopedom(null); + WeaResultMsg result = new WeaResultMsg(false); result.putAll(table.makeDataResult()); result.success(); - apidatas = result.getResultMap(); - return apidatas; + return result.getResultMap(); } @@ -161,7 +127,7 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand hiredate = queryParam.getHiredate(); + List hiredate = queryParam.getHiredate(); if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) { sqlWhere += " AND (e.created BETWEEN "+hiredate.get(0)+" AND "+hiredate.get(1)+")"; } @@ -173,6 +139,4 @@ public class AddUpDeductionListCmd extends AbstractCommonCommand> { + + public AddUpSituationGetSearchConditionCmd(Map params, User user) { + this.user = user; + this.params = params; + } + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + Map apidatas = new HashMap(); + ConditionFactory conditionFactory = new ConditionFactory(user); + + //条件组 + List addGroups = new ArrayList(); + + List conditionItems = new ArrayList(); + + //文本输入框 + 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","124"); + 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 dateOptions = new ArrayList(); + 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; + } + +} diff --git a/src/com/engine/salary/cmd/datacollection/AddUpSituationListCmd.java b/src/com/engine/salary/cmd/datacollection/AddUpSituationListCmd.java new file mode 100644 index 000000000..4a67718eb --- /dev/null +++ b/src/com/engine/salary/cmd/datacollection/AddUpSituationListCmd.java @@ -0,0 +1,177 @@ +package com.engine.salary.cmd.datacollection; + +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.result.WeaResultMsg; +import com.engine.common.biz.AbstractCommonCommand; +import com.engine.common.entity.BizLogContext; +import com.engine.core.interceptor.CommandContext; +import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import weaver.general.PageIdConst; +import weaver.hrm.User; + +import java.util.*; +import java.util.stream.Collectors; + +public class AddUpSituationListCmd extends AbstractCommonCommand> { + + public AddUpSituationListCmd(Map params, User user) { + this.user = user; + this.params = params; + } + + @Override + public BizLogContext getLogContext() { + return null; + } + + @Override + public Map execute(CommandContext commandContext) { + + String fileds = " t1.id," + + " t1.declare_month," + + " t1.employee_id," + + " e.lastname as username," + + " d.departmentname AS departmentName," + + " e.mobile," + + " e.workcode as job_num," + + " e.created as hiredate," + + " t2.name AS tax_agent_name," + + " t1.add_up_child_education," + + " t1.add_up_continuing_education," + + " t1.add_up_housing_loan_interest," + + " t1.add_up_housing_rent," + + " t1.add_up_support_elderly"; + + String fromSql = " FROM" + + " hrsa_add_up_deduction t1" + + " LEFT JOIN hrsa_tax_agent t2 ON t1.tax_agent_id = t2.id" + + " LEFT JOIN hrmresource e ON t1.employee_id = e.id" + + " LEFT JOIN hrmdepartment d ON e.departmentid = d.id"; + + + Map apidatas = new HashMap(16); + + WeaResultMsg result = new WeaResultMsg(false); + String pageID = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8"; + String pageUid = pageID + "_" + user.getUID(); + String pageSize = PageIdConst.getPageSize(pageID, user.getUID()); + + + WeaTable table = new WeaTable(); + table.setPageUID(pageUid); + table.setPageID(pageID); + table.setPagesize(pageSize); + table.setBackfields(fileds); + table.setSqlform(fromSql); + table.setSqlwhere(makeSqlWhere()); + table.setSqlorderby("t1.id DESC"); + table.setSqlprimarykey("t1.id"); + table.setSqlisdistinct("false"); + + table.getColumns().add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE)); + table.getColumns().add(new WeaTableColumn("10%", "姓名", "username", "")); + table.getColumns().add(new WeaTableColumn("10%", "个税扣缴义务人", "taxAgentName", "")); + table.getColumns().add(new WeaTableColumn("10%", "部门", "departmentName", "")); + table.getColumns().add(new WeaTableColumn("10%", "手机号", "mobile", "")); + table.getColumns().add(new WeaTableColumn("10%", "工号", "jobNum", "")); + table.getColumns().add(new WeaTableColumn("10%", "证件号码", "idNo", "")); + table.getColumns().add(new WeaTableColumn("10%", "入职日期", "hiredate", "")); + table.getColumns().add(new WeaTableColumn("20%", "操作", "operate", "")); + + List operateList = new ArrayList<>(); + WeaTableOperate delete = new WeaTableOperate("删除", "", "0"); + operateList.add(delete); + WeaTableOperates weaTableOperates = new WeaTableOperates(); + weaTableOperates.setOperate(operateList); + table.setOperates(weaTableOperates); + + //设置check是否可用 + table.setCheckboxList(null); + table.setCheckboxpopedom(null); + result.putAll(table.makeDataResult()); + result.success(); + apidatas = result.getResultMap(); + return apidatas; + } + + + private String makeSqlWhere() { + + AddUpDeductionQueryParam queryParam = (AddUpDeductionQueryParam) params.get("queryParam"); + //申报月份 + List 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 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 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 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 hiredate = queryParam.getHiredate(); + if (CollectionUtils.isNotEmpty(hiredate) && hiredate.size() == 2) { + sqlWhere += " AND (e.created BETWEEN "+hiredate.get(0)+" AND "+hiredate.get(1)+")"; + } + //手机号 + String mobile = queryParam.getMobile(); + if (StringUtils.isNotBlank(mobile)) { + sqlWhere += " AND e.mobile like '%" + mobile + "%'"; + } + + return sqlWhere; + } + + +} diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java index ad42c4f7d..3d6c2ce3e 100644 --- a/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java +++ b/src/com/engine/salary/entity/datacollection/param/AddUpDeductionQueryParam.java @@ -5,8 +5,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDate; import java.util.Collection; +import java.util.Date; import java.util.List; /** @@ -56,7 +56,7 @@ public class AddUpDeductionQueryParam { private String idNo; //入职日期 - private List hiredate; + private List hiredate; //手机号 private String mobile; diff --git a/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java b/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java new file mode 100644 index 000000000..a7d932efb --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/param/AddUpSituationQueryParam.java @@ -0,0 +1,62 @@ +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 AddUpSituationQueryParam{ + + //主键id + private Collection ids; + + //关键字(姓名、部门、工号) + private String keyword; + + //主键id + private Long id; + + //纳税年度 + private Integer year; + + //税款所属期 + private List taxYearMonth; + + //姓名 + private String username; + + //员工id + private Long employeeId; + + //个税扣缴义务人的主键id + private Long taxAgentId; + + //部门id + private List departmentIds; + + //工号 + private String jobNum; + + //证件号 + private String idNo; + + //入职日期 + private List hiredate; + + //手机号 + private String mobile; + + //累计情况id(获取明细) + private Long accumulatedSituationId; +} diff --git a/src/com/engine/salary/entity/datacollection/vo/AddUpDeductionVO.java b/src/com/engine/salary/entity/datacollection/vo/AddUpDeductionVO.java new file mode 100644 index 000000000..9e56b3ffd --- /dev/null +++ b/src/com/engine/salary/entity/datacollection/vo/AddUpDeductionVO.java @@ -0,0 +1,43 @@ +package com.engine.salary.entity.datacollection.vo; + +import com.engine.salary.annotation.SalaryTable; +import com.engine.salary.annotation.SalaryTableColumn; +import com.engine.salary.annotation.SalaryTableOperate; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 数据采集-累计专项附加扣除表 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8", operates = { + @SalaryTableOperate(text = "删除") +}) +public class AddUpDeductionVO { + + @SalaryTableColumn(column = "id", display = false) + private Long id; + @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") + private String hiredate; + @SalaryTableColumn(text = "操作", width = "20%", column = "operate") + private String operate; + + +} \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java index 62c7e68a2..32b4d0b2c 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java @@ -1,7 +1,11 @@ package com.engine.salary.mapper.datacollection; +import com.engine.salary.entity.datacollection.AddUpDeduction; import com.engine.salary.entity.datacollection.AddUpSituation; +import com.engine.salary.entity.datacollection.dto.AddUpDeductionListDTO; +import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -63,5 +67,32 @@ public interface AddUpSituationMapper { * @return 返回影响行数 */ int delete(AddUpSituation addUpSituation); + + + /** + * 查询数据采集-累计专项附加扣除列表 + * @param param + * @return + */ + List list(@Param("param") AddUpDeductionQueryParam param); + + /** + * 根据条件查询 + * @param param + * @return + */ + List listSome(@Param("param") AddUpDeduction param); + + /** + * 批量插入 + * @param pos + */ + void insertData(@Param("collection") List pos); + + /** + * 批量修改 + * @param updateList + */ + void updateData(@Param("collection") List updateList); } \ No newline at end of file diff --git a/src/com/engine/salary/service/AddUpSituationService.java b/src/com/engine/salary/service/AddUpSituationService.java new file mode 100644 index 000000000..44e23fb07 --- /dev/null +++ b/src/com/engine/salary/service/AddUpSituationService.java @@ -0,0 +1,16 @@ +package com.engine.salary.service; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import java.util.Map; + +public interface AddUpSituationService { + + Map list(Map params); + + HSSFWorkbook export(Map params); + + Map getSearchCondition(Map params); + + Map importAddUpSituation(Map params); +} diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java new file mode 100644 index 000000000..15a683f67 --- /dev/null +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -0,0 +1,34 @@ +package com.engine.salary.service.impl; + +import com.engine.core.impl.Service; +import com.engine.salary.cmd.datacollection.AddUpDeductionExportCmd; +import com.engine.salary.cmd.datacollection.AddUpDeductionImportCmd; +import com.engine.salary.cmd.datacollection.AddUpDeductionListCmd; +import com.engine.salary.cmd.datacollection.AddUpSituationGetSearchConditionCmd; +import com.engine.salary.service.AddUpSituationService; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +import java.util.Map; + +public class AddUpSituationServiceImpl extends Service implements AddUpSituationService { + + @Override + public Map list(Map params) { + return commandExecutor.execute(new AddUpDeductionListCmd(params, user)); + } + + @Override + public HSSFWorkbook export(Map params) { + return commandExecutor.execute(new AddUpDeductionExportCmd(params, user)); + } + + @Override + public Map getSearchCondition(Map params) { + return commandExecutor.execute(new AddUpSituationGetSearchConditionCmd(params, user)); + } + + @Override + public Map importAddUpSituation(Map params) { + return commandExecutor.execute(new AddUpDeductionImportCmd(params, user)); + } +} diff --git a/src/com/engine/salary/web/AddUpDeductionController.java b/src/com/engine/salary/web/AddUpDeductionController.java index 36c47f8f0..1f712f172 100644 --- a/src/com/engine/salary/web/AddUpDeductionController.java +++ b/src/com/engine/salary/web/AddUpDeductionController.java @@ -8,7 +8,9 @@ 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 org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.jetbrains.annotations.Nullable; import weaver.general.GCONST; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -26,7 +28,13 @@ 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; public class AddUpDeductionController { @@ -97,14 +105,16 @@ public class AddUpDeductionController { public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response) { User user = HrmUserVarify.getUser(request, response); + AddUpDeductionQueryParam param = buildParam(request); + Map map = ParamUtil.request2Map(request); - map.put("addUpDeductionQueryParam", new AddUpDeductionQueryParam()); + map.put("addUpDeductionQueryParam", param); HSSFWorkbook workbook = getService(user).export(map); String fileName = null; try { - fileName = URLEncoder.encode("累计专项附加扣除导入模板.xlsx", "UTF-8"); + fileName = URLEncoder.encode("累计专项附加扣除.xlsx", "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } @@ -120,6 +130,74 @@ public class AddUpDeductionController { .header("Cache-Control", "no-cache").build(); } + @Nullable + private AddUpDeductionQueryParam buildParam(HttpServletRequest request) { + AddUpDeductionQueryParam param = new AddUpDeductionQueryParam(); + 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 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 accumulatedSpecialAdditionalDeductionId = request.getParameter("accumulatedSpecialAdditionalDeductionId"); + if(StringUtils.isNotBlank(accumulatedSpecialAdditionalDeductionId)){ + param.setAccumulatedSpecialAdditionalDeductionId(Long.valueOf(accumulatedSpecialAdditionalDeductionId)); + } + return param; + } + //新建个税扣缴义务人 @POST @Path("/importAddUpDeduction") diff --git a/src/com/engine/salary/web/AddUpSituationController.java b/src/com/engine/salary/web/AddUpSituationController.java index 671a6b64f..66ae9597c 100644 --- a/src/com/engine/salary/web/AddUpSituationController.java +++ b/src/com/engine/salary/web/AddUpSituationController.java @@ -5,15 +5,18 @@ import com.alibaba.fastjson.serializer.SerializerFeature; import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; +import com.engine.salary.component.SalaryWeaTable; import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.param.AddUpDeductionImportParam; import com.engine.salary.entity.datacollection.param.AddUpDeductionQueryParam; -import com.engine.salary.service.AddUpDeductionService; -import com.engine.salary.service.impl.AddUpDeductionServiceImpl; +import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; +import com.engine.salary.service.AddUpSituationService; +import com.engine.salary.service.impl.AddUpSituationServiceImpl; import com.engine.salary.util.ResponseResult; -import com.engine.salary.component.SalaryWeaTable; import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.jetbrains.annotations.Nullable; import weaver.general.GCONST; import weaver.hrm.HrmUserVarify; import weaver.hrm.User; @@ -31,12 +34,18 @@ 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; public class AddUpSituationController { - private AddUpDeductionService getService(User user) { - return (AddUpDeductionService) ServiceUtil.getService(AddUpDeductionServiceImpl.class, user); + private AddUpSituationService getService(User user) { + return (AddUpSituationService) ServiceUtil.getService(AddUpSituationServiceImpl.class, user); } /** @@ -131,15 +140,88 @@ public class AddUpSituationController { .header("Cache-Control", "no-cache").build(); } + @Nullable + private AddUpSituationQueryParam buildParam(HttpServletRequest request) { + AddUpSituationQueryParam param = new AddUpSituationQueryParam(); + 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 year = request.getParameter("year"); + if(StringUtils.isNotBlank(year)){ + param.setYear(Integer.valueOf(year)); + } + + String taxYearMonth = request.getParameter("taxYearMonth"); + if(StringUtils.isNotBlank(taxYearMonth)){ + param.setTaxYearMonth(Arrays.asList(taxYearMonth.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 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 accumulatedSituationId = request.getParameter("accumulatedSituationId"); + if(StringUtils.isNotBlank(accumulatedSituationId)){ + param.setAccumulatedSituationId(Long.valueOf(accumulatedSituationId)); + } + return param; + } + //新建个税扣缴义务人 @POST - @Path("/importAddUpDeduction") + @Path("/importAddUpSituation") @Produces(MediaType.APPLICATION_JSON) - public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionImportParam importParam) { + public String importAddUpSituation(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody AddUpDeductionImportParam importParam) { User user = HrmUserVarify.getUser(request, response); Map map = ParamUtil.request2Map(request); map.put("importParam", importParam); - return ResponseResult.run(getService(user)::importAddUpDeduction, map); + return ResponseResult.run(getService(user)::importAddUpSituation, map); } }