add 工作组导出增加联系人的手机号和邮箱

This commit is contained in:
lijiarao
2022-02-16 14:09:57 +08:00
parent 63c6a6e982
commit b2c95912e7
2 changed files with 204 additions and 1 deletions
@@ -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<PayWorkingG
&& !Objects.equals(payWorkingGroup.getPrincipalIdB(),sysUser.getId())){
throw new JeroBootException("数据权限不足!");
}
return super.exportXls(request, payWorkingGroupSubItem, PayWorkingGroupSubItem.class, "工作组成员");
// Step.1 组装查询条件
QueryWrapper<PayWorkingGroupSubItem> queryWrapper = QueryGenerator.initQueryWrapper(payWorkingGroupSubItem, request.getParameterMap());
// Step.2 获取导出数据
List<PayWorkingGroupSubItem> pageList = payWorkingGroupSubItemService.list(queryWrapper);
List<PayWorkingGroupSubItem> exportList;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = pageList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
} else {
exportList = pageList;
}
List<PayWorkingGroupSubItemExcel> 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, "工作组成员");
}
/**
@@ -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;
}