| | |
| | | import com.iplatform.base.util.UserUtils; |
| | | import com.iplatform.core.BeanContextAware; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | |
| | | public abstract class BaseController extends PlatformAdapterController { |
| | | |
| | |
| | | // ä»ç¼åä¸ååºç¨æ·ï¼å¦ææ²¡æåæ°å¢ |
| | | return this.getFinSysTenantUserCache().get(String.valueOf(userInfo.getId())); |
| | | } |
| | | |
| | | protected void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | OutputStream out = response.getOutputStream(); |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); |
| | | workbook.write(byteArrayOutputStream); |
| | | response.setHeader("Content-Length", String.valueOf(byteArrayOutputStream.size())); |
| | | out.write(byteArrayOutputStream.toByteArray()); |
| | | workbook.close(); |
| | | out.close(); |
| | | } |
| | | } |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "çç¹å导åº", notes = "çç¹å导åº") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "çç¹åid", dataType = "Long", required = true, paramType = "query") |
| | | }) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | |
| | | List<InventoryExcelTemplate> exportList = lWhFormInventoryService.getExportList(id); |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | |
| | | exportList, map); |
| | | |
| | | downLoadExcel("ä½å¼æèåçç¹è¡¨", response, workbook); |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | logger.error("å¯¼åºæä»¶å¤±è´¥", e); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.base.pojo.response.FormOutputGoodsVO; |
| | | import com.consum.base.pojo.response.FormOutputTemplateInfoVO; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.apache.commons.compress.utils.Lists; |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "åºåºå导åº", notes = "åºåºå导åº") |
| | | @ApiImplicitParam(name = "id", value = "åºåºåid", required = true, dataType = "Long", paramType = "query") |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | if (sysInfo == null) { |
| | | throw new RuntimeException("ç»å½ç¨æ·ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | ClassPathResource classPathResource = new ClassPathResource("import/éè´éè´§å.xls"); |
| | | // è·åæä»¶è¾å
¥æµ |
| | | InputStream inputStream = classPathResource.getInputStream(); |
| | | Workbook wb = new HSSFWorkbook(inputStream); |
| | | TemplateExportParams params = new TemplateExportParams(); |
| | | params.setTemplateWb(wb); |
| | | params.setHeadingStartRow(2); |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | | |
| | | Map<String, Object> map = lWhFormOutputService.getExportList(id, userName); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | List<OutputExcelTemplate> exportList = lWhFormOutputService.getExportList(id); |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | int countNum = exportList.stream().filter(item -> item.getNum() != null).mapToInt(OutputExcelTemplate::getNum).sum(); |
| | | int totalAmount = exportList.stream().filter(item -> item.getTotalAmount() != null).mapToInt(OutputExcelTemplate::getTotalAmount).sum(); |
| | | Optional<OutputExcelTemplate> first = exportList.stream().findFirst(); |
| | | OutputExcelTemplate templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, OutputExcelTemplate.class, exportList, map); |
| | | downLoadExcel("éè´éè´§å", response, workbook); |
| | | |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName + ".xls", "UTF-8")); |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | workbook.write(baos); |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | logger.error("å¯¼åºæä»¶å¤±è´¥", e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.consum.base.pojo.LWhFormProcureGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhFormProcureParam; |
| | | import com.consum.base.pojo.LWhProcureModelParam; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.base.pojo.response.FormProcureVO; |
| | | import com.consum.base.pojo.response.FromProcureTemplateInfoVO; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.Set; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "éè´å导åº", notes = "éè´å导åº") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "éè´åid", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/éè´å
¥åºå.xls"); |
| | | |
| | | params.setHeadingStartRow(2); |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | | if (sysInfo == null) { |
| | | throw new RuntimeException("ç»å½ç¨æ·ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | |
| | | Map<String, Object> map = lWhFormProcureService.getExportList(id, userName); |
| | | if (CollectionUtils.isEmpty(map)) { |
| | | List<ProcureExcelTemplate> exportList = lWhFormProcureService.getExportList(id); |
| | | if (CollectionUtils.isEmpty(exportList)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("éè´å
¥åºå.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | int countNum = exportList.stream().filter(item -> item.getNum() != null).mapToInt(ProcureExcelTemplate::getNum).sum(); |
| | | int totalAmount = exportList.stream().filter(export -> export.getTotalAmount() != null).mapToInt(ProcureExcelTemplate::getTotalAmount).sum(); |
| | | Optional<ProcureExcelTemplate> first = exportList.stream().findFirst(); |
| | | ProcureExcelTemplate templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, ProcureExcelTemplate.class, exportList, map); |
| | | downLoadExcel("éè´å
¥åºå", response, workbook); |
| | | |
| | | } |
| | | } |
| | |
| | | return ResponseValue.success(pageUtil); |
| | | } |
| | | |
| | | /** |
| | | * @Description å¯¼åºæ¥åºç»è®°å |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/11/2 |
| | | */ |
| | | @ApiOperation(value = "å¯¼åºæ¥åºå", notes = "å¯¼åºæ¥åºå") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "æ¥åºåid", dataType = "Long", paramType = "query") |
| | | }) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) { |
| | | public void export(Long id, HttpServletResponse response) throws Exception { |
| | | if (id == null) { |
| | | throw new RuntimeException("æ¥åºåid为空"); |
| | | } |
| | | try { |
| | | OutputStream outputStream = response.getOutputStream(); |
| | | List<ScrappedInfoExcelTemplate> export = lWhFormScrappedService.export(id); |
| | | if (CollectionUtils.isEmpty(export)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | TemplateExportParams exportParams = new TemplateExportParams("import/æ¥åºç»è®°å.xlsx"); |
| | | exportParams.setHeadingStartRow(2); |
| | | |
| | | Optional<ScrappedInfoExcelTemplate> first = export.stream().findFirst(); |
| | | ScrappedInfoExcelTemplate scrappedInfoExcelTemplate = first.get(); |
| | | Long dealTime = scrappedInfoExcelTemplate.getDealTime(); |
| | | String operatorName = scrappedInfoExcelTemplate.getOperatorName(); |
| | | String businessFormCode = scrappedInfoExcelTemplate.getBusinessFormCode(); |
| | | |
| | | int countNum = export.stream().filter(item -> item.getNum() != null).mapToInt(ScrappedInfoExcelTemplate::getNum).sum(); |
| | | int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null).mapToInt(ScrappedInfoExcelTemplate::getTotalAmount).sum(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(dealTime)); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook sheets = ExcelExportUtil.exportExcel(exportParams, ScrappedInfoExcelTemplate.class, export, map); |
| | | // 设置ååºå¤´ |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("æ¥åºåç»è®°.xlsx", "utf-8")); |
| | | sheets.write(outputStream); |
| | | sheets.close(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | List<ScrappedInfoExcelTemplate> export = lWhFormScrappedService.export(id); |
| | | if (CollectionUtils.isEmpty(export)) { |
| | | throw new RuntimeException("æ°æ®ä¸ºç©º"); |
| | | } |
| | | TemplateExportParams exportParams = new TemplateExportParams("import/æ¥åºç»è®°å.xlsx"); |
| | | exportParams.setHeadingStartRow(2); |
| | | |
| | | Optional<ScrappedInfoExcelTemplate> first = export.stream().findFirst(); |
| | | ScrappedInfoExcelTemplate scrappedInfoExcelTemplate = first.get(); |
| | | Long dealTime = scrappedInfoExcelTemplate.getDealTime(); |
| | | String operatorName = scrappedInfoExcelTemplate.getOperatorName(); |
| | | String businessFormCode = scrappedInfoExcelTemplate.getBusinessFormCode(); |
| | | |
| | | int countNum = export.stream().filter(item -> item.getNum() != null).mapToInt(ScrappedInfoExcelTemplate::getNum).sum(); |
| | | int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null).mapToInt(ScrappedInfoExcelTemplate::getTotalAmount).sum(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(dealTime)); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook sheets = ExcelExportUtil.exportExcel(exportParams, ScrappedInfoExcelTemplate.class, export, map); |
| | | downLoadExcel("æ¥åºç»è®°å", response, sheets); |
| | | |
| | | } |
| | | |
| | |
| | | import com.consum.base.pojo.RecordUserInfoVO; |
| | | import com.consum.base.pojo.UseRecordSkuVO; |
| | | import com.consum.base.pojo.dto.UseRecordDTO; |
| | | import com.consum.base.pojo.excel.TransferExcelTemplate; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | | import com.consum.base.pojo.request.LWhFormTransferParam; |
| | | import com.consum.base.pojo.request.ProcureModelInfoParam; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | |
| | | return ResponseValue.success(); |
| | | } |
| | | |
| | | /** |
| | | * @Description 导åºè°æ¨åºåºå |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/31 |
| | | */ |
| | | |
| | | @ApiOperation(value = "è°æ¨å导åº", notes = "è°æ¨å导åº") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "è°æ¨åid", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "type", value = "导åºç±»å 1 å
¥åº 2 åºåº", required = true, dataType = "Integer"), |
| | | }) |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, Integer type, HttpServletResponse response) throws IOException { |
| | | public void export(Long id, Integer type, HttpServletResponse response) throws Exception { |
| | | |
| | | TemplateExportParams params; |
| | | String fileName; |
| | | if (type == 1) { |
| | | params = new TemplateExportParams("import/è°æ¨å
¥åºå.xls"); |
| | | fileName = "è°æ¨å
¥åºå"; |
| | | } else { |
| | | params = new TemplateExportParams("import/è°æ¨åºåºå.xls"); |
| | | fileName = "è°æ¨åºåºå"; |
| | | } |
| | | Map<String, Object> map = this.lWhFormTransferService.export(id, type); |
| | | params.setHeadingStartRow(2); |
| | | List<TransferExcelTemplate> export = this.lWhFormTransferService.export(id, type); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("è°æ¨å
¥åºå.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | int countNum = export.stream().filter(item -> item.getNum() != null).mapToInt(TransferExcelTemplate::getNum).sum(); |
| | | int totalAmount = export.stream().filter(item -> item.getTotalAmount() != null).mapToInt(TransferExcelTemplate::getTotalAmount).sum(); |
| | | Optional<TransferExcelTemplate> first = export.stream().findFirst(); |
| | | TransferExcelTemplate entity = first.get(); |
| | | String businessFormCode = entity.getBusinessFormCode(); |
| | | Long createTime = entity.getCreateTime(); |
| | | String operatorName = entity.getOperatorName(); |
| | | String tenantName = entity.getTenantName(); |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("tenantName", tenantName); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, TransferExcelTemplate.class, export, map); |
| | | downLoadExcel(fileName, response, workbook); |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.consum.base.pojo.excel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: åºåºåå¯¼åºæ¨¡æ¿ |
| | | * @date 2023/12/1 9:13 |
| | | */ |
| | | @Data |
| | | public class OutputExcelTemplate implements Serializable { |
| | | |
| | | @Excel(name = "åä½") |
| | | private String tenantName; |
| | | @Excel(name = "ç©ååç§°") |
| | | private String templateName; |
| | | @Excel(name = "ç©ååå·/è§æ ¼") |
| | | private String baseModelName; |
| | | @Excel(name = "æ°é") |
| | | private Integer num; |
| | | @Excel(name = "åä»·") |
| | | private Integer price; |
| | | @Excel(name = "éé¢") |
| | | private Integer totalAmount; |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | @ExcelIgnore |
| | | private String businessFormCode; |
| | | @ExcelIgnore |
| | | private Long createTime; |
| | | @ExcelIgnore |
| | | private String operatorName; |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.excel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: éè´åå¯¼åºæ¨¡æ¿ |
| | | * @date 2023/12/1 9:35 |
| | | */ |
| | | @Data |
| | | public class ProcureExcelTemplate implements Serializable { |
| | | |
| | | @Excel(name = "åä½") |
| | | private String tenantName; |
| | | @Excel(name = "ç©ååç§°") |
| | | private String templateName; |
| | | @Excel(name = "ç©ååå·/è§æ ¼") |
| | | private String baseModelName; |
| | | @Excel(name = "æ°é") |
| | | private Integer num; |
| | | @Excel(name = "åä»·") |
| | | private Integer price; |
| | | @Excel(name = "éé¢") |
| | | private Integer totalAmount; |
| | | @Excel(name = "åæ¾å°ç¹") |
| | | private String warehouseName; |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | @ExcelIgnore |
| | | private String businessFormCode; |
| | | @ExcelIgnore |
| | | private Long createTime; |
| | | @ExcelIgnore |
| | | private String operatorName; |
| | | } |
New file |
| | |
| | | package com.consum.base.pojo.excel; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; |
| | | import java.io.Serializable; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author asus |
| | | * @version 1.0 |
| | | * @description: è°æ¨å¯¼åºexcelæ¨¡æ¿ |
| | | * @date 2023/12/1 10:02 |
| | | */ |
| | | @Data |
| | | public class TransferExcelTemplate implements Serializable { |
| | | |
| | | @Excel(name = "åä½") |
| | | private String tenantName; |
| | | @Excel(name = "ç©ååç§°") |
| | | private String templateName; |
| | | @Excel(name = "ç©ååå·/è§æ ¼") |
| | | private String baseModelName; |
| | | @Excel(name = "æ°é") |
| | | private Integer num; |
| | | @Excel(name = "éé¢") |
| | | private Integer totalAmount; |
| | | @Excel(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | |
| | | @ExcelIgnore |
| | | private String businessFormCode; |
| | | @ExcelIgnore |
| | | private Long createTime; |
| | | @ExcelIgnore |
| | | private String operatorName; |
| | | @ExcelIgnore |
| | | private String inAgencyName; |
| | | @ExcelIgnore |
| | | private String outAgencyName; |
| | | |
| | | } |
| | |
| | | List<InventoryExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | InventoryExcelTemplate inventoryExcelTemplate = MapUtils.convertMapToObj(item, InventoryExcelTemplate.class); |
| | | inventoryExcelTemplate.setInventoryDeception(inventoryExcelTemplate.getInventoryResult() == 1 ? "æ¯" : "å¦"); |
| | | inventoryExcelTemplate.setDeception( |
| | | inventoryExcelTemplate.getInventoryResult() == 1 ? "æ£å¸¸" : (inventoryExcelTemplate.getInventoryResult() == 2 ? "çç" : "çäº")); |
| | | list.add(inventoryExcelTemplate); |
| | | }); |
| | | return list; |
| | |
| | | import com.consum.base.pojo.LWFormsOutputGoodsInfoParam; |
| | | import com.consum.base.pojo.LWFormsOutputGoodsModelParam; |
| | | import com.consum.base.pojo.LWhFormOutputParam; |
| | | import com.consum.base.pojo.excel.TemplateExcelExport; |
| | | import com.consum.base.pojo.excel.OutputExcelTemplate; |
| | | import com.consum.base.pojo.query.LWhFormOutputQry; |
| | | import com.consum.model.po.BaseGoodsModels; |
| | | import com.consum.model.po.BaseWarehouse; |
| | |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getExportList(Long id, String userName) { |
| | | public List<OutputExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" |
| | | + "\tfo.BUSINESS_FORM_CODE,\n" |
| | | + "\tfo.AGENCY_NAME tenantName,\n" |
| | | + "\tGOODS_NAME goodsName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tfo.DEAL_TIME createTime,\n" |
| | |
| | | if (CollectionUtils.isEmpty(select)) { |
| | | return null; |
| | | } |
| | | List<TemplateExcelExport> list = Lists.newArrayList(); |
| | | List<OutputExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelExport templateExcelExport = MapUtils.convertMapToObj(item, TemplateExcelExport.class); |
| | | templateExcelExport.setTenantName(StringUtils.isNotEmpty(templateExcelExport.getTenantName()) ? templateExcelExport.getTenantName() : ""); |
| | | templateExcelExport.setRemark(StringUtils.isNotEmpty(templateExcelExport.getRemark()) ? templateExcelExport.getRemark() : ""); |
| | | templateExcelExport.setTotalAmount(templateExcelExport.getTotalAmount() == null ? 0 : templateExcelExport.getTotalAmount()); |
| | | templateExcelExport.setNum(templateExcelExport.getNum() == null ? 0 : templateExcelExport.getNum()); |
| | | OutputExcelTemplate templateExcelExport = MapUtils.convertMapToObj(item, OutputExcelTemplate.class); |
| | | list.add(templateExcelExport); |
| | | }); |
| | | int sum = list.stream().filter(item -> item.getNum() != null).mapToInt(TemplateExcelExport::getNum).sum(); |
| | | int totalAmount = list.stream().filter(export -> export.getTotalAmount() != null).mapToInt(TemplateExcelExport::getTotalAmount).sum(); |
| | | Optional<TemplateExcelExport> first = list.stream().findFirst(); |
| | | TemplateExcelExport templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | return list; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | return map; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.consum.base.core.utils.MapUtils; |
| | | import com.consum.base.core.utils.MapperUtil; |
| | | import com.consum.base.core.utils.PageUtil; |
| | | import com.consum.base.pojo.excel.TemplateExcelExport; |
| | | import com.consum.base.pojo.excel.ProcureExcelTemplate; |
| | | import com.consum.base.pojo.query.FormProcureQry; |
| | | import com.consum.model.po.LWhFormProcure; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getExportList(Long id, String userName) { |
| | | public List<ProcureExcelTemplate> getExportList(Long id) { |
| | | String sql = "SELECT\n" |
| | | + "\tfp.BUSINESS_FORM_CODE,\n" |
| | | + "\tfp.AGENCY_NAME tenantName,\n" |
| | | + "\tfp.INCOME_TIME createTime,\n" |
| | | + "\tfp.INCOME_NAME operatorName,\n" |
| | | + "\tGOODS_NAME goodsName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\tprice,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | |
| | | return null; |
| | | } |
| | | |
| | | List<TemplateExcelExport> list = Lists.newArrayList(); |
| | | List<ProcureExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelExport templateExcelExport = MapUtils.convertMapToObj(item, TemplateExcelExport.class); |
| | | templateExcelExport.setTotalAmount(templateExcelExport.getTotalAmount() == null ? 0 : templateExcelExport.getTotalAmount()); |
| | | templateExcelExport.setNum(templateExcelExport.getNum() == null ? 0 : templateExcelExport.getNum()); |
| | | templateExcelExport.setTenantName(StringUtils.isNotEmpty(templateExcelExport.getTenantName()) ? templateExcelExport.getTenantName() : ""); |
| | | templateExcelExport.setRemark(StringUtils.isNotEmpty(templateExcelExport.getRemark()) ? templateExcelExport.getRemark() : ""); |
| | | ProcureExcelTemplate templateExcelExport = MapUtils.convertMapToObj(item, ProcureExcelTemplate.class); |
| | | list.add(templateExcelExport); |
| | | }); |
| | | int sum = list.stream().filter(item -> item.getNum() != null).mapToInt(TemplateExcelExport::getNum).sum(); |
| | | int totalAmount = list.stream().filter(export -> export.getTotalAmount() != null).mapToInt(TemplateExcelExport::getTotalAmount).sum(); |
| | | Optional<TemplateExcelExport> first = list.stream().findFirst(); |
| | | TemplateExcelExport templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | return list; |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | return map; |
| | | |
| | | } |
| | | } |
| | |
| | | import com.consum.base.pojo.LWhFormTransferGoodsInfoParam; |
| | | import com.consum.base.pojo.LWhProcureModelUserParam; |
| | | import com.consum.base.pojo.LWhTransferModelParam; |
| | | import com.consum.base.pojo.excel.TemplateExcelTransfer; |
| | | import com.consum.base.pojo.excel.TransferExcelTemplate; |
| | | import com.consum.base.pojo.query.TransferQry; |
| | | import com.consum.base.pojo.request.LWhFormTransferParam; |
| | | import com.consum.base.pojo.response.DepartGoodsUseInfo; |
| | |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.model.po.*; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.apache.commons.compress.utils.Lists; |
| | |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/31 |
| | | */ |
| | | public Map<String, Object> export(Long id, Integer type) { |
| | | public List<TransferExcelTemplate> export(Long id, Integer type) { |
| | | String sql = "SELECT\n" |
| | | + "\tft.BUSINESS_FORM_CODE,\n" |
| | | + "\tft.OPERATOR_NAME,\n" |
| | | + "\tft.CREATE_TIME,\n" |
| | | + "\tft.IN_AGENCY_NAME,\n" |
| | | + "\tft.OUT_AGENCY_NAME,\n" |
| | | + "\tGOODS_NAME,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME,\n" |
| | | + "\tGOODS_NAME templateName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME baseModelName,\n" |
| | | + "\tpm.COUNTS num,\n" |
| | | + "\tpm.PRICE,\n" |
| | | + "\tpm.total_amount,\n" |
| | | + "\tft.BEIZ1 remark\n" |
| | | + "FROM\n" |
| | |
| | | Map<String, Object> paramts = new HashMap<>(); |
| | | paramts.put("id", id); |
| | | List<Map<String, Object>> select = this.select(sql, paramts, new MapperUtil()); |
| | | List<TemplateExcelTransfer> list = Lists.newArrayList(); |
| | | List<TransferExcelTemplate> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelTransfer templateExcelTransfer = MapUtils.convertMapToObj(item, TemplateExcelTransfer.class); |
| | | TransferExcelTemplate templateExcelTransfer = MapUtils.convertMapToObj(item, TransferExcelTemplate.class); |
| | | if (type == 1) { |
| | | templateExcelTransfer.setTenantName(templateExcelTransfer.getOutAgencyName()); |
| | | } else { |
| | |
| | | list.add(templateExcelTransfer); |
| | | }); |
| | | |
| | | int countNum = list.stream().filter(item -> item.getNum() != null).mapToInt(TemplateExcelTransfer::getNum).sum(); |
| | | int totalAmount = list.stream().filter(export -> export.getTotalAmount() != null).mapToInt(TemplateExcelTransfer::getTotalAmount).sum(); |
| | | Optional<TemplateExcelTransfer> first = list.stream().findFirst(); |
| | | TemplateExcelTransfer entity = first.get(); |
| | | String businessFormCode = entity.getBusinessFormCode(); |
| | | Long createTime = entity.getCreateTime(); |
| | | String operatorName = entity.getOperatorName(); |
| | | String tenantName; |
| | | if (type == 1) { |
| | | tenantName = entity.getInAgencyName(); |
| | | } else { |
| | | tenantName = entity.getOutAgencyName(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("tenantName", tenantName); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | | |
| | | return map; |
| | | return list; |
| | | } |
| | | |
| | | /** |