|
@@ -1,11 +1,30 @@
|
|
|
package org.jeecg.modules.costModelList.service.impl;
|
|
|
|
|
|
+import org.apache.poi.ss.usermodel.Sheet;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
+import org.jeecg.common.system.vo.LoginUser;
|
|
|
import org.jeecg.modules.costModelList.entity.CostModelList;
|
|
|
import org.jeecg.modules.costModelList.mapper.CostModelListMapper;
|
|
|
import org.jeecg.modules.costModelList.service.ICostModelListService;
|
|
|
+import org.jeecg.modules.costModelXmxqCl.entity.CostModelXmxqCl;
|
|
|
+import org.jeecg.modules.costModelXmxqCl.mapper.CostModelXmxqClMapper;
|
|
|
+import org.jeecg.modules.costModelXmxqWx.entity.CostModelXmxqWx;
|
|
|
+import org.jeecg.modules.costModelXmxqWx.mapper.CostModelXmxqWxMapper;
|
|
|
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
+import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Repository;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @Description: 成本模型
|
|
@@ -15,5 +34,97 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, CostModelList> implements ICostModelListService {
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ public CostModelListMapper wxfclfMapper;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ public CostModelXmxqWxMapper wxfMapper;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ public CostModelXmxqClMapper clfMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 成本模型——导出外协费材料费详情excel
|
|
|
+ */
|
|
|
+ public ModelAndView exportXlsWXFCLFDetail(String xiangmuid, Class<CostModelList> clazz, String title) {
|
|
|
+// System.out.println("进入服务层");
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ //1.根据项目id查出外协费材料费总计价格、外协费详情、材料费详情
|
|
|
+// System.out.println("从数据库中获取详情列表");
|
|
|
+ List<CostModelList> listWxfClf = getWXFCLFDetailList(xiangmuid);
|
|
|
+ List<CostModelXmxqWx> listWxf = getWXFDetailList(xiangmuid);
|
|
|
+ List<CostModelXmxqCl> listClf = getCLFDetailList(xiangmuid);
|
|
|
+// CostModelList wxfclfAll = new CostModelList(); //创建成本模型对象存储项目的外协费材料费总和 此处只是项目唯一选中进行导出
|
|
|
+// for(CostModelList wxfclf:listWxfClf){
|
|
|
+// wxfclfAll.setMaxWxf(wxfclf.getMaxWxf());
|
|
|
+// wxfclfAll.setMinWxf(wxfclf.getMinWxf());
|
|
|
+// wxfclfAll.setAveWxf(wxfclf.getAveWxf());
|
|
|
+// wxfclfAll.setMaxClf(wxfclf.getMaxClf());
|
|
|
+// wxfclfAll.setMinClf(wxfclf.getMinClf());
|
|
|
+// wxfclfAll.setAveClf(wxfclf.getAveClf());
|
|
|
+// wxfclfAll.setRecentClf(wxfclf.getRecentClf());
|
|
|
+// }
|
|
|
+ CostModelXmxqWx wxfAll = new CostModelXmxqWx();
|
|
|
+ wxfAll.setXiangmuName("合计");
|
|
|
+ wxfAll.setMaxPrice(listWxfClf.get(0).getMaxWxf());
|
|
|
+ wxfAll.setMinPrice(listWxfClf.get(0).getMinWxf());
|
|
|
+ wxfAll.setAvePrice(listWxfClf.get(0).getAveWxf());
|
|
|
+ listWxf.add(wxfAll);
|
|
|
+
|
|
|
+ CostModelXmxqCl clfAll = new CostModelXmxqCl();
|
|
|
+ clfAll.setXiangmuName("合计");
|
|
|
+ clfAll.setMaxPrice(listWxfClf.get(0).getMaxClf());
|
|
|
+ clfAll.setMinPrice(listWxfClf.get(0).getMinClf());
|
|
|
+ clfAll.setAvePrice(listWxfClf.get(0).getAveClf());
|
|
|
+ clfAll.setRecentPrice(listWxfClf.get(0).getRecentClf());
|
|
|
+ listClf.add(clfAll);
|
|
|
+ //2.多sheep输入
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ //外协费
|
|
|
+// System.out.println("制作外协表");
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put(NormalExcelConstants.CLASS, CostModelXmxqWx.class);
|
|
|
+ map1.put(NormalExcelConstants.PARAMS, new ExportParams("外协费详情表", "导出人:" + sysUser.getRealname(), "外协费"));
|
|
|
+ map1.put(NormalExcelConstants.DATA_LIST, listWxf);
|
|
|
+
|
|
|
+ list.add(map1);
|
|
|
+ //材料费
|
|
|
+// System.out.println("制作材料表");
|
|
|
+ Map<String, Object> map2 = new HashMap<>();
|
|
|
+ map2.put(NormalExcelConstants.CLASS, CostModelXmxqCl.class);
|
|
|
+ map2.put(NormalExcelConstants.PARAMS, new ExportParams("材料费详情表", "导出人:" + sysUser.getRealname(), "材料费"));
|
|
|
+ map2.put(NormalExcelConstants.DATA_LIST, listClf);
|
|
|
+ list.add(map2);
|
|
|
+
|
|
|
+ //3.AutoPoi 导出Excel
|
|
|
+// System.out.println("导出excel");
|
|
|
+ ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
|
+ mv.addObject(NormalExcelConstants.FILE_NAME, title); //文件名称,但是前端会重新命名
|
|
|
+ mv.addObject(NormalExcelConstants.MAP_LIST, list);
|
|
|
+// mv.addObject(NormalExcelConstants.CLASS, clazz); //实体类型
|
|
|
+// mv.addObject(NormalExcelConstants.PARAMS,new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title));//标题,sheet名称
|
|
|
+// mv.addObject(NormalExcelConstants.DATA_LIST, listWxf); //list数据
|
|
|
+
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**成本模型——外协费材料费各自最大值最小值平均值近期值总和——根据项目id查询*/
|
|
|
+ public List<CostModelList> getWXFCLFDetailList(String xiangmuid){
|
|
|
+ return wxfclfMapper.getWXFCLFDetailList(xiangmuid);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**成本模型——外协费详情——根据项目id查询*/
|
|
|
+ public List<CostModelXmxqWx> getWXFDetailList(String xiangmuid){
|
|
|
+// System.out.println("获取外协费详情");
|
|
|
+// System.out.println(wxfMapper.getWXFDetailList(xiangmuid));
|
|
|
+ return wxfMapper.getWXFDetailList(xiangmuid);
|
|
|
+ }
|
|
|
|
|
|
+ /**成本模型——材料费详情——根据项目id查询*/
|
|
|
+ public List<CostModelXmxqCl> getCLFDetailList(String xiangmuid){
|
|
|
+// System.out.println("获取材料费详情");
|
|
|
+// System.out.println(clfMapper.getCLFDetailList(xiangmuid));
|
|
|
+ return clfMapper.getCLFDetailList(xiangmuid);
|
|
|
+ }
|
|
|
}
|