|
@@ -1,5 +1,6 @@
|
|
|
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;
|
|
@@ -13,11 +14,13 @@ 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;
|
|
@@ -33,36 +36,69 @@ import java.util.Map;
|
|
|
public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, CostModelList> implements ICostModelListService {
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
- private CostModelListMapper wxfclfMapper;
|
|
|
- private CostModelXmxqWxMapper wxfMapper;
|
|
|
- private CostModelXmxqClMapper clfMapper;
|
|
|
+ public CostModelListMapper wxfclfMapper;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ public CostModelXmxqWxMapper wxfMapper;
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ public CostModelXmxqClMapper clfMapper;
|
|
|
|
|
|
/**
|
|
|
* 成本模型——导出外协费材料费详情excel
|
|
|
*/
|
|
|
- public ModelAndView exportXlsWXFCLFDetail(String costModelListId, Class<CostModelList> clazz, String title) {
|
|
|
+ public ModelAndView exportXlsWXFCLFDetail(String xiangmuid, Class<CostModelList> clazz, String title) {
|
|
|
+// System.out.println("进入服务层");
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
//1.根据项目id查出外协费材料费总计价格、外协费详情、材料费详情
|
|
|
- List<CostModelList> listWxfClf = getWXFCLFDetailList(costModelListId);
|
|
|
- List<CostModelXmxqWx> listWxf = getWXFDetailList(costModelListId);
|
|
|
- List<CostModelXmxqCl> listClf = getCLFDetailList(costModelListId);
|
|
|
+// 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, clazz);
|
|
|
- map1.put(NormalExcelConstants.PARAMS, new ExportParams("外协费报表", "导出人:" + sysUser.getRealname(), "外协费"));
|
|
|
+ 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, clazz);
|
|
|
- map2.put(NormalExcelConstants.PARAMS, new ExportParams("材料费报表", "导出人:" + sysUser.getRealname(), "材料费"));
|
|
|
+ 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);
|
|
@@ -74,17 +110,21 @@ public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, C
|
|
|
}
|
|
|
|
|
|
/**成本模型——外协费材料费各自最大值最小值平均值近期值总和——根据项目id查询*/
|
|
|
- public List<CostModelList> getWXFCLFDetailList(String costModelListId){
|
|
|
- return wxfclfMapper.getWXFCLFDetailList(costModelListId);
|
|
|
+ public List<CostModelList> getWXFCLFDetailList(String xiangmuid){
|
|
|
+ return wxfclfMapper.getWXFCLFDetailList(xiangmuid);
|
|
|
}
|
|
|
|
|
|
- /**项目成本——事务费详情——根据项目id查询*/
|
|
|
- public List<CostModelXmxqWx> getWXFDetailList(String costModelListId){
|
|
|
- return wxfMapper.getWXFDetailList(costModelListId);
|
|
|
+ /**成本模型——外协费详情——根据项目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 costModelListId){
|
|
|
- return clfMapper.getCLFDetailList(costModelListId);
|
|
|
+ public List<CostModelXmxqCl> getCLFDetailList(String xiangmuid){
|
|
|
+// System.out.println("获取材料费详情");
|
|
|
+// System.out.println(clfMapper.getCLFDetailList(xiangmuid));
|
|
|
+ return clfMapper.getCLFDetailList(xiangmuid);
|
|
|
}
|
|
|
}
|