浏览代码

材料费对比详情导出excel

lw 1 年之前
父节点
当前提交
06de11363f

+ 8 - 0
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/controller/WzOutboundOrderHController.java

@@ -68,6 +68,14 @@ public class WzOutboundOrderHController extends JeecgController<WzOutboundOrderH
         return wzOutboundOrderHService.exportHteDetail(list, WzOutboundOrderBDetailListVO.class, "材料费详情");
     }
 
+
+    @ApiOperation(value = "项目成本——材料费详情对比", notes = "项目成本——材料费详情对比")
+    @GetMapping(value = "/compareCLFDetailListExportExcel")
+    public ModelAndView compareCLFDetailListExportExcel(String tasknos) {
+        return wzOutboundOrderHService.compareCLFDetailListExportExcel(tasknos);
+    }
+
+
     /**
      * 项目成本——材料费详情对比
      */

+ 2 - 0
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/service/IWzOutboundOrderHService.java

@@ -33,4 +33,6 @@ public interface IWzOutboundOrderHService extends IService<WzOutboundOrderH> {
     List<WzOutboundOrderBDetailListVO> getClfList(String taskno);
 
     List<CLfCompareDO> getCLFCompareDoListByTaskNoListHasPcCode(String taskno,Boolean hasPcCode,Double proportion);
+
+    ModelAndView compareCLFDetailListExportExcel(String tasknos);
 }

+ 29 - 0
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/service/impl/WzOutboundOrderHServiceImpl.java

@@ -1,14 +1,19 @@
 package org.jeecg.modules.wzOutboundOrder.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.Index.util.CacheKey;
 import org.jeecg.modules.dataSourceSwitch.annotation.TargetDataSource;
 import org.jeecg.modules.dataSourceSwitch.enums.DataSourceType;
 import org.jeecg.modules.wzOutboundOrder.entity.CLfCompareDO;
 import org.jeecg.modules.wzOutboundOrder.entity.WzOutboundOrderH;
 import org.jeecg.modules.wzOutboundOrder.mapper.WzOutboundOrderHMapper;
 import org.jeecg.modules.wzOutboundOrder.service.IWzOutboundOrderHService;
+import org.jeecg.modules.wzOutboundOrder.vo.CLFCompareResultVO;
 import org.jeecg.modules.wzOutboundOrder.vo.WzOutboundOrderBDetailListVO;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -20,6 +25,7 @@ import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.web.servlet.ModelAndView;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -39,6 +45,8 @@ public class WzOutboundOrderHServiceImpl extends ServiceImpl<WzOutboundOrderHMap
     @Value("${jeecg.path.upload}")
     private String upLoadPath;
 
+    @Autowired
+    private RedisUtil redisUtil;
     /**查询列表*/
     public List<WzOutboundOrderH> wzHlist(Wrapper<WzOutboundOrderH> queryWrapper) {
         return this.getBaseMapper().selectList(queryWrapper);
@@ -84,4 +92,25 @@ public class WzOutboundOrderHServiceImpl extends ServiceImpl<WzOutboundOrderHMap
     public List<CLfCompareDO> getCLFCompareDoListByTaskNoListHasPcCode(String taskno,Boolean hasPcCode,Double proportion) {
         return hMapper.getCLFCompareDoListByTaskNoListHasPcCode(taskno,hasPcCode,proportion);
     }
+
+    @Override
+    public ModelAndView compareCLFDetailListExportExcel(String tasknos) {
+        String title = "材料费详情比";
+        ArrayList<CLFCompareResultVO> redisResultList = JSONObject.parseObject(JSONObject.toJSONString(redisUtil.get(CacheKey.CLF_COMPARE_RESULT_VOS + ":" + tasknos)), new TypeReference<ArrayList<CLFCompareResultVO>>() {
+        });
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        // Step.3 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        //此处设置的filename无效 ,前端会重更新设置一下
+        mv.addObject(NormalExcelConstants.FILE_NAME, title);
+        mv.addObject(NormalExcelConstants.CLASS, CLFCompareResultVO.class);
+        //update-begin--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
+        ExportParams  exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title);
+        exportParams.setImageBasePath(upLoadPath);
+        //update-end--Author:liusq  Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
+        mv.addObject(NormalExcelConstants.PARAMS,exportParams);
+        mv.addObject(NormalExcelConstants.DATA_LIST, redisResultList);
+        return mv;
+    }
 }

+ 8 - 0
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/vo/CLFCompareResultVO.java

@@ -1,29 +1,37 @@
 package org.jeecg.modules.wzOutboundOrder.vo;
 
 import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.util.List;
 
 @Data
 public class CLFCompareResultVO {
 
+    @Excel(name = "id", width = 15)
     private String id;
 
+    @Excel(name = "物料编码", width = 15)
     /*物料编码*/
     private String wlbm;
 
+    @Excel(name = "物料名称", width = 15)
     /*物料名称*/
     private String wlmc;
 
+    @Excel(name = "规格型号", width = 15)
     /*规格型号*/
     private String ggxh;
 
+    @Excel(name = "任务", width = 15)
     /*任务集合*/
     private List<CLFCompareTaskResultVo> taskVoList;
 
+    @Excel(name = "金额是否相等", width = 15)
     /*金额是否相等,true相等,false不相等*/
     private Boolean amountEqual;
 
+    @Excel(name = "数量是否相等", width = 15)
     /*数量是否相等,true相等,false不相等*/
     private Boolean countEqual;
 }

+ 6 - 0
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/vo/CLFCompareTaskResultVo.java

@@ -1,24 +1,30 @@
 package org.jeecg.modules.wzOutboundOrder.vo;
 
 import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
 
 @Data
 public class CLFCompareTaskResultVo {
 
+    @Excel(name = "任务号", width = 15)
     /*任务号*/
     private String taskno;
 
+    @Excel(name = "有无标识", width = 15)
     /*标识*/
     private String flag;
 
+    @Excel(name = "总金额", width = 15)
     /*总金额*/
     private BigDecimal totalAmount;
 
+    @Excel(name = "总数量", width = 15)
     /*总数量*/
     private BigDecimal totalCount;
 
+    @Excel(name = "单价", width = 15)
     /*单价*/
     private BigDecimal unitPrice;
 }