|
@@ -1,10 +1,12 @@
|
|
|
package org.jeecg.modules.Index.service.impl;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
+import com.alibaba.excel.EasyExcelFactory;
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
|
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
|
|
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.common.system.util.JwtUtil;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -55,8 +57,14 @@ import org.jeecg.modules.wzOutboundOrderBNew.mapper.WzOutboundOrderBNewMapper;
|
|
|
import org.jeecg.modules.wzOutboundOrderBNew.service.IWzOutboundOrderBNewService;
|
|
|
import org.jeecg.modules.xmcbDetail.entity.ComContractInfoExchange;
|
|
|
import org.jeecg.modules.xmcbDetail.mapper.ComContractInfoExchangeMapper;
|
|
|
+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.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.nio.file.Path;
|
|
@@ -185,6 +193,9 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
private IndexKpiMapper indexKpiMapper;
|
|
|
|
|
|
|
|
|
+ @Value("${jeecg.path.upload}")
|
|
|
+ private String upLoadPath;
|
|
|
+
|
|
|
private static final String YEAR = "year";
|
|
|
|
|
|
private static final String MONTH = "month";
|
|
@@ -205,7 +216,12 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
instance.setTime(new Date());
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
- instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.setTime(new Date());
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ instance.set(Calendar.MINUTE, 0);
|
|
|
+ instance.set(Calendar.SECOND, 0);
|
|
|
+ instance.set(Calendar.MILLISECOND, 0);
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
@@ -262,7 +278,12 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
instance.setTime(new Date());
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
- instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.setTime(new Date());
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ instance.set(Calendar.MINUTE, 0);
|
|
|
+ instance.set(Calendar.SECOND, 0);
|
|
|
+ instance.set(Calendar.MILLISECOND, 0);
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
@@ -320,7 +341,12 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
instance.setTime(new Date());
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
- instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.setTime(new Date());
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ instance.set(Calendar.MINUTE, 0);
|
|
|
+ instance.set(Calendar.SECOND, 0);
|
|
|
+ instance.set(Calendar.MILLISECOND, 0);
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
@@ -377,7 +403,12 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
instance.setTime(new Date());
|
|
|
setZeroMonth(instance);
|
|
|
Date currentMothBginDate = instance.getTime();
|
|
|
- instance.add(Calendar.MONTH, 1);
|
|
|
+ instance.setTime(new Date());
|
|
|
+ instance.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ instance.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ instance.set(Calendar.MINUTE, 0);
|
|
|
+ instance.set(Calendar.SECOND, 0);
|
|
|
+ instance.set(Calendar.MILLISECOND, 0);
|
|
|
Date currentMothEndDate = instance.getTime();
|
|
|
|
|
|
if (AuthMark.DEPT_LEADER.equals(role)) {
|
|
@@ -929,17 +960,17 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
|
|
|
private void exprotExcel(List<WzOutboundOrderBNewExport> wzList, List<ProjectChbZyfExpoet> zyfList, List<ProjectChbZyfExpoet> swfList, List<ProjectChbZyfExpoet> wxfList, List<ProjectChbZyfExpoet> rdfList, List<ProjectChbZyfExpoet> zjfList, List<ProjectChbZyfExpoet> rgfList, List<ProjectChbZyfExpoet> glfList, List<ProjectChbZyfExpoet> sxfList) {
|
|
|
// 创建ExcelWriter并添加Sheet
|
|
|
- ExcelWriter writer = EasyExcel.write("D:/桌面/可知可视相关/成本额详情.xlsx").build();
|
|
|
-
|
|
|
- WriteSheet sheet1 = EasyExcel.writerSheet(0,"材料费").head(WzOutboundOrderBNewExport.class).build();
|
|
|
- WriteSheet sheet2 = EasyExcel.writerSheet(1,"专用费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet3 = EasyExcel.writerSheet(2,"事务费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet4 = EasyExcel.writerSheet(3,"外协费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet5 = EasyExcel.writerSheet(4,"燃料动力费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet6 = EasyExcel.writerSheet(5,"固定资产折旧费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet7 = EasyExcel.writerSheet(6,"工资及劳务费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet8 = EasyExcel.writerSheet(7,"管理费").head(ProjectChbZyfExpoet.class).build();
|
|
|
- WriteSheet sheet9 = EasyExcel.writerSheet(8,"筛选费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ ExcelWriter writer = EasyExcelFactory.write("D:/桌面/可知可视相关/成本额详情.xlsx").build();
|
|
|
+
|
|
|
+ WriteSheet sheet1 = EasyExcelFactory.writerSheet(0,"材料费").head(WzOutboundOrderBNewExport.class).build();
|
|
|
+ WriteSheet sheet2 = EasyExcelFactory.writerSheet(1,"专用费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet3 = EasyExcelFactory.writerSheet(2,"事务费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet4 = EasyExcelFactory.writerSheet(3,"外协费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet5 = EasyExcelFactory.writerSheet(4,"燃料动力费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet6 = EasyExcelFactory.writerSheet(5,"固定资产折旧费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet7 = EasyExcelFactory.writerSheet(6,"工资及劳务费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet8 = EasyExcelFactory.writerSheet(7,"管理费").head(ProjectChbZyfExpoet.class).build();
|
|
|
+ WriteSheet sheet9 = EasyExcelFactory.writerSheet(8,"筛选费").head(ProjectChbZyfExpoet.class).build();
|
|
|
|
|
|
writer.write(wzList,sheet1);
|
|
|
writer.write(zyfList,sheet2);
|
|
@@ -994,16 +1025,23 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
String finalDateLastYm = dateLastYm;
|
|
|
|
|
|
if (finalIsCurrentDate){
|
|
|
- CompletableFuture<List<IndexKpiDetail>> getList1Future = CompletableFuture.supplyAsync(() -> indexKpiMapper.getFinallNumDetailList(finalDateLastYm,departName));
|
|
|
- CompletableFuture<List<IndexKpiDetail>> getList2Future = CompletableFuture.supplyAsync(() -> indexKpiMapper.getNewNumDetailList(finalDateLastYm,departName));
|
|
|
- CompletableFuture<Void> future = CompletableFuture.allOf(getList1Future,getList2Future);
|
|
|
- future.join();
|
|
|
- List<IndexKpiDetail> list1 = getList1Future.join();
|
|
|
- List<IndexKpiDetail> list2 = getList2Future.join();
|
|
|
- detailList.addAll(list1);
|
|
|
- detailList.addAll(list2);
|
|
|
+ //CompletableFuture<List<IndexKpiDetail>> getList1Future = CompletableFuture.supplyAsync(() -> indexKpiMapper.getFinallNumDetailList(page,finalDateLastYm,departName));
|
|
|
+ //CompletableFuture<List<IndexKpiDetail>> getList2Future = CompletableFuture.supplyAsync(() -> indexKpiMapper.getNewNumDetailList(page,finalDateLastYm,departName));
|
|
|
+ //CompletableFuture<Void> future = CompletableFuture.allOf(getList1Future,getList2Future);
|
|
|
+ //future.join();
|
|
|
+ //List<IndexKpiDetail> list1 = getList1Future.join();
|
|
|
+ //List<IndexKpiDetail> list2 = getList2Future.join();
|
|
|
+ //detailList.clear();
|
|
|
+ //if (list1.size() > 0 && list1.get(0) != null) {
|
|
|
+ // detailList.addAll(list1);
|
|
|
+ //}
|
|
|
+ //if (list2.size() > 0 && list2.get(0) != null) {
|
|
|
+ // detailList.addAll(list2);
|
|
|
+ //}
|
|
|
+ detailList = indexKpiMapper.getFinalNewNumDetailList(page,finalDateLastYm,departName);
|
|
|
+
|
|
|
}else {
|
|
|
- detailList = indexKpiMapper.getHteReceivedZrbmSelectYmDetail(finalDateYm,finalDateLastYm,departName);
|
|
|
+ detailList = indexKpiMapper.getHteReceivedZrbmSelectYmDetail(page,finalDateYm,finalDateLastYm,departName);
|
|
|
}
|
|
|
|
|
|
return detailList;
|
|
@@ -1013,14 +1051,125 @@ public class IndexNewServiceImpl implements IndexNewServer {
|
|
|
public List<ComContractInfoExchangeNewHTEVO> getXdbmHteDepartKpiDetailList(Page<ComContractInfoExchangeNewHTEVO> page, HttpServletRequest request, IndexKpiParamDto indexKpiParamDto, String departName) {
|
|
|
// 查询的时间
|
|
|
String selectDate = indexKpiParamDto.getBeginDate();
|
|
|
- return exchangeNewMapper.getXdbmHteDetail(selectDate,departName);
|
|
|
+ return exchangeNewMapper.getXdbmHteDetail(page,selectDate,departName);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<ComContractInfoExchangeNewYSKVO> getXdbmYskDepartKpiDetailList(Page<ComContractInfoExchangeNewYSKVO> page, HttpServletRequest request, IndexKpiParamDto indexKpiParamDto, String departName) {
|
|
|
// 查询的时间
|
|
|
String selectDate = indexKpiParamDto.getBeginDate();
|
|
|
- return exchangeNewMapper.getXdbmYskDetail(selectDate,departName);
|
|
|
+ return exchangeNewMapper.getXdbmYskDetail(page,selectDate,departName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<IndexKpiDetail> getZrbmDepartKpiDetailListAll(IndexKpiParamDto indexKpiParamDto,String departName) {
|
|
|
+ List<IndexKpiDetail> detailList = new ArrayList<>();
|
|
|
+ // 查询的类型 (按年/按月)
|
|
|
+ String type = indexKpiParamDto.getTime();
|
|
|
+ // 查询的时间
|
|
|
+ String selectDate = indexKpiParamDto.getBeginDate();
|
|
|
+ // 当前系统时间
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ // 当前年
|
|
|
+ int currentYear = currentDate.getYear();
|
|
|
+ //当前年月
|
|
|
+ String currentYm = String.format("%d-%02d", currentYear, currentDate.getMonthValue());
|
|
|
+ //用来存放要看的年末或月末的年月日期 上一年末或上一月末的日期
|
|
|
+ String dateYm = "";
|
|
|
+ String dateLastYm = "";
|
|
|
+ boolean isCurrentDate = true;//是否是当年或当月,当年或当月要从项目成本表中获取数据
|
|
|
+
|
|
|
+ try {
|
|
|
+ if ("year".equals(type)){
|
|
|
+ isCurrentDate = String.valueOf(currentYear).equals(selectDate);
|
|
|
+ if (isCurrentDate){
|
|
|
+ dateYm = getCurronMonthString(currentYm);
|
|
|
+ }else{
|
|
|
+ dateYm = String.format("%s-%d", Integer.parseInt(selectDate), 12);
|
|
|
+ }
|
|
|
+ dateLastYm = String.format("%d-%d", Integer.parseInt(selectDate)-1, 12);
|
|
|
+ }else if ("month".equals(type)){
|
|
|
+ isCurrentDate = currentYm.equals(selectDate);
|
|
|
+ dateYm = getCurronMonthString(selectDate);
|
|
|
+ dateLastYm = getLastMonthString(selectDate);
|
|
|
+ }
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ boolean finalIsCurrentDate = isCurrentDate;
|
|
|
+ String finalDateYm = dateYm;
|
|
|
+ String finalDateLastYm = dateLastYm;
|
|
|
+
|
|
|
+ if (finalIsCurrentDate){
|
|
|
+ detailList = indexKpiMapper.getFinalNewNumDetailListAll(finalDateLastYm,departName);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ detailList = indexKpiMapper.getHteReceivedZrbmSelectYmDetailAll(finalDateYm,finalDateLastYm,departName);
|
|
|
+ }
|
|
|
+ return detailList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ModelAndView exportZrbmDetailExcel(List<IndexKpiDetail> list, Class<IndexKpiDetail> clazz, String title) {
|
|
|
+ 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, IndexKpiDetail.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, list);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ComContractInfoExchangeNewHTEVO> getXdbmhteDepartKpiDetailListAll(IndexKpiParamDto indexKpiParamDto, String departName) {
|
|
|
+ String selectDate = indexKpiParamDto.getBeginDate();
|
|
|
+ return exchangeNewMapper.getXdbmHteDetailAll(selectDate,departName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ModelAndView exportXdbmHteDetailExcel(List<ComContractInfoExchangeNewHTEVO> list, Class<ComContractInfoExchangeNewHTEVO> clazz, String title) {
|
|
|
+ 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, IndexKpiDetail.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, list);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ComContractInfoExchangeNewYSKVO> getXdbmyskDepartKpiDetailListAll(IndexKpiParamDto indexKpiParamDto, String departName) {
|
|
|
+ String selectDate = indexKpiParamDto.getBeginDate();
|
|
|
+ return exchangeNewMapper.getXdbmYskDetailAll(selectDate,departName);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ModelAndView exportXdbmYskDetailExcel(List<ComContractInfoExchangeNewYSKVO> list, Class<ComContractInfoExchangeNewYSKVO> clzz, String title) {
|
|
|
+ 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, IndexKpiDetail.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, list);
|
|
|
+ return mv;
|
|
|
}
|
|
|
|
|
|
public void setZeroMonth(Calendar instance) {
|