From 9c02c9c9fd64b41746cb9b772dc9544e9ad3e2e7 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 19 Apr 2022 12:19:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0datakey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../po/InsuranceAccountDetailPO.java | 3 +- .../service/impl/RecordsBuildServiceImpl.java | 4 +-- .../service/impl/SIAccountServiceImpl.java | 15 ++++++--- src/com/engine/salary/util/page/PageInfo.java | 5 +++ .../salary/web/SIAccountController.java | 16 +++++----- .../engine/salary/web/SIExportController.java | 12 +++---- .../salary/wrapper/SIAccountWrapper.java | 11 ------- .../salary/wrapper/SIExportWrapper.java | 31 +++++++++++++++++++ 8 files changed, 64 insertions(+), 33 deletions(-) create mode 100644 src/com/engine/salary/wrapper/SIExportWrapper.java diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java index 4f8f53ac3..9b249b0e5 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java @@ -22,8 +22,7 @@ import java.util.Date; @Builder @NoArgsConstructor @AllArgsConstructor -@SalaryTable(pageId = "021c4a65-c401-4bcc-a720-6233996e17f1", tableType = WeaTableType.CHECKBOX,operates = { -}) +@SalaryTable(pageId = "2394fba1-1381-428a-8532-4e1e6b86626e", tableType = WeaTableType.CHECKBOX) public class InsuranceAccountDetailPO { /** diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index a16661468..91cdc4238 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -77,7 +77,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ record.put(k + "socialBase", SalaryEntityUtil.thousandthConvert((String) v)); }); } - record.put("fundPayOrg", item.getFundPayOrg() == null ? "" : paymentMap.get(item.getFundPayOrg()).getName()); + record.put("fundPayOrg", item.getFundPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getFundPayOrg(),TaxAgent.builder().build())).getName()); record.put("fundAccount", item.getFundAccount()); record.put("fundSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getFundSchemeId())); record.put("supplementFundAccount", item.getSupplementFundAccount()); @@ -87,7 +87,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ record.put(k + "fundBase", SalaryEntityUtil.thousandthConvert((String) v)); }); } - record.put("otherPayOrg", item.getOtherPayOrg() == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName()); + record.put("otherPayOrg", item.getOtherPayOrg() == null ? "" : (paymentMap.getOrDefault(item.getOtherPayOrg(),TaxAgent.builder().build())).getName()); record.put("otherSchemeName", MapperProxyFactory.getProxy(InsuranceSchemeMapper.class).querySchemeName(item.getOtherSchemeId())); if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) { Map socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap().getClass()); diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 65e1ba42e..ca3441a18 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -42,6 +42,7 @@ import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryFormItemUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; +import com.engine.salary.util.page.Column; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.PageUtil; import com.engine.salary.util.valid.ValidUtil; @@ -90,6 +91,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { List>> operatesPermission = new ArrayList<>(); SalaryWeaTable table = new SalaryWeaTable<>(user, InsuranceAccountBatchListDTO.class); + List columns = pageInfos.getColumns(); + List weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList()); + + table.setColumns(weaTableColumn); //table.getColumns().get(0).setFixed("left"); // for (int i = 0; i < insuranceAccountBatchListDTOS.size(); i++) { @@ -118,7 +123,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { datas.put("pageInfo", pageInfos); datas.put("operatesPermission",operatesPermission); - //datas.put("dataKey",result.getResultMap()); + datas.put("dataKey",result.getResultMap()); return datas; // WeaTable resultTable = FormatManager.getInstance() @@ -156,8 +161,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { //动态列组装 List weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false); - SalaryWeaTable table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class); + SalaryWeaTable table = new SalaryWeaTable<>(user,InsuranceAccountDetailPO.class); table.setColumns(weaTableColumn); + List columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList()); + pageInfos.setColumns(columns); WeaResultMsg result = new WeaResultMsg(false); @@ -197,7 +204,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { //数据组装 List> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId); - PageInfo> pageInfos = new PageInfo>(records); + PageInfo> pageInfos = new PageInfo<>(records); pageInfos.setTotal(records.size()); pageInfos.setPageNum(queryParam.getCurrent()); pageInfos.setPageSize(queryParam.getPageSize()); @@ -206,7 +213,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { //动态列组装 List weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, false); - SalaryWeaTable table = new SalaryWeaTable<>(user, SalaryArchiveListDTO.class); + SalaryWeaTable table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class); table.setColumns(weaTableColumn); diff --git a/src/com/engine/salary/util/page/PageInfo.java b/src/com/engine/salary/util/page/PageInfo.java index 00943aed6..b6b226a16 100644 --- a/src/com/engine/salary/util/page/PageInfo.java +++ b/src/com/engine/salary/util/page/PageInfo.java @@ -12,6 +12,11 @@ import java.util.List; @ToString public class PageInfo extends com.github.pagehelper.PageInfo { Class clazz; + +// public void setColumns(List columns) { +// this.columns = columns; +// } + List columns = new ArrayList<>(); List dataSource = new ArrayList<>(); diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index d245cc323..ad5f83dc6 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -47,7 +47,7 @@ public class SIAccountController { * @param response * @return */ - @GET + @POST @Path("/batch/list") @Produces(MediaType.APPLICATION_JSON) public String list(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceAccountBatchParam insuranceAccountBatchParam) { @@ -63,7 +63,7 @@ public class SIAccountController { * @param insuranceAccountDetailParam * @return */ - @GET + @POST @Path("/detail/common/list") @Produces(MediaType.APPLICATION_JSON) public String commonList(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -80,7 +80,7 @@ public class SIAccountController { * @param insuranceAccountDetailParam * @return */ - @GET + @POST @Path("/detail/common/search") @Produces(MediaType.APPLICATION_JSON) public String commonByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -97,7 +97,7 @@ public class SIAccountController { * @param insuranceAccountDetailParam * @return */ - @GET + @POST @Path("/detail/supplementary/list") @Produces(MediaType.APPLICATION_JSON) public String listSupplementaryPage(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -114,7 +114,7 @@ public class SIAccountController { * @param insuranceAccountDetailParam * @return */ - @GET + @POST @Path("/detail/supplementary/search") @Produces(MediaType.APPLICATION_JSON) public String supplementaryByNameList(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -267,7 +267,7 @@ public class SIAccountController { return new ResponseResult().run(getService(user)::file, accountParam); } - @GET + @POST @Path("/changeList") @Produces(MediaType.APPLICATION_JSON) public String changeList(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -278,7 +278,7 @@ public class SIAccountController { - @GET + @POST @Path("/overView") @Produces(MediaType.APPLICATION_JSON) public String overView(@Context HttpServletRequest request, @Context HttpServletResponse response, @@ -296,7 +296,7 @@ public class SIAccountController { return new ResponseResult().run(getService(user)::tabList, billMonth); } - @GET + @POST @Path("/inspectList") @Produces(MediaType.APPLICATION_JSON) public String getInspectTable(@Context HttpServletRequest request, @Context HttpServletResponse response, diff --git a/src/com/engine/salary/web/SIExportController.java b/src/com/engine/salary/web/SIExportController.java index 996306b28..90c11a96e 100644 --- a/src/com/engine/salary/web/SIExportController.java +++ b/src/com/engine/salary/web/SIExportController.java @@ -5,7 +5,7 @@ import com.engine.salary.entity.siexport.param.InsuranceExportParam; import com.engine.salary.enums.siaccount.PaymentStatusEnum; import com.engine.salary.service.SIAccountService; import com.engine.salary.service.impl.SIAccountServiceImpl; -import com.engine.salary.wrapper.SIAccountWrapper; +import com.engine.salary.wrapper.SIExportWrapper; import io.swagger.v3.oas.annotations.parameters.RequestBody; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.hrm.HrmUserVarify; @@ -36,8 +36,8 @@ public class SIExportController { return ServiceUtil.getService(SIAccountServiceImpl.class, user); } - public SIAccountWrapper getSIAccountWrapper(User user) { - return ServiceUtil.getService(SIAccountWrapper.class,user); + public SIExportWrapper getSIExportWrapper(User user) { + return ServiceUtil.getService(SIExportWrapper.class,user); } @@ -47,7 +47,7 @@ public class SIExportController { public Response exportAccount(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceExportParam param) { User user = HrmUserVarify.getUser(request, response); - XSSFWorkbook workbook = getSIAccountWrapper(user).exportAccount(PaymentStatusEnum.COMMON.getValue(),param); + XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.COMMON.getValue(),param); String time = LocalDate.now().toString(); String fileName = "正常缴纳核算报表" + time; try { @@ -70,7 +70,7 @@ public class SIExportController { public Response exportSupplementary(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceExportParam param) { User user = HrmUserVarify.getUser(request, response); - XSSFWorkbook workbook = getSIAccountWrapper(user).exportAccount(PaymentStatusEnum.REPAIR.getValue(),param); + XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.REPAIR.getValue(),param); String time = LocalDate.now().toString(); String fileName = "补缴核算报表" + time; try { @@ -92,7 +92,7 @@ public class SIExportController { public Response exportOverView(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceExportParam param) { User user = HrmUserVarify.getUser(request, response); - XSSFWorkbook workbook = getSIAccountWrapper(user).exportOverView(param); + XSSFWorkbook workbook = getSIExportWrapper(user).exportOverView(param); String time = LocalDate.now().toString(); String fileName = "总览报表" + time; try { diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 978f2e119..862459a18 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -16,16 +16,5 @@ import weaver.hrm.User; **/ public class SIAccountWrapper extends Service { - public SIExportService getSIExportService(User user) { - return ServiceUtil.getService(SIExportServiceImpl.class, user); - } - - public XSSFWorkbook exportOverView(InsuranceExportParam param) { - return getSIExportService(user).exportOverView(param); - } - - public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) { - return getSIExportService(user).exportAccount(paymentStatus,param); - } } diff --git a/src/com/engine/salary/wrapper/SIExportWrapper.java b/src/com/engine/salary/wrapper/SIExportWrapper.java new file mode 100644 index 000000000..e808d4baf --- /dev/null +++ b/src/com/engine/salary/wrapper/SIExportWrapper.java @@ -0,0 +1,31 @@ +package com.engine.salary.wrapper; + +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.entity.siexport.param.InsuranceExportParam; +import com.engine.salary.service.SIExportService; +import com.engine.salary.service.impl.SIExportServiceImpl; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import weaver.hrm.User; + +/** + * @Author weaver_cl + * @Description: TODO + * @Date 2022/4/18 + * @Version V1.0 + **/ +public class SIExportWrapper extends Service { + + public SIExportService getSIExportService(User user) { + return ServiceUtil.getService(SIExportServiceImpl.class, user); + } + + + public XSSFWorkbook exportOverView(InsuranceExportParam param) { + return getSIExportService(user).exportOverView(param); + } + + public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) { + return getSIExportService(user).exportAccount(paymentStatus,param); + } +}