修改统计加油订单导出

master
胡锐 3 months ago
parent c5b23ff7c6
commit 5c3d5a2be0
  1. 60
      bweb/src/main/java/com/bweb/controller/BsGasOrderCountController.java
  2. 8
      bweb/src/main/java/com/bweb/controller/SecMenuController.java
  3. 1
      service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java
  4. 4
      service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java
  5. 11
      service/src/main/java/com/hfkj/service/sec/impl/SecMenuServiceImpl.java

@ -2,7 +2,13 @@ package com.bweb.controller;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.handler.AbstractCellWriteHandler;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.metadata.fill.FillWrapper; import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
@ -18,9 +24,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -65,6 +69,7 @@ public class BsGasOrderCountController {
HashMap<String,Object> mer = new HashMap<>(); HashMap<String,Object> mer = new HashMap<>();
mer.put("merNo", data.get("merNo")); mer.put("merNo", data.get("merNo"));
mer.put("merName", data.get("merName")); mer.put("merName", data.get("merName"));
mer.put("merStatus", data.get("merStatus"));
merList.add(mer); merList.add(mer);
} }
@ -153,6 +158,7 @@ public class BsGasOrderCountController {
// 设置内容的策略 // 设置内容的策略
WriteCellStyle contentWriteCellStyle = ExcelUtil.getWriteCellStyle(); WriteCellStyle contentWriteCellStyle = ExcelUtil.getWriteCellStyle();
WriteCellStyle headWriteCellStyle = new WriteCellStyle(); WriteCellStyle headWriteCellStyle = new WriteCellStyle();
// 设置头部水平居中对齐 // 设置头部水平居中对齐
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
@ -164,6 +170,54 @@ public class BsGasOrderCountController {
.head(getSaleSheetHeadList(startTime, dataList)) .head(getSaleSheetHeadList(startTime, dataList))
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(20)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(20))
.registerWriteHandler(new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle)) .registerWriteHandler(new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle))
.registerWriteHandler(new CellWriteHandler() {
@Override
public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer integer, Integer integer1, Boolean aBoolean) {
}
@Override
public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {
}
@Override
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<CellData> list, Cell cell, Head head, Integer integer, Boolean aBoolean) {
int rowIndex = cell.getRowIndex();
int columnIndex = cell.getColumnIndex();
Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
if (rowIndex > 1) {
if (rowIndex <= merList.size()) {
HashMap<String, Object> map = merList.get(rowIndex - 2);
if (!map.isEmpty() && !map.get("merStatus").toString().equals("1")) {
CellStyle oldCellStyle = cell.getCellStyle();
CellStyle newCellStyle = workbook.createCellStyle();
newCellStyle.cloneStyleFrom(oldCellStyle);
newCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
newCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
cell.setCellStyle(newCellStyle);
}
}
}
if (rowIndex > 1 && (columnIndex == 2 || columnIndex == 6 || columnIndex == 10 || columnIndex == 14 || columnIndex == 18)) {
CellStyle oldCellStyle = cell.getCellStyle();
CellStyle newCellStyle = workbook.createCellStyle();
newCellStyle.cloneStyleFrom(oldCellStyle);
Font font = workbook.createFont();
font.setColor(IndexedColors.RED.index);
newCellStyle.setFont(font);
cell.setCellStyle(newCellStyle);
}
}
})
.sheet("统计") .sheet("统计")
.doWrite(excelDataList); .doWrite(excelDataList);
return ResponseMsgUtil.success(path); return ResponseMsgUtil.success(path);

@ -192,13 +192,17 @@ public class SecMenuController {
//} //}
} }
// 筛选角色菜单叶节点 List<SecMenu> menuList1 = secMenuService.queryRoleMenu(roleId, null);
for (SecMenu menu : menuList1) {
roleLeafList.add(""+menu.getId());
}
/* // 筛选角色菜单叶节点
for (String leaf : menuLeafList) { for (String leaf : menuLeafList) {
SecMenu menu = roleMenu.get(Long.parseLong(leaf)); SecMenu menu = roleMenu.get(Long.parseLong(leaf));
if (menu != null) { if (menu != null) {
roleLeafList.add(""+menu.getId()); roleLeafList.add(""+menu.getId());
} }
} }*/
return ResponseMsgUtil.success(roleLeafList); return ResponseMsgUtil.success(roleLeafList);

@ -162,6 +162,7 @@ public interface BsGasOrderMapperExt {
" a.id merId," + " a.id merId," +
" a.mer_no merNo," + " a.mer_no merNo," +
" a.mer_name merName," + " a.mer_name merName," +
" a.status merStatus," +
" case when b.totalCount is not null then b.totalCount else 0 end totalCount," + " case when b.totalCount is not null then b.totalCount else 0 end totalCount," +
" case when b.totalCountRatio is not null then b.totalCountRatio else 0 end totalCountRatio," + " case when b.totalCountRatio is not null then b.totalCountRatio else 0 end totalCountRatio," +
" case when b.totalPrice is not null then b.totalPrice else 0 end totalPrice," + " case when b.totalPrice is not null then b.totalPrice else 0 end totalPrice," +

@ -191,8 +191,8 @@ public class BsMerchantServiceImpl implements BsMerchantService {
criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "areaCode")); criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "areaCode"));
} }
if (MapUtils.getLong(param, "status") != null) { if (MapUtils.getInteger(param, "status") != null) {
criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "status")); criteria.andStatusEqualTo(MapUtils.getInteger(param, "status"));
} }
if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) {

@ -129,9 +129,14 @@ public class SecMenuServiceImpl implements SecMenuService {
.collect(Collectors.toMap(SecRoleMenuRel::getMenuId, Function.identity())); .collect(Collectors.toMap(SecRoleMenuRel::getMenuId, Function.identity()));
// 获取系统菜单 // 获取系统菜单
List<SecMenu> menuList = getAllList().stream() List<SecMenu> menuList = getAllList();
.filter(o->o.getMenuType().equals(menuType.getCode()))
if (menuType != null) {
// 过滤类型
menuList = menuList.stream()
.filter(o-> o.getMenuType().equals(menuType.getCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
}
Iterator<SecMenu> iterator = menuList.iterator(); Iterator<SecMenu> iterator = menuList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -210,8 +215,10 @@ public class SecMenuServiceImpl implements SecMenuService {
List<SecRoleMenuRel> roleMenuRelList = secRoleMenuRelService.getRelListByRole(roleId); List<SecRoleMenuRel> roleMenuRelList = secRoleMenuRelService.getRelListByRole(roleId);
for (SecRoleMenuRel rel : roleMenuRelList) { for (SecRoleMenuRel rel : roleMenuRelList) {
Object obj = secMenuMap.get(""+rel.getMenuId()); Object obj = secMenuMap.get(""+rel.getMenuId());
if (obj != null) {
roleMenuList.add((SecMenu) obj); roleMenuList.add((SecMenu) obj);
} }
}
// 获取最顶层菜单 // 获取最顶层菜单
List<SecMenu> topLevelMenuList = roleMenuList.stream() List<SecMenu> topLevelMenuList = roleMenuList.stream()
.filter(o -> o.getMenuPSid() == null) .filter(o -> o.getMenuPSid() == null)

Loading…
Cancel
Save