提交 eea9b06b authored 作者: Matrix's avatar Matrix

[核查模块] 重构了统一跳转的接口

上级 a93f8d7d
......@@ -16,11 +16,11 @@ public enum CheckType {
/**
* 自动核查
*/
CT_CHECK(1, "核查"),
CT_CHECK(0, "核查"),
/**
* 手动核查
*/
CT_EXAM(2, "检查");
CT_EXAM(1, "检查");
private final Integer id;
private final String name;
......
......@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.objenesis.ObjenesisHelper;
import javax.validation.constraints.NotNull;
......@@ -87,15 +88,26 @@ public class CheckAreaStatVo implements Cloneable {
* @throws IllegalArgumentException 在合并的地区名不同或者统计账单id不同时会抛出(初始账单合并除外,即this.detailId=0)
*/
public CheckAreaStatVo reduce(@NotNull CheckAreaStatVo other) {
// 合并的两个对象地区与账单id必须相同
if (!this.areaName.equals(other.areaName) || this.areaStatId != other.areaStatId) {
if (!this.areaName.equals(other.areaName) || this.areaDetailId != other.areaDetailId) {
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if (this.areaDetailId == 0) {
this.areaDetailId = other.areaStatId;
this.areaDetailId = other.areaDetailId;
} else {
throw new IllegalArgumentException(String.format(
"要合并的两个地区统计数据的areaName与areaDetailId必须保持一致," +
"你提供的分别是areaName = %s 与 %s , areaDetailId = %d 与 %d %n",
this.areaName, other.areaName, this.areaDetailId, other.areaDetailId));
}
}
if (!this.areaName.equals(other.areaName) || this.areaStatId != other.areaStatId) {
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if (this.areaStatId == 0) {
this.areaStatId = other.areaStatId;
} else {
throw new IllegalArgumentException(String.format(
"要合并的两个地区统计数据的areaName与areaStatId必须保持一致," +
"你提供的分别是areaName = %s 与 %s , areaStatId = %d 与 %d %n",
this.areaName, other.areaName, this.areaStatId, other.areaStatId));
}
}
......@@ -119,11 +131,10 @@ public class CheckAreaStatVo implements Cloneable {
@SuppressWarnings("DuplicatedCode")
public CheckAreaStatVo cleanReduce(@NotNull CheckAreaStatVo other) {
// 合并的两个对象地区与账单id必须相同
if (!this.areaName.equals(other.areaName) || this.areaStatId != other.areaStatId) {
if (!this.areaName.equals(other.areaName) || this.areaDetailId != other.areaDetailId) {
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if (this.areaDetailId == 0) {
this.areaDetailId = other.areaDetailId;
// this.areaStatId = other.areaStatId;
} else {
throw new IllegalArgumentException(String.format(
"要合并的两个地区统计数据的areaName与areaDetailId必须保持一致," +
......@@ -132,6 +143,18 @@ public class CheckAreaStatVo implements Cloneable {
}
}
if (!this.areaName.equals(other.areaName) || this.areaStatId != other.areaStatId) {
//初始化账单的话则不用抛出异常,将other的detailId赋予即可
if (this.areaStatId == 0) {
this.areaStatId = other.areaStatId;
} else {
throw new IllegalArgumentException(String.format(
"要合并的两个地区统计数据的areaName与areaStatId必须保持一致," +
"你提供的分别是areaName = %s 与 %s , areaStatId = %d 与 %d %n",
this.areaName, other.areaName, this.areaStatId, other.areaStatId));
}
}
CheckAreaStatVo reducedVo = new CheckAreaStatVo(this);
reducedVo.actualCount += other.actualCount;
reducedVo.comProgress = other.comProgress;
......@@ -149,4 +172,22 @@ public class CheckAreaStatVo implements Cloneable {
this.comSituation = other.getComSituation();
return this;
}
public CheckAreaStatVo combine(CheckAreaStatVo other) {
this.areaName = other.getAreaName();
this.supposeCount += other.getSupposeCount();
this.actualCount += other.getActualCount();
if (other.comProgress == 1){
this.comProgress =1;
}
if (other.comSituation ==1){
this.comSituation =1;
}
return this;
}
public RevAreaStat reverse(){
return new RevAreaStat(areaName, actualCount, supposeCount, comProgress, comSituation);
}
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* LinkCheckDetail.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 7:50 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class LinkCheckDetail {
private String checkUnit;
private String checkSituation;
private String checkResult;
private int remark;
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* LinkExamDetail.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 8:54 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class LinkExamDetail {
/**
* 检查组名称
*/
private String examName;
/**
* 检查组成员
*/
private String examUser;
private String checkUnit;
private String checkSituation;
private String checkResult;
private int remark;
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.List;
/**
* StatLinkVo.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 7:43 下午
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel("统一跳转对象")
public class LinkVo {
/**
* 1 省统计 2 市检查 3 详情跳转
*/
private int type;
private LocalDate endTime;
private List<LinkCheckDetail> lcDetail;
private List<LinkExamDetail> leDetail;
private int detailId;
public LinkVo(int type, LocalDate endTime) {
this.type = type;
this.endTime = endTime;
}
}
package com.tykj.dev.device.confirmcheck.entity.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* RevAreaStat.
*
* @author Matrix <xhyrzldf@gmail.com>
* @since 2021/5/13 at 8:00 下午
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class RevAreaStat {
/**
* 地区名称
*/
private String areaName;
/**
* 实查数量
*/
private int actualCount;
/**
* 应查数量
*/
private int supposeCount;
/**
* 完成进度 0-待办 , 1-进行中, 2-已完成
*/
private int comProgress;
/**
* 完成情况 0-无误 1-有异常
*/
private int comSituation;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论