|  |  |  | 
|---|
|  |  |  | import com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.constants.Constants; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Member; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.github.xiaoymin.knife4j.core.util.CollectionUtils; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.apache.shiro.authz.annotation.RequiresPermissions; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author 江蹄蹄 | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/exportExcel") | 
|---|
|  |  |  | @RequiresPermissions("business:member:exportExcel") | 
|---|
|  |  |  | public void exportExcel (@RequestBody PageWrap<Member> pageWrap, HttpServletResponse response) { | 
|---|
|  |  |  | ExcelExporter.build(Member.class).export(memberService.findPage(pageWrap).getRecords(), "会员信息表", response); | 
|---|
|  |  |  | List<Member> memberList = memberService.findPage(pageWrap).getRecords(); | 
|---|
|  |  |  | if(CollectionUtils.isNotEmpty(memberList)){ | 
|---|
|  |  |  | for (Member m:memberList) { | 
|---|
|  |  |  | m.setAmountYuan(Objects.nonNull(m.getAmount())&&m.getAmount()> Constants.ZERO? new BigDecimal(m.getAmount()+"").divide(new BigDecimal("100"),2,BigDecimal.ROUND_UP):BigDecimal.ZERO); | 
|---|
|  |  |  | List<String> identityInfo = new ArrayList<>(); | 
|---|
|  |  |  | if(Constants.equalsInteger(m.getWorkerIdentity(),Constants.TWO)){ | 
|---|
|  |  |  | identityInfo.add("工人"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(Constants.equalsInteger(m.getDriverIdentity(),Constants.TWO)){ | 
|---|
|  |  |  | identityInfo.add("司机"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(Constants.equalsInteger(m.getChefIdentity(),Constants.TWO)){ | 
|---|
|  |  |  | identityInfo.add("供餐"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | m.setIdentityApplyInfo(StringUtils.join(identityInfo,",")); | 
|---|
|  |  |  | m.setIdentityInfo("发单方" + (StringUtils.isNotBlank(m.getIdentityApplyInfo())?" | 接单方":"")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ExcelExporter.build(Member.class).export(memberList, "会员信息表", response); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据ID查询") | 
|---|