diff --git a/bweb/src/main/java/com/bweb/controller/BsGasOrderCountController.java b/bweb/src/main/java/com/bweb/controller/BsGasOrderCountController.java index c1c6083..fb57f29 100644 --- a/bweb/src/main/java/com/bweb/controller/BsGasOrderCountController.java +++ b/bweb/src/main/java/com/bweb/controller/BsGasOrderCountController.java @@ -2,7 +2,13 @@ package com.bweb.controller; import com.alibaba.excel.EasyExcel; 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.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteTableHolder; import com.alibaba.excel.write.metadata.style.WriteCellStyle; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; @@ -18,9 +24,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.poi.ss.usermodel.HorizontalAlignment; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -65,6 +69,7 @@ public class BsGasOrderCountController { HashMap mer = new HashMap<>(); mer.put("merNo", data.get("merNo")); mer.put("merName", data.get("merName")); + mer.put("merStatus", data.get("merStatus")); merList.add(mer); } @@ -153,6 +158,7 @@ public class BsGasOrderCountController { // 设置内容的策略 WriteCellStyle contentWriteCellStyle = ExcelUtil.getWriteCellStyle(); + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); // 设置头部水平居中对齐 headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); @@ -164,6 +170,54 @@ public class BsGasOrderCountController { .head(getSaleSheetHeadList(startTime, dataList)) .registerWriteHandler(new SimpleColumnWidthStyleStrategy(20)) .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 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 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("统计") .doWrite(excelDataList); return ResponseMsgUtil.success(path); diff --git a/bweb/src/main/java/com/bweb/controller/SecMenuController.java b/bweb/src/main/java/com/bweb/controller/SecMenuController.java index f5aa22e..6b8473e 100644 --- a/bweb/src/main/java/com/bweb/controller/SecMenuController.java +++ b/bweb/src/main/java/com/bweb/controller/SecMenuController.java @@ -192,13 +192,17 @@ public class SecMenuController { //} } - // 筛选角色菜单叶节点 + List menuList1 = secMenuService.queryRoleMenu(roleId, null); + for (SecMenu menu : menuList1) { + roleLeafList.add(""+menu.getId()); + } + /* // 筛选角色菜单叶节点 for (String leaf : menuLeafList) { SecMenu menu = roleMenu.get(Long.parseLong(leaf)); if (menu != null) { roleLeafList.add(""+menu.getId()); } - } + }*/ return ResponseMsgUtil.success(roleLeafList); @@ -282,7 +286,7 @@ public class SecMenuController { } else { map.put("title", "【按钮】"+menu.getMenuName()); } - // 获取下级菜单 + // 获取下级菜单 List> recursioned = recursionMenu(dataSource, menu.getId(), leaf); if (recursioned.isEmpty()) { leaf.add(""+menu.getId()); diff --git a/service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java b/service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java index 62f82b5..bb5c312 100644 --- a/service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java +++ b/service/src/main/java/com/hfkj/dao/BsGasOrderMapperExt.java @@ -162,6 +162,7 @@ public interface BsGasOrderMapperExt { " a.id merId," + " a.mer_no merNo," + " a.mer_name merName," + + " a.status merStatus," + " 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.totalPrice is not null then b.totalPrice else 0 end totalPrice," + diff --git a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java index 805e409..7ddfb78 100644 --- a/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/merchant/impl/BsMerchantServiceImpl.java @@ -191,8 +191,8 @@ public class BsMerchantServiceImpl implements BsMerchantService { criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "areaCode")); } - if (MapUtils.getLong(param, "status") != null) { - criteria.andAreaCodeEqualTo(MapUtils.getLong(param, "status")); + if (MapUtils.getInteger(param, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); } if (StringUtils.isNotBlank(MapUtils.getString(param, "merNo"))) { diff --git a/service/src/main/java/com/hfkj/service/sec/impl/SecMenuServiceImpl.java b/service/src/main/java/com/hfkj/service/sec/impl/SecMenuServiceImpl.java index c640379..ad14992 100644 --- a/service/src/main/java/com/hfkj/service/sec/impl/SecMenuServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/sec/impl/SecMenuServiceImpl.java @@ -129,9 +129,14 @@ public class SecMenuServiceImpl implements SecMenuService { .collect(Collectors.toMap(SecRoleMenuRel::getMenuId, Function.identity())); // 获取系统菜单 - List menuList = getAllList().stream() - .filter(o->o.getMenuType().equals(menuType.getCode())) - .collect(Collectors.toList()); + List menuList = getAllList(); + + if (menuType != null) { + // 过滤类型 + menuList = menuList.stream() + .filter(o-> o.getMenuType().equals(menuType.getCode())) + .collect(Collectors.toList()); + } Iterator iterator = menuList.iterator(); while (iterator.hasNext()) { @@ -210,7 +215,9 @@ public class SecMenuServiceImpl implements SecMenuService { List roleMenuRelList = secRoleMenuRelService.getRelListByRole(roleId); for (SecRoleMenuRel rel : roleMenuRelList) { Object obj = secMenuMap.get(""+rel.getMenuId()); - roleMenuList.add((SecMenu) obj); + if (obj != null) { + roleMenuList.add((SecMenu) obj); + } } // 获取最顶层菜单 List topLevelMenuList = roleMenuList.stream()