|
@@ -4,13 +4,20 @@ import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.modules.costModelClPrice.entity.CostModelClPrice;
|
|
|
+import org.jeecg.modules.costModelClPrice.mapper.CostModelClPriceMapper;
|
|
|
+import org.jeecg.modules.costModelClPrice.service.ICostModelClPriceService;
|
|
|
+import org.jeecg.modules.costModelClPrice.service.impl.CostModelClPriceServiceImpl;
|
|
|
+import org.jeecg.modules.costModelClPrice.vo.CostModelClPriceExportVO;
|
|
|
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.costModelXmxqCl.service.ICostModelXmxqClService;
|
|
|
import org.jeecg.modules.costModelXmxqWx.entity.CostModelXmxqWx;
|
|
|
import org.jeecg.modules.costModelXmxqWx.mapper.CostModelXmxqWxMapper;
|
|
|
+import org.jeecg.modules.costModelXmxqWx.service.ICostModelXmxqWxService;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
@@ -37,13 +44,19 @@ import java.util.Map;
|
|
|
public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, CostModelList> implements ICostModelListService {
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
- public CostModelListMapper costModelListMapper;
|
|
|
+ private CostModelListMapper costModelListMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
- public CostModelXmxqWxMapper wxfMapper;
|
|
|
+ private ICostModelClPriceService costModelClPriceService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ @SuppressWarnings("all")
|
|
|
+ private ICostModelXmxqWxService costModelXmxqWxService;
|
|
|
+
|
|
|
@Autowired
|
|
|
@SuppressWarnings("all")
|
|
|
- public CostModelXmxqClMapper clfMapper;
|
|
|
+ private ICostModelXmxqClService costModelXmxqClService;
|
|
|
|
|
|
/**判端项目名称是否重名,false无重名,true重名*/
|
|
|
public Boolean chongmingPanduan(String xmName){
|
|
@@ -58,11 +71,34 @@ public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, C
|
|
|
public ModelAndView exportXlsWXFCLFDetail(String xiangmuid, Class<CostModelList> clazz, String title) {
|
|
|
// System.out.println("进入服务层");
|
|
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
- //1.根据项目id查出外协费材料费总计价格、外协费详情、材料费详情
|
|
|
+ //1.根据项目id查出外协费材料费总计价格、外协费总和详情、材料费总和详情
|
|
|
// System.out.println("从数据库中获取详情列表");
|
|
|
List<CostModelList> listWxfClf = getWXFCLFDetailList(xiangmuid);
|
|
|
- List<CostModelXmxqWx> listWxf = getWXFDetailList(xiangmuid);
|
|
|
- List<CostModelXmxqCl> listClf = getCLFDetailList(xiangmuid);
|
|
|
+ List<CostModelXmxqWx> listWxf = costModelXmxqWxService.getWXFDetailList(xiangmuid);
|
|
|
+ List<CostModelXmxqCl> listClf = costModelXmxqClService.getCLFDetailList(xiangmuid);
|
|
|
+
|
|
|
+ //用来存储查找到的材料价格库详情信息
|
|
|
+ List<CostModelClPriceExportVO> listClPToExcel = new ArrayList<>();
|
|
|
+ for(CostModelXmxqCl xmxqCl:listClf){
|
|
|
+ //根据物料编码、规格型号、质量等级、批次查找单价以及采购时间
|
|
|
+ List<CostModelClPrice> listClp = costModelClPriceService.getCLPDetailList(xmxqCl);
|
|
|
+
|
|
|
+ for(CostModelClPrice clp:listClp){
|
|
|
+ CostModelClPriceExportVO clPriceExportVO = new CostModelClPriceExportVO();
|
|
|
+ clPriceExportVO.setXiangmuName(xmxqCl.getXiangmuName());
|
|
|
+ clPriceExportVO.setWlbm(clp.getWlbm());
|
|
|
+ clPriceExportVO.setGgxh(clp.getGgxh());
|
|
|
+ clPriceExportVO.setZlLevel(clp.getZlLevel());
|
|
|
+ clPriceExportVO.setPici(clp.getPici());
|
|
|
+ clPriceExportVO.setHtDate(clp.getHtDate());
|
|
|
+ clPriceExportVO.setDanjia(clp.getDanjia());
|
|
|
+ clPriceExportVO.setNumber(xmxqCl.getNumber());
|
|
|
+ listClPToExcel.add(clPriceExportVO);
|
|
|
+ }
|
|
|
+ }
|
|
|
+// System.out.println("获取写入表格的材料费详情信息");
|
|
|
+// listClPToExcel.forEach(System.out::println);
|
|
|
+
|
|
|
// CostModelList wxfclfAll = new CostModelList(); //创建成本模型对象存储项目的外协费材料费总和 此处只是项目唯一选中进行导出
|
|
|
// for(CostModelList wxfclf:listWxfClf){
|
|
|
// wxfclfAll.setMaxWxf(wxfclf.getMaxWxf());
|
|
@@ -73,13 +109,13 @@ public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, C
|
|
|
// 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());
|
|
@@ -87,25 +123,36 @@ public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, C
|
|
|
clfAll.setAvePrice(listWxfClf.get(0).getAveClf());
|
|
|
clfAll.setRecentPrice(listWxfClf.get(0).getRecentClf());
|
|
|
listClf.add(clfAll);
|
|
|
+// System.out.println("获取外协费和材料费总和信息");
|
|
|
+// listWxf.forEach(System.out::println);
|
|
|
+// listClf.forEach(System.out::println);
|
|
|
+
|
|
|
+
|
|
|
//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.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.PARAMS, new ExportParams("材料费总和详情表", "导出人:" + sysUser.getRealname(), "材料费"));
|
|
|
map2.put(NormalExcelConstants.DATA_LIST, listClf);
|
|
|
list.add(map2);
|
|
|
|
|
|
+ //材料费详情
|
|
|
+// System.out.println("制作材料详情表");
|
|
|
+ Map<String, Object> map3 = new HashMap<>();
|
|
|
+ map3.put(NormalExcelConstants.CLASS, CostModelClPriceExportVO.class);
|
|
|
+ map3.put(NormalExcelConstants.PARAMS, new ExportParams("材料价格详情表", "导出人:" + sysUser.getRealname(), "材料价格详情"));
|
|
|
+ map3.put(NormalExcelConstants.DATA_LIST, listClPToExcel);
|
|
|
+ list.add(map3);
|
|
|
+
|
|
|
//3.AutoPoi 导出Excel
|
|
|
// System.out.println("导出excel");
|
|
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
|
@@ -123,17 +170,5 @@ public class CostModelListServiceImpl extends ServiceImpl<CostModelListMapper, C
|
|
|
return costModelListMapper.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);
|
|
|
- }
|
|
|
}
|