From b2c95912e77fdd0ecffe90a01d030ece999831b3 Mon Sep 17 00:00:00 2001 From: lijiarao Date: Wed, 16 Feb 2022 14:09:57 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=B7=A5=E4=BD=9C=E7=BB=84=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=A2=9E=E5=8A=A0=E8=81=94=E7=B3=BB=E4=BA=BA=E7=9A=84?= =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=92=8C=E9=82=AE=E7=AE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PayWorkingGroupSubItemController.java | 64 +++++++- .../vo/excel/PayWorkingGroupSubItemExcel.java | 141 ++++++++++++++++++ 2 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/project/vo/excel/PayWorkingGroupSubItemExcel.java diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java index 6fa39a6a..611be45d 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java @@ -2,6 +2,7 @@ package com.jero.project.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.api.vo.Result; @@ -13,6 +14,7 @@ import com.jero.common.service.ProjectDetailService; import com.jero.common.service.RolePermissionService; import com.jero.common.service.SendMessageService; import com.jero.common.system.base.controller.JeroController; +import com.jero.common.system.query.QueryGenerator; import com.jero.common.system.vo.LoginUser; import com.jero.common.util.PasswordUtil; import com.jero.common.util.ValidUtil; @@ -38,6 +40,7 @@ import com.jero.project.entity.PayWorkingGroupSubItem; import com.jero.project.service.IPayWorkingGroupService; import com.jero.project.service.IPayWorkingGroupSubItemService; import com.jero.project.vo.SetChargeInput; +import com.jero.project.vo.excel.PayWorkingGroupSubItemExcel; import com.jero.temporary.entity.PayContactsManagementTemporary; import com.jero.temporary.service.IPayContactsManagementTemporaryService; import io.swagger.annotations.Api; @@ -45,8 +48,10 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -503,7 +508,64 @@ public class PayWorkingGroupSubItemController extends JeroController queryWrapper = QueryGenerator.initQueryWrapper(payWorkingGroupSubItem, request.getParameterMap()); + + // Step.2 获取导出数据 + List pageList = payWorkingGroupSubItemService.list(queryWrapper); + List exportList; + + // 过滤选中数据 + String selections = request.getParameter("selections"); + if (oConvertUtils.isNotEmpty(selections)) { + List selectionList = Arrays.asList(selections.split(",")); + exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList()); + } else { + exportList = pageList; + } + List excelList = new ArrayList<>(); + for (PayWorkingGroupSubItem workingGroupSubItem : exportList) { + PayWorkingGroupSubItemExcel excel = new PayWorkingGroupSubItemExcel(); + BeanUtils.copyProperties(workingGroupSubItem,excel); + String contactsTemporaryIdOne = workingGroupSubItem.getContactsTemporaryIdOne(); + if (StringUtils.isNotBlank(contactsTemporaryIdOne)){ + PayContactsManagementTemporary temporary = payContactsManagementTemporaryService.getById(contactsTemporaryIdOne); + String email = temporary.getEmail(); + if (StringUtils.isNotBlank(email)){ + excel.setContactsEmailOne(PasswordUtil.decrypt(email)); + } + String phone = temporary.getPhone(); + if (StringUtils.isNotBlank(phone)){ + excel.setContactsPhoneOne(PasswordUtil.decrypt(phone)); + } + } + String contactsTemporaryIdTwo = workingGroupSubItem.getContactsTemporaryIdTwo(); + if (StringUtils.isNotBlank(contactsTemporaryIdTwo)){ + PayContactsManagementTemporary temporary = payContactsManagementTemporaryService.getById(contactsTemporaryIdTwo); + String email = temporary.getEmail(); + if (StringUtils.isNotBlank(email)){ + excel.setContactsEmailTwo(PasswordUtil.decrypt(email)); + } + String phone = temporary.getPhone(); + if (StringUtils.isNotBlank(phone)){ + excel.setContactsPhoneTwo(PasswordUtil.decrypt(phone)); + } + } + String contactsTemporaryIdThree = workingGroupSubItem.getContactsTemporaryIdThree(); + if (StringUtils.isNotBlank(contactsTemporaryIdThree)){ + PayContactsManagementTemporary temporary = payContactsManagementTemporaryService.getById(contactsTemporaryIdThree); + String email = temporary.getEmail(); + if (StringUtils.isNotBlank(email)){ + excel.setContactsEmailThree(PasswordUtil.decrypt(email)); + } + String phone = temporary.getPhone(); + if (StringUtils.isNotBlank(phone)){ + excel.setContactsPhoneThree(PasswordUtil.decrypt(phone)); + } + } + excelList.add(excel); + } + return super.exportListXls(excelList, PayWorkingGroupSubItemExcel.class, "工作组成员"); } /** diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/vo/excel/PayWorkingGroupSubItemExcel.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/vo/excel/PayWorkingGroupSubItemExcel.java new file mode 100644 index 00000000..326ba6bb --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/vo/excel/PayWorkingGroupSubItemExcel.java @@ -0,0 +1,141 @@ +package com.jero.project.vo.excel; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; + +import javax.validation.constraints.DecimalMax; +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Description: pay_working_group_subitem + * @Author: jeecg-boot + * @Date: 2021-08-27 + * @Version: V1.0 + */ +@Data +public class PayWorkingGroupSubItemExcel implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 临时成员单位 + */ + @Excel(name = "成员单位", width = 15) + @ApiModelProperty(value = "临时成员单位") + private String chargeCompanyTemporaryName; + + /** + * 临时企业联系人1名称 + */ + @Excel(name = "企业联系人1", width = 15) + @ApiModelProperty(value = "临时企业联系人1名称") + private String contactsTemporaryNameOne; + + /** + * 企业联系人1手机号 + */ + @Excel(name = "企业联系人1手机号", width = 17) + private String contactsPhoneOne; + + /** + * 企业联系人1邮箱 + */ + @Excel(name = "企业联系人1邮箱", width = 15) + private String contactsEmailOne; + + /** + * 联系人1备注 + */ + @Excel(name = "联系人1备注", width = 15) + @ApiModelProperty(value = "联系人1备注") + private String remarksOne; + /** + * 临时企业联系人2名称 + */ + @Excel(name = "企业联系人2", width = 15) + @ApiModelProperty(value = "临时企业联系人2名称") + private String contactsTemporaryNameTwo; + /** + * 企业联系人2手机号 + */ + @Excel(name = "企业联系人2手机号", width = 17) + private String contactsPhoneTwo; + /** + * 企业联系人2邮箱 + */ + @Excel(name = "企业联系人2邮箱", width = 15) + private String contactsEmailTwo; + /** + * 联系人2备注 + */ + @Excel(name = "联系人2备注", width = 15) + @ApiModelProperty(value = "联系人2备注") + private String remarksTwo; + /** + * 临时企业联系人3名称 + */ + @Excel(name = "企业联系人3", width = 15) + @ApiModelProperty(value = "临时企业联系人3名称") + private String contactsTemporaryNameThree; + /** + * 企业联系人3手机号 + */ + @Excel(name = "企业联系人3手机号", width = 17) + private String contactsPhoneThree; + /** + * 企业联系人3邮箱 + */ + @Excel(name = "企业联系人3邮箱", width = 15) + private String contactsEmailThree; + /** + * 联系人3备注 + */ + @Excel(name = "联系人3备注", width = 15) + @ApiModelProperty(value = "联系人3备注") + private String remarksThree; + /** + * 临时邮寄联系人名称 + */ + @Excel(name = "邮寄联系人", width = 15) + @ApiModelProperty(value = "临时邮寄联系人名称") + private String mailContactsTemporaryName; + /** + * 来款方式(1:无,2:合同,3:收费通知) + */ + @Excel(name = "来款方式", width = 15, dicCode = "payment_type") + @ApiModelProperty(value = "来款方式(1:无,2:合同,3:收费通知)") + private Integer chargeWay; + /** + * 应收金额(元) + */ + @Excel(name = "应收金额(元)", width = 15) + @ApiModelProperty(value = "应收金额(元)") + @JsonFormat(shape = JsonFormat.Shape.STRING) + private BigDecimal receivableAmount; + /** + * 合同编号 + */ + @Excel(name = "合同编号", width = 15) + @ApiModelProperty(value = "合同编号") + private String contractNum; + /** + * 收费通知号 + */ + @Excel(name = "收费通知号", width = 15) + @ApiModelProperty(value = "收费通知号") + private String chargeNoticeNo; + /** + * 需要发票(1:增值税普通发票,2:增值税专用发票,3:否) + */ + @Excel(name = "需要发票", width = 15, dicCode = "invoice_type") + @ApiModelProperty(value = "需要发票(1:增值税普通发票,2:增值税专用发票,0:否)") + private Integer needInvoice; + /** + * 备注 + */ + @Excel(name = "备注", width = 15) + @ApiModelProperty(value = "备注") + private String remarks; +}