| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import cn.emay.sdk.util.StringUtil; |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.YwOutinbound; |
| | | import com.doumee.dao.business.model.YwOutinboundRecord; |
| | | import com.doumee.dao.business.vo.YwOutinboundExcelInVO; |
| | | import com.doumee.dao.business.vo.YwOutinboundExcelOutVO; |
| | | import com.doumee.service.business.YwOutinboundService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:ywoutinbound:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<YwOutinbound> pageWrap, HttpServletResponse response,@RequestHeader(Constants.HEADER_USER_TOKEN) String token) { |
| | | ExcelExporter.build(YwOutinbound.class).export(ywOutinboundService.findPage(pageWrap).getRecords(), "运维出入库信息表", response); |
| | | List<YwOutinbound> ywOutinboundList = ywOutinboundService.findPage(pageWrap).getRecords(); |
| | | Integer inOut = pageWrap.getModel().getInOut(); |
| | | if(Constants.equalsInteger(inOut,Constants.ZERO)){ |
| | | List<YwOutinboundExcelInVO> inList = new ArrayList<>(); |
| | | for (YwOutinbound ywOutinbound:ywOutinboundList) { |
| | | YwOutinboundExcelInVO inVO = new YwOutinboundExcelInVO(); |
| | | BeanUtils.copyProperties(ywOutinbound,inVO); |
| | | List<YwOutinboundRecord> ywOutinboundRecordList = ywOutinbound.getRecordList(); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (YwOutinboundRecord ywOutinboundRecord:ywOutinboundRecordList) { |
| | | stringBuffer.append(ywOutinboundRecord.getMaterialName()+"["+ywOutinboundRecord.getMaterialCode()+"]*"+ywOutinboundRecord.getStock()+ywOutinboundRecord.getMaterialUnitName()+";"); |
| | | } |
| | | inVO.setOutMaterialNum(stringBuffer.toString()); |
| | | inList.add(inVO); |
| | | } |
| | | ExcelExporter.build(YwOutinboundExcelInVO.class).export(inList, "入库信息表", response); |
| | | }else{ |
| | | List<YwOutinboundExcelOutVO> outList = new ArrayList<>(); |
| | | for (YwOutinbound ywOutinbound:ywOutinboundList) { |
| | | YwOutinboundExcelOutVO ywOutinboundExcelOutVO = new YwOutinboundExcelOutVO(); |
| | | BeanUtils.copyProperties(ywOutinbound,ywOutinboundExcelOutVO); |
| | | List<YwOutinboundRecord> ywOutinboundRecordList = ywOutinbound.getRecordList(); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for (YwOutinboundRecord ywOutinboundRecord:ywOutinboundRecordList) { |
| | | stringBuffer.append(ywOutinboundRecord.getMaterialName()+"["+ywOutinboundRecord.getMaterialCode()+"]*"+ywOutinboundRecord.getStock()+ywOutinboundRecord.getMaterialUnitName()+";"); |
| | | } |
| | | ywOutinboundExcelOutVO.setOutMaterialNum(stringBuffer.toString()); |
| | | outList.add(ywOutinboundExcelOutVO); |
| | | } |
| | | ExcelExporter.build(YwOutinboundExcelOutVO.class).export(outList, "出库信息表", response); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |