|
@@ -1,11 +1,27 @@
|
|
|
package org.jeecg.modules.costModelList.service.impl;
|
|
|
|
|
|
+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.Service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @Description: 成本模型
|
|
@@ -15,5 +31,60 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
*/
|
|
|
@Service
|
|
|
public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, CostModelList> implements ICostModelListService {
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ private CostModelListMapper wxfclfMapper;
|
|
|
+ private CostModelXmxqWxMapper wxfMapper;
|
|
|
+ private CostModelXmxqClMapper clfMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 成本模型——导出外协费材料费详情excel
|
|
|
+ */
|
|
|
+ public ModelAndView exportXlsWXFCLFDetail(String costModelListId, Class<CostModelList> clazz, String title) {
|
|
|
+ LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
+ //1.根据项目id查出外协费材料费总计价格、外协费详情、材料费详情
|
|
|
+ List<CostModelList> listWxfClf = getWXFCLFDetailList(costModelListId);
|
|
|
+ List<CostModelXmxqWx> listWxf = getWXFDetailList(costModelListId);
|
|
|
+ List<CostModelXmxqCl> listClf = getCLFDetailList(costModelListId);
|
|
|
+
|
|
|
+ //2.多sheep输入
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ //外协费
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put(NormalExcelConstants.CLASS, clazz);
|
|
|
+ map1.put(NormalExcelConstants.PARAMS, new ExportParams("外协费报表", "导出人:" + sysUser.getRealname(), "外协费"));
|
|
|
+ map1.put(NormalExcelConstants.DATA_LIST, listWxf);
|
|
|
+ list.add(map1);
|
|
|
+ //材料费
|
|
|
+ Map<String, Object> map2 = new HashMap<>();
|
|
|
+ map2.put(NormalExcelConstants.CLASS, clazz);
|
|
|
+ map2.put(NormalExcelConstants.PARAMS, new ExportParams("材料费报表", "导出人:" + sysUser.getRealname(), "材料费"));
|
|
|
+ map2.put(NormalExcelConstants.DATA_LIST, listClf);
|
|
|
+ list.add(map2);
|
|
|
+
|
|
|
+ //3.AutoPoi 导出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 costModelListId){
|
|
|
+ return wxfclfMapper.getWXFCLFDetailList(costModelListId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**项目成本——事务费详情——根据项目id查询*/
|
|
|
+ public List<CostModelXmxqWx> getWXFDetailList(String costModelListId){
|
|
|
+ return wxfMapper.getWXFDetailList(costModelListId);
|
|
|
+ }
|
|
|
|
|
|
+ /**成本模型——材料费详情——根据项目id查询*/
|
|
|
+ public List<CostModelXmxqCl> getCLFDetailList(String costModelListId){
|
|
|
+ return clfMapper.getCLFDetailList(costModelListId);
|
|
|
+ }
|
|
|
}
|