forked from rongchao/epmet-cloud-rizhao
19 changed files with 921 additions and 28 deletions
@ -0,0 +1,91 @@ |
|||||
|
package com.epmet.commons.tools.utils.poi.excel.handler;/** |
||||
|
* @author ZhaoQiFeng |
||||
|
* @date 2022/12/14 |
||||
|
* @apiNote |
||||
|
*/ |
||||
|
|
||||
|
import com.alibaba.excel.metadata.Head; |
||||
|
import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
||||
|
import org.apache.commons.collections4.CollectionUtils; |
||||
|
import org.apache.poi.ss.usermodel.Cell; |
||||
|
import org.apache.poi.ss.usermodel.Sheet; |
||||
|
import org.apache.poi.ss.util.CellRangeAddress; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 自定义合并策略 该类继承了AbstractMergeStrategy抽象合并策略,需要重写merge()方法 |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/14 15:10 |
||||
|
*/ |
||||
|
public class CustomMergeStrategy extends AbstractMergeStrategy { |
||||
|
|
||||
|
/** |
||||
|
* 分组,每几行合并一次 |
||||
|
*/ |
||||
|
private List<Integer> exportFieldGroupCountList; |
||||
|
|
||||
|
/** |
||||
|
* 目标合并列index |
||||
|
*/ |
||||
|
private Integer targetColumnIndex; |
||||
|
|
||||
|
// 需要开始合并单元格的首行index
|
||||
|
private Integer rowIndex; |
||||
|
|
||||
|
// exportDataList为待合并目标列的值
|
||||
|
public CustomMergeStrategy(List<String> exportDataList, Integer targetColumnIndex) { |
||||
|
this.exportFieldGroupCountList = getGroupCountList(exportDataList); |
||||
|
this.targetColumnIndex = targetColumnIndex; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Override |
||||
|
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { |
||||
|
|
||||
|
if (null == rowIndex) { |
||||
|
rowIndex = cell.getRowIndex(); |
||||
|
} |
||||
|
// 仅从首行以及目标列的单元格开始合并,忽略其他
|
||||
|
if (cell.getRowIndex() == rowIndex && cell.getColumnIndex() == targetColumnIndex) { |
||||
|
mergeGroupColumn(sheet); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void mergeGroupColumn(Sheet sheet) { |
||||
|
int rowCount = rowIndex; |
||||
|
for (Integer count : exportFieldGroupCountList) { |
||||
|
if(count == 1) { |
||||
|
rowCount += count; |
||||
|
continue ; |
||||
|
} |
||||
|
// 合并单元格
|
||||
|
CellRangeAddress cellRangeAddress = new CellRangeAddress(rowCount, rowCount + count - 1, targetColumnIndex, targetColumnIndex); |
||||
|
sheet.addMergedRegionUnsafe(cellRangeAddress); |
||||
|
rowCount += count; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 该方法将目标列根据值是否相同连续可合并,存储可合并的行数
|
||||
|
private List<Integer> getGroupCountList(List<String> exportDataList){ |
||||
|
if (CollectionUtils.isEmpty(exportDataList)) { |
||||
|
return new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
List<Integer> groupCountList = new ArrayList<>(); |
||||
|
int count = 1; |
||||
|
|
||||
|
for (int i = 1; i < exportDataList.size(); i++) { |
||||
|
if (exportDataList.get(i).equals(exportDataList.get(i - 1))) { |
||||
|
count++; |
||||
|
} else { |
||||
|
groupCountList.add(count); |
||||
|
count = 1; |
||||
|
} |
||||
|
} |
||||
|
// 处理完最后一条后
|
||||
|
groupCountList.add(count); |
||||
|
return groupCountList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package com.epmet.dataaggre.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Author zxc |
||||
|
* @DateTime 2020/12/25 上午10:47 |
||||
|
*/ |
||||
|
public interface EventConstant { |
||||
|
String PROJECT = "project"; |
||||
|
String WORK = "work"; |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
package com.epmet.dataaggre.dto.evaluationindex.form; |
||||
|
|
||||
|
import com.epmet.commons.tools.dto.form.PageFormDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author Administrator |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventCategoryListFormDTO extends PageFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public interface EventCategoryForm{} |
||||
|
public interface CategoryEventExportForm {} |
||||
|
public interface CategoryEventListExportForm {} |
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 组织ID |
||||
|
*/ |
||||
|
private String orgId; |
||||
|
|
||||
|
/** |
||||
|
* 组织类型 组织:agency,网格:grid |
||||
|
*/ |
||||
|
private String orgType; |
||||
|
|
||||
|
@NotBlank(message = "结束时间不能为空",groups = {EventCategoryForm.class,CategoryEventExportForm.class}) |
||||
|
private String endTime; |
||||
|
|
||||
|
/** |
||||
|
* 类型,project:事件, work:例行工作 |
||||
|
*/ |
||||
|
@NotNull(message = "事件类型不能为空",groups = CategoryEventListExportForm.class) |
||||
|
private String eventType; |
||||
|
|
||||
|
/** |
||||
|
* 开始时间 |
||||
|
*/ |
||||
|
private String startTime; |
||||
|
|
||||
|
/** |
||||
|
* 组织名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "组织名称不能为空",groups = CategoryEventExportForm.class) |
||||
|
private String orgName; |
||||
|
|
||||
|
@NotNull(message = "categoryCode不能为空",groups = {EventCategoryForm.class, CategoryEventListExportForm.class}) |
||||
|
private String categoryCode; |
||||
|
|
||||
|
@NotNull(message = "categoryName不能为空",groups = CategoryEventListExportForm.class) |
||||
|
private String categoryName; |
||||
|
private String parentCategoryName; |
||||
|
|
||||
|
private String name; |
||||
|
private String mobile; |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.epmet.dataaggre.dto.evaluationindex.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @author Administrator |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventCategoryListResultDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 事件ID |
||||
|
*/ |
||||
|
private String eventId; |
||||
|
|
||||
|
/** |
||||
|
* 事件类型 项目:project,例行工作:work |
||||
|
*/ |
||||
|
private String eventType; |
||||
|
|
||||
|
/** |
||||
|
* 标题 |
||||
|
*/ |
||||
|
private String title; |
||||
|
|
||||
|
/** |
||||
|
* 类别 |
||||
|
*/ |
||||
|
private String category; |
||||
|
|
||||
|
/** |
||||
|
* 项目状态:待处理 pending,结案closed |
||||
|
*/ |
||||
|
private String status; |
||||
|
|
||||
|
/** |
||||
|
* 项目状态:待处理 pending,结案closed |
||||
|
*/ |
||||
|
private String statusDesc; |
||||
|
|
||||
|
/** |
||||
|
* 所属网格 |
||||
|
*/ |
||||
|
private String gridName; |
||||
|
private String gridId; |
||||
|
/** |
||||
|
* 项目创建时间 |
||||
|
*/ |
||||
|
private String createTime; |
||||
|
|
||||
|
private String staffName; |
||||
|
|
||||
|
private Integer score; |
||||
|
|
||||
|
} |
@ -0,0 +1,33 @@ |
|||||
|
package com.epmet.dataaggre.dto.evaluationindex.result;/** |
||||
|
* @author ZhaoQiFeng |
||||
|
* @date 2022/12/14 |
||||
|
* @apiNote |
||||
|
*/ |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author zhaoqifeng |
||||
|
* @Date 2022/12/14 13:39 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class EventScoreTotalResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 2570384890580378137L; |
||||
|
private String orgName; |
||||
|
private String date; |
||||
|
/** |
||||
|
* 总分 |
||||
|
*/ |
||||
|
private String totalScore; |
||||
|
/** |
||||
|
* 网格员数量 |
||||
|
*/ |
||||
|
private String memberCount; |
||||
|
/** |
||||
|
* 考核得分 |
||||
|
*/ |
||||
|
private String aveScore; |
||||
|
} |
Binary file not shown.
Loading…
Reference in new issue