Commit 01388fc1 authored by tangwei's avatar tangwei

修改扫描bug

parent f041fec9
...@@ -15,7 +15,7 @@ import lombok.experimental.Accessors; ...@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("asf_fire_rpn_change_log") @TableName("asf_fire_rpn_change_CODE)
public class FireRpnChangeLog extends BaseEntity { public class FireRpnChangeLog extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
//package com.yeejoin.equipmanage.common.annotation;
//
//import java.lang.annotation.*;
//
///**
// * @author DELL
// */
//@Retention(RetentionPolicy.RUNTIME)
//@Target({ElementType.TYPE})
//@Documented
//public @interface FillCommonUserField {
// boolean isAutoFill() default true;
//}
...@@ -22,5 +22,6 @@ public class GlobalCache { ...@@ -22,5 +22,6 @@ public class GlobalCache {
*/ */
public static Map<String, String> paramMap = new ConcurrentHashMap<>(1000); public static Map<String, String> paramMap = new ConcurrentHashMap<>(1000);
private GlobalCache() {
}
} }
...@@ -80,112 +80,6 @@ public interface Constant { ...@@ -80,112 +80,6 @@ public interface Constant {
String fourSmallTopicfireFoamMistSys = "fourSmallTopicfireFoamMistSys"; String fourSmallTopicfireFoamMistSys = "fourSmallTopicfireFoamMistSys";
// String SMALL_PRO_PRCODE = "SMALL_PRO_PRCODE_";
/**
* 任务-作业交底
*/
// Integer JOB_TYPE = 0;
/**
* 任务-三交三查
*/
// Integer HAND_QUERY = 1;
// String JSON_NULL = "[]";
/**
* 违规管理
*/
// Integer BAD_MANAGEMENT = 2;
// Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
// String FILE_SEPARATOR = System.getProperty("file.separator");
// DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// String PAGE_NUM = "0";
//
// String SIZE_NUM = "20";
//
// String PAGE = "page";
//
// String SIZE = "size";
//
//
// String ZERO = "0";
//
// String ONE = "1";
//
// String TWO = "2";
//
// String THREE = "3";
//
// String FOUR = "4";
//
// String FIVE = "5";
/**
* 请求错误
*/
// String ERROR = "300";
/**
* 无权限
*/
// String PERMISSION = "401";
/**
* 请求成功,其他错误
*/
// String DATA_NULL = "402";
/**
* 请求失败
*/
// String FAILED = "999";
/**
* 最大值
*/
// Integer MAX = 32767;
/**
* 数据请求返回码
*/
//成功
// public static final int RESCODE_SUCCESS = 1000;
// //成功(有返回信息)
// public static final int RESCODE_SUCCESS_MSG = 1001;
// //请求抛出异常
// public static final int RESCODE_EXCEPTION = 1002;
// //未登陆状态
// public static final int RESCODE_NOLOGIN = 1003;
// //查询结果为空
// public static final int RESCODE_NOEXIST = 1004;
// //无操作权限
// public static final int RESCODE_NOAUTH = 1005;
// //登录过期
// public static final int RESCODE_LOGINEXPIRE = 1006;
/**
* token
*/
// //Token过期
// public static final int JWT_ERRCODE_EXPIRE = 1007;
// //验证不通过
// public static final int JWT_ERRCODE_FAIL = 1008;
/**
* jwt
*/
// public static final String JWT_ID = "jwt-black";//jwt签发者
// public static final String JWT_SECRET = "Isi5Ob9OfvJt+4IHoMJlHkS1ttg=";//密匙
// public static final int JWT_TTL = 60 * 60 * 1000; // 60*60*1000; //millisecond
// public static final int JWT_REFRESH_INTERVAL = 18 * 1000; //55*60*1000; //millisecond
// public static final int JWT_REFRESH_TTL = 60 * 1000; // 12*60*60*1000; //millisecond
} }
package com.yeejoin.equipmanage.common.datasync.enums; package com.yeejoin.equipmanage.common.datasync.enums;
import com.yeejoin.equipmanage.common.utils.finalString;
/** /**
* <h1>同步数据类型</h1> * <h1>同步数据类型</h1>
* *
...@@ -7,112 +9,112 @@ package com.yeejoin.equipmanage.common.datasync.enums; ...@@ -7,112 +9,112 @@ package com.yeejoin.equipmanage.common.datasync.enums;
* @Date 2021-04-01 09:20 * @Date 2021-04-01 09:20
*/ */
public enum SyncDataTypeEnum { public enum SyncDataTypeEnum {
/** /**
* 巡检项 * 巡检项
*/ */
ASF_FIRE_PATROL_ITEM("11", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_ITEM("11", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检点 * 巡检点
*/ */
ASF_FIRE_PATROL_POINT("12", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_POINT("12", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检点检查项 * 巡检点检查项
*/ */
ASF_FIRE_PATROL_POINT_ITEM("60", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_POINT_ITEM("60", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检路线 * 巡检路线
*/ */
ASF_FIRE_PATROL_ROUTE("61", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_ROUTE("61", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检路线点 * 巡检路线点
*/ */
ASF_FIRE_PATROL_ROUTE_POINT("62", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_ROUTE_POINT("62", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检路线点检查项 * 巡检路线点检查项
*/ */
ASF_FIRE_PATROL_ROUTE_POINT_ITEM("63", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_ROUTE_POINT_ITEM("63", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检计划 * 巡检计划
*/ */
ASF_FIRE_PATROL_PLAN("64", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_PLAN("64", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检任务 * 巡检任务
*/ */
ASF_FIRE_PATROL_PLAN_TASK("65", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_PLAN_TASK("65", finalString.URL, finalString.ISNOTIOT),
/** /**
* 任务详情 * 任务详情
*/ */
ASF_FIRE_PATROL_PLAN_TASK_DETAIL("66", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_PLAN_TASK_DETAIL("66", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡检记录 * 巡检记录
*/ */
ASF_FIRE_PATROL_CHECK_RECORD("67", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_CHECK_RECORD("67", finalString.URL, finalString.ISNOTIOT),
/** /**
* 巡查记录详情 * 巡查记录详情
*/ */
ASF_FIRE_PATROL_CHECK_RECORD_DETAIL("68", "cs/v1/fireASF/dataSync", "isNotIot"), ASF_FIRE_PATROL_CHECK_RECORD_DETAIL("68", finalString.URL, finalString.ISNOTIOT),
/** /**
* 区域 * 区域
*/ */
AST_AREA("01", "cs/v1/fireAST/dataSync", "isNotIot"), AST_AREA("01", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 建筑 * 建筑
*/ */
AST_BUILDING("02", "cs/v1/fireAST/dataSync", "building"), AST_BUILDING("02", finalString.URLST, "building"),
/** /**
* 围墙 * 围墙
*/ */
AST_WALL("03", "cs/v1/fireAST/dataSync", "isNotIot"), AST_WALL("03", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 楼层 * 楼层
*/ */
AST_FLOOR("04", "cs/v1/fireAST/dataSync", "floor"), AST_FLOOR("04", finalString.URLST, "floor"),
/** /**
* 小室 * 小室
*/ */
AST_ROOM("05", "cs/v1/fireAST/dataSync", "room"), AST_ROOM("05", finalString.URLST, "room"),
/** /**
* 消防系统 * 消防系统
*/ */
AST_FIRE_FIGHTING("07", "cs/v1/fireAST/dataSync", "isNotIot"), AST_FIRE_FIGHTING("07", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 消防设备 * 消防设备
*/ */
AST_FIRE_EQUIP("08", "cs/v1/fireAST/dataSync", "isNotIot"), AST_FIRE_EQUIP("08", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 消防设备参数信息 * 消防设备参数信息
*/ */
AST_FIRE_EQUIP_INFO("0801", "cs/v1/fireAST/dataSync", "isNotIot"), AST_FIRE_EQUIP_INFO("0801", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 消防设备量测信息 * 消防设备量测信息
*/ */
AST_FIRE_EQUIP_MEASUREMENT("0802", "cs/v1/fireAST/dataSync", "isIot"), AST_FIRE_EQUIP_MEASUREMENT("0802", finalString.URLST, "isIot"),
/** /**
* 消防设备火警 * 消防设备火警
*/ */
AST_FIRE_EQUIP_ALARM("0803", "cs/v1/fireASF/dataSync", "isNotIot"), AST_FIRE_EQUIP_ALARM("0803", finalString.URL, finalString.ISNOTIOT),
/** /**
* 消防设备故障 * 消防设备故障
*/ */
AST_FIRE_EQUIP_FAULT_ALARM("0804", "cs/v1/fireASF/dataSync", "isNotIot"), AST_FIRE_EQUIP_FAULT_ALARM("0804", finalString.URL, finalString.ISNOTIOT),
/** /**
* 消防设备缺陷 * 消防设备缺陷
*/ */
AST_FIRE_EQUIP_DEFECT_ALARM("0805", "cs/v1/fireASF/dataSync", "isNotIot"), AST_FIRE_EQUIP_DEFECT_ALARM("0805", finalString.URL, finalString.ISNOTIOT),
/** /**
* 消防车辆 * 消防车辆
*/ */
AST_FIRE_VEHICLE("09", "cs/v1/fireAST/dataSync", "isNotIot"), AST_FIRE_VEHICLE("09", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 消防车辆参数信息 * 消防车辆参数信息
*/ */
AST_FIRE_VEHICLE_INFO("0901", "cs/v1/fireAST/dataSync", "isNotIot"), AST_FIRE_VEHICLE_INFO("0901", finalString.URLST, finalString.ISNOTIOT),
/** /**
* 消防车辆量测信息 * 消防车辆量测信息
*/ */
AST_FIRE_VEHICLE_MEASUREMENT("0902", "cs/v1/fireAST/dataSync", "isIot"), AST_FIRE_VEHICLE_MEASUREMENT("0902", finalString.URLST, "isIot");
;
/** /**
* 资源类型编码 * 资源类型编码
......
...@@ -37,7 +37,5 @@ public class MaintenanceResourceDto extends BaseTreeNode { ...@@ -37,7 +37,5 @@ public class MaintenanceResourceDto extends BaseTreeNode {
*/ */
private String contractId; private String contractId;
public MaintenanceResourceDto() {
}
} }
\ No newline at end of file
//package com.yeejoin.equipmanage.common.entity;
//
//import com.baomidou.mybatisplus.annotation.TableField;
//import com.baomidou.mybatisplus.annotation.TableName;
//import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//import lombok.EqualsAndHashCode;
//
//import java.util.Date;
//
///**
// * @author DELL
// */
//@Data
//@TableName("wl_equipment_specific_alarm")
//@EqualsAndHashCode(callSuper = true)
//@ApiModel(value = "wl_equipment_specific_alarm", description = "设备报警信息表")
//public class ConfirmEquipmentSpecificAlarm extends BaseEntity {
//
// @ApiModelProperty(value = "机构code")
// @TableField("org_code")
// private String orgCode;
//
// @ApiModelProperty(value = "装备名称")
// @TableField("equipment_specific_name")
// private String equipmentSpecificName;
//
// @ApiModelProperty(value = "消防设备id")
// @TableField("equipment_specific_id")
// private Long equipmentSpecificId;
//
// @ApiModelProperty(value = "iot编码")
// @TableField("iot_code")
// private String iotCode;
//
// @ApiModelProperty(value = "指标名称")
// @TableField("equipment_specific_index_name")
// private String equipmentSpecificIndexName;
//
// @ApiModelProperty(value = "指标编码")
// @TableField("equipment_specific_index_key")
// private String equipmentSpecificIndexKey;
//
// @ApiModelProperty(value = "报警值")
// @TableField("equipment_specific_index_value")
// private String equipmentSpecificIndexValue;
//
// @ApiModelProperty(value = "发生频次")
// @TableField("frequency")
// private int frequency;
//
// @ApiModelProperty(value = "报警状态:1报警0恢复")
// @TableField("status")
// private int status;
//
// @ApiModelProperty(value = "报警类型:alarm_type_fire(火灾报警)/alarm_type_trouble(故障告警)")
// @TableField("type")
// private String type;
//
// @ApiModelProperty(value = "更新时间")
// @TableField("update_date")
// private Date updateDate;
//
// @ApiModelProperty(value = "告警恢复时间")
// @TableField("recovery_date")
// private Date recoveryDate;
//
// @ApiModelProperty(value = "指标id")
// @TableField("equipment_index_id")
// private Long equipmentIndexId;
//
// @ApiModelProperty(value = "确认类型")
// @TableField("confirm_type")
// private String confirmType;
//
// @ApiModelProperty(value = "报警原因")
// @TableField("alam_reason")
// private String alamReason;
//
// @ApiModelProperty(value = "处理情况")
// @TableField("resolve_result")
// private String resolveResult;
//
// @ApiModelProperty(value = "确警人员")
// @TableField("confirm_user")
// private String confirmUser;
//
// @ApiModelProperty(value = "确警时间")
// @TableField("confirm_date")
// private Date confirmDate;
//
//
// @ApiModelProperty(value = "画布id")
// @TableField(exist = false)
// private Long sceneId;
//
// @ApiModelProperty(value = "告警内容")
// @TableField(exist = false)
// private String alamContent;
//
// @ApiModelProperty(value = "告警部位")
// @TableField(exist = false)
// private String alamPlace;
//
// @ApiModelProperty(value = "告警设备名称")
// @TableField(exist = false)
// private String equipmentName;
//
// @ApiModelProperty(value = "保护对象")
// @TableField(exist = false)
// private String protectName;
//
// @ApiModelProperty(value = "是否已处理")
// @TableField(exist = false)
// private String isConfirm;
//
// @ApiModelProperty(value = "是否批量")
// @TableField(exist = false)
// private int isBatch;
//
//
//}
...@@ -49,9 +49,7 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC ...@@ -49,9 +49,7 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
@ApiModelProperty(value = "行业id") @ApiModelProperty(value = "行业id")
private String industryCode; private String industryCode;
// 此业务字段暂时不用,后期业务下发可放开
// @ApiModelProperty(value = "装备二级分类图片")
// private String img;
@ApiModelProperty(value = "行业名称") @ApiModelProperty(value = "行业名称")
@TableField(exist = false) @TableField(exist = false)
......
...@@ -103,8 +103,7 @@ public class EquipmentSpecificIndex extends BaseEntity { ...@@ -103,8 +103,7 @@ public class EquipmentSpecificIndex extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String indexName; private String indexName;
// @TableField(exist = false)
// private String equipmentSpecificName;
@TableField(exist = false) @TableField(exist = false)
private String equipmentSpecificIndexName; private String equipmentSpecificIndexName;
......
package com.yeejoin.equipmanage.common.entity; package com.yeejoin.equipmanage.common.entity;
import com.yeejoin.equipmanage.common.exception.BaseException;
import lombok.NonNull; import lombok.NonNull;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -66,7 +67,9 @@ public class MyByteArrayMultipartFile implements MultipartFile { ...@@ -66,7 +67,9 @@ public class MyByteArrayMultipartFile implements MultipartFile {
try { try {
outputStream = new FileOutputStream(destination); outputStream = new FileOutputStream(destination);
outputStream.write(bytes); outputStream.write(bytes);
} finally { }catch(Exception e){
throw new BaseException("系统异常!");
}finally {
if (outputStream != null) { if (outputStream != null) {
outputStream.close(); outputStream.close();
} }
......
...@@ -9,7 +9,7 @@ import lombok.Data; ...@@ -9,7 +9,7 @@ import lombok.Data;
* @since v2.0 * @since v2.0
*/ */
@Data @Data
public class SourceNameListDTO extends BaseDTO { public class SourceNameListDTO extends BaseDTO<SourceNameListDTO> {
/** /**
* 建筑id * 建筑id
*/ */
......
...@@ -15,7 +15,7 @@ import java.util.Date; ...@@ -15,7 +15,7 @@ import java.util.Date;
* @version $Id: TopographyTreeDTO.java, v 0.1 2021年10月19日 下午1:46:23 gwb Exp $ * @version $Id: TopographyTreeDTO.java, v 0.1 2021年10月19日 下午1:46:23 gwb Exp $
*/ */
@Data @Data
public class TopographyTreeDTO implements TreeNode { public class TopographyTreeDTO implements TreeNode<TopographyTreeDTO,String> {
/** /**
...@@ -69,7 +69,7 @@ public class TopographyTreeDTO implements TreeNode { ...@@ -69,7 +69,7 @@ public class TopographyTreeDTO implements TreeNode {
*/ */
private String authOrg; private String authOrg;
private Collection children; private Collection<TopographyTreeDTO> children;
@Override @Override
public String getMyParentId() public String getMyParentId()
...@@ -83,11 +83,11 @@ public class TopographyTreeDTO implements TreeNode { ...@@ -83,11 +83,11 @@ public class TopographyTreeDTO implements TreeNode {
return this.code; return this.code;
} }
@Override
public int compareTo(Object o)
{
TreeNode node = (TreeNode) o;
return node.getMyId().equals(this.code)? 0 : 1;
}
@Override
public int compareTo(TopographyTreeDTO o) {
TopographyTreeDTO node = o;
return node.getMyId().equals(this.code)? 0 : 1;
}
} }
...@@ -35,8 +35,7 @@ public class BaseTreeNode { ...@@ -35,8 +35,7 @@ public class BaseTreeNode {
public BaseTreeNode() {
}
public String getId() { public String getId() {
return id; return id;
...@@ -83,8 +82,9 @@ public class BaseTreeNode { ...@@ -83,8 +82,9 @@ public class BaseTreeNode {
} }
public void addChild(BaseTreeNode baseTreeNode) { public void addChild(BaseTreeNode baseTreeNode) {
if (this.children == null) { if (this.children == null) {
this.setChildren(new ArrayList()); this.setChildren(new ArrayList<BaseTreeNode>());
} }
this.getChildren().add(baseTreeNode); this.getChildren().add(baseTreeNode);
} }
......
...@@ -27,28 +27,6 @@ public class DevOverviewVO { ...@@ -27,28 +27,6 @@ public class DevOverviewVO {
private String qrCode; private String qrCode;
// 图片名称 // 图片名称
private String picName; private String picName;
//'items': [
// { 'key': '设备名称', 'value': ''
// },
// { 'key': '器材分类', 'value': ''
// },
// { 'key': '设备名称', 'value': ''
// },
// { 'key': '安装位置', 'value': ''
// },
// { 'key': '运行状态', 'value': ''
// },
// { 'key': '维保状态', 'value': ''
// },
// { 'key': '巡检状态', 'value': ''
// },
// { 'key': '编码', 'value': ''
// },
// { 'key': '所属系统', 'value': ''
// },
// { 'key': '负责人', 'value': ''
// }
// ]
// }
private List<Map<String, Object>> items; private List<Map<String, Object>> items;
} }
...@@ -51,15 +51,7 @@ public class DownloadEquipmentDataVO { ...@@ -51,15 +51,7 @@ public class DownloadEquipmentDataVO {
*/ */
private Long equipmentId; private Long equipmentId;
/**
* 装备定义名
*/
// private String equipmentName;
/**
* 装备定义编码
*/
// private String equipmentCode;
/** /**
* 装备定义非核心性能指标 * 装备定义非核心性能指标
......
...@@ -17,28 +17,6 @@ public class ProductInfoVO { ...@@ -17,28 +17,6 @@ public class ProductInfoVO {
private List<String> pic; private List<String> pic;
// 图片名称 // 图片名称
private String picName; private String picName;
//'items': [
// { 'key': '名称', 'value': ''
// },
// { 'key': '规格型号', 'value': ''
// },
// { 'key': '进口/国产', 'value': ''
// },
// { 'key': '维保周期', 'value': ''
// },
// { 'key': '报废年限', 'value': ''
// },
// { 'key': '计量单位', 'value': ''
// },
// { 'key': '品牌', 'value': ''
// },
// { 'key': '国别', 'value': ''
// },
// { 'key': '巡检频率', 'value': ''
// },
// { 'key': '备注', 'value': ''
// }
// ]
// },
private List<Map<String,Object>> items; private List<Map<String,Object>> items;
} }
...@@ -20,13 +20,7 @@ public class EquipStatusChecker { ...@@ -20,13 +20,7 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能重复维修!"); return createResult(false, "该装备正在维修中,不能重复维修!");
// case LOAN:
// return createResult(false, "该装备已借出,不能维修!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能维修!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能维修!");
//
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能维修!"); return createResult(false, "该装备已报废,不能维修!");
case LOSS: case LOSS:
...@@ -48,12 +42,7 @@ public class EquipStatusChecker { ...@@ -48,12 +42,7 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能保养!"); return createResult(false, "该装备正在维修中,不能保养!");
// case LOAN:
// return createResult(false, "该装备已借出,不能保养!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能保养!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能保养!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能保养!"); return createResult(false, "该装备已报废,不能保养!");
case LOSS: case LOSS:
...@@ -75,12 +64,7 @@ public class EquipStatusChecker { ...@@ -75,12 +64,7 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能调拨!"); return createResult(false, "该装备正在维修中,不能调拨!");
// case LOAN:
// return createResult(false, "该装备已借出,不能调拨!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能调拨!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能调拨!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能调拨!"); return createResult(false, "该装备已报废,不能调拨!");
case LOSS: case LOSS:
...@@ -100,20 +84,14 @@ public class EquipStatusChecker { ...@@ -100,20 +84,14 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能出库!"); return createResult(false, "该装备正在维修中,不能出库!");
// case LOAN:
// return createResult(false, "该装备已借出,不能执行出库操作!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能执行出库操作!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能执行出库操作!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能执行出库操作!"); return createResult(false, "该装备已报废,不能执行出库操作!");
case LOAD: case LOAD:
return createResult(false, "该装备已配装,不能执行出库操作!"); return createResult(false, "该装备已配装,不能执行出库操作!");
// case ONDUTY:
// return createResult(false, "该装备正在执勤中,不能执行出库操作!");
default: default:
return createResult(true, ""); return createResult(true, "");
} }
...@@ -129,16 +107,10 @@ public class EquipStatusChecker { ...@@ -129,16 +107,10 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能借出!"); return createResult(false, "该装备正在维修中,不能借出!");
// case LOAN:
// return createResult(false, "该装备已借出,不能再次借出!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能借出!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能借用!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能借出!"); return createResult(false, "该装备已报废,不能借出!");
// case ONDUTY:
// return createResult(false, "该装备正在执勤中,不能借出!");
case LOSS: case LOSS:
return createResult(false, "该装备已损耗,不能借出!"); return createResult(false, "该装备已损耗,不能借出!");
default: default:
...@@ -156,16 +128,10 @@ public class EquipStatusChecker { ...@@ -156,16 +128,10 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能转移货位!"); return createResult(false, "该装备正在维修中,不能转移货位!");
// case LOAN:
// return createResult(false, "该装备已借出,不能转移货位!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能转移货位!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能转移货位!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能转移货位!"); return createResult(false, "该装备已报废,不能转移货位!");
// case ONDUTY:
// return createResult(false, "该装备正在执勤中,不能转移货位!");
case LOSS: case LOSS:
return createResult(false, "该装备已损耗,不能转移货位!"); return createResult(false, "该装备已损耗,不能转移货位!");
default: default:
...@@ -183,16 +149,10 @@ public class EquipStatusChecker { ...@@ -183,16 +149,10 @@ public class EquipStatusChecker {
switch (status) { switch (status) {
case REPAIR: case REPAIR:
return createResult(false, "该装备正在维修中,不能执勤!"); return createResult(false, "该装备正在维修中,不能执勤!");
// case LOAN:
// return createResult(false, "该装备已借出,不能执勤!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能执勤!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能执勤!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能执勤!"); return createResult(false, "该装备已报废,不能执勤!");
// case ONDUTY:
// return createResult(false, "该装备正在执勤中,不能重复执勤!");
case LOSS: case LOSS:
return createResult(false, "该装备已损耗,不能执勤!"); return createResult(false, "该装备已损耗,不能执勤!");
default: default:
...@@ -208,12 +168,7 @@ public class EquipStatusChecker { ...@@ -208,12 +168,7 @@ public class EquipStatusChecker {
*/ */
public static Result isStockable(EquipStatusEnum status) { public static Result isStockable(EquipStatusEnum status) {
switch (status) { switch (status) {
// case LOAN:
// return createResult(false, "该装备已借出,不能变为在位状态!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能变为在位状态!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能变为在位状态!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能变为在位状态!"); return createResult(false, "该装备已报废,不能变为在位状态!");
case LOSS: case LOSS:
...@@ -231,12 +186,7 @@ public class EquipStatusChecker { ...@@ -231,12 +186,7 @@ public class EquipStatusChecker {
*/ */
public static Result isRetirementable(EquipStatusEnum status) { public static Result isRetirementable(EquipStatusEnum status) {
switch (status) { switch (status) {
// case LOAN:
// return createResult(false, "该装备已借出,不能退役!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能退役!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能退役!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能退役!"); return createResult(false, "该装备已报废,不能退役!");
case LOSS: case LOSS:
...@@ -254,18 +204,10 @@ public class EquipStatusChecker { ...@@ -254,18 +204,10 @@ public class EquipStatusChecker {
*/ */
public static Result isScrapable(EquipStatusEnum status) { public static Result isScrapable(EquipStatusEnum status) {
switch (status) { switch (status) {
// case LOAN:
// return createResult(false, "该装备已借出,不能报废!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能报废!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能报废!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能再次报废!"); return createResult(false, "该装备已报废,不能再次报废!");
// case ONDUTY:
// return createResult(false, "该装备正在执勤中,请先退役后再进行报废操作!");
// case REPERTORY:
// return createResult(false, "该装备目前是库存状态,请先退役后再进行报废操作!");
case LOSS: case LOSS:
return createResult(false, "该装备目前是损耗状态,不能进行报废操作!"); return createResult(false, "该装备目前是损耗状态,不能进行报废操作!");
case LOAD: case LOAD:
...@@ -283,12 +225,7 @@ public class EquipStatusChecker { ...@@ -283,12 +225,7 @@ public class EquipStatusChecker {
*/ */
public static Result isLoadable(EquipStatusEnum status) { public static Result isLoadable(EquipStatusEnum status) {
switch (status) { switch (status) {
// case LOAN:
// return createResult(false, "该装备已借出,不能被装载!");
// case BORROW:
// return createResult(false, "该装备是借用装备,不能被装载!");
// case RETURN:
// return createResult(false, "该借用装备已归还借用方,不能被装载!");
case SCRAP: case SCRAP:
return createResult(false, "该装备已报废,不能被装载!"); return createResult(false, "该装备已报废,不能被装载!");
case REPAIR: case REPAIR:
...@@ -310,10 +247,7 @@ public class EquipStatusChecker { ...@@ -310,10 +247,7 @@ public class EquipStatusChecker {
*/ */
public static Result isReturnable(EquipStatusEnum status) { public static Result isReturnable(EquipStatusEnum status) {
switch (status) { switch (status) {
// case BORROW:
// return createResult(false, "该装备是借用装备,请让借出方执行归还操作!");
// case LOAN:
// return createResult(true, "");
default: default:
return createResult(false, "该装备未被借出,不能进行归还操作!"); return createResult(false, "该装备未被借出,不能进行归还操作!");
} }
...@@ -328,4 +262,6 @@ public class EquipStatusChecker { ...@@ -328,4 +262,6 @@ public class EquipStatusChecker {
return result; return result;
} }
private EquipStatusChecker() {
}
} }
...@@ -42,15 +42,5 @@ public enum EquipStatusEnum { ...@@ -42,15 +42,5 @@ public enum EquipStatusEnum {
return equipStatusEnum; return equipStatusEnum;
} }
// public static EquipStatusEnum getEnum(String describe) {
// EquipStatusEnum equipStatusEnum = null;
// for (EquipStatusEnum type : EquipStatusEnum.values()) {
// if (type.getDescribe().equals(describe)) {
// equipStatusEnum = type;
// break;
// }
// }
//
// return equipStatusEnum;
// }
} }
...@@ -7,12 +7,7 @@ package com.yeejoin.equipmanage.common.enums; ...@@ -7,12 +7,7 @@ package com.yeejoin.equipmanage.common.enums;
*/ */
public class TemperatureAlarm { public class TemperatureAlarm {
//规则温度
private Double ruleTemperature;
//当前温度
private Double currTemperature;
//测温单位
private String thermometryUnit;
public enum AlarmLevel { public enum AlarmLevel {
alarmLevel_0("0", "预警"), alarmLevel_0("0", "预警"),
......
...@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; ...@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
...@@ -23,12 +24,18 @@ public class GlobalExceptionHandler { ...@@ -23,12 +24,18 @@ public class GlobalExceptionHandler {
private Logger log = LoggerFactory.getLogger(this.getClass()); private Logger log = LoggerFactory.getLogger(this.getClass());
public GlobalExceptionHandler() { public GlobalExceptionHandler() {
log.info("开始");
} }
@ExceptionHandler({Exception.class}) @ExceptionHandler({Exception.class})
public ResponseModel<Object> MethodArgumentNotValidHandler(Exception exception) throws Exception { public ResponseModel<Object> MethodArgumentNotValidHandler(Exception exception) throws Exception {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) HttpServletRequest request =null;
.getRequest(); RequestAttributes re=RequestContextHolder.getRequestAttributes();
if(re!=null){
request = ((ServletRequestAttributes) re).getRequest();
}
ResponseModel<Object> response = new ResponseModel<>(); ResponseModel<Object> response = new ResponseModel<>();
//解析平台返回错误信息,统一返回403,app 端统一跳转到登录页面 //解析平台返回错误信息,统一返回403,app 端统一跳转到登录页面
...@@ -41,7 +48,7 @@ public class GlobalExceptionHandler { ...@@ -41,7 +48,7 @@ public class GlobalExceptionHandler {
response.setDevMessage("FAILED"); response.setDevMessage("FAILED");
response.setMessage(exception.getMessage()); response.setMessage(exception.getMessage());
response.setTraceId(RequestContext.getTraceId()); response.setTraceId(RequestContext.getTraceId());
response.setPath(request.getServletPath()); response.setPath(request!=null?request.getServletPath():null);
exception.printStackTrace(); exception.printStackTrace();
return response; return response;
} }
......
...@@ -30,7 +30,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { ...@@ -30,7 +30,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {
static LinkedList<String> filterUrl = new LinkedList<>(); static LinkedList<String> filterUrl = new LinkedList<>();
{ static{
filterUrl.add(SWAGGER_URL); filterUrl.add(SWAGGER_URL);
filterUrl.add(SWAGGER_RESOURCES); filterUrl.add(SWAGGER_RESOURCES);
filterUrl.add(CSRF); filterUrl.add(CSRF);
...@@ -45,12 +45,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { ...@@ -45,12 +45,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {
*/ */
@Override @Override
public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) { public boolean supports(MethodParameter methodParameter, Class<? extends HttpMessageConverter<?>> aClass) {
// 获取当前处理请求的controller的方法
String methodName = methodParameter.getMethod().getName();
// 不拦截/不需要处理返回值 的方法 // 不拦截/不需要处理返回值 的方法
String method = "loginCheck";
// 拦截 false
// return !method.equals(methodName);
return true; return true;
} }
...@@ -73,13 +68,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> { ...@@ -73,13 +68,7 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {
} }
} }
// 平台返回参数
// ResponseModel<T> response = new ResponseModel<>();
// HttpServletRequest request = ((ServletRequestAttributes)
// RequestContextHolder.getRequestAttributes()).getRequest();
// response.setResult(t);
// response.setDevMessage("SUCCESS");
// response.setStatus(HttpStatus.OK.value());
ResponseModel<Object> res = ResponseHelper.buildResponse(body); ResponseModel<Object> res = ResponseHelper.buildResponse(body);
......
...@@ -68,9 +68,7 @@ public class Common3dResponse { ...@@ -68,9 +68,7 @@ public class Common3dResponse {
this.message = message; this.message = message;
} }
// public Boolean isSuccess() {
// return "SUCCESS".equals(getCode());
// }
public Integer getId() { public Integer getId() {
return id; return id;
......
...@@ -12,11 +12,16 @@ import com.yeejoin.equipmanage.common.constant.Constant; ...@@ -12,11 +12,16 @@ import com.yeejoin.equipmanage.common.constant.Constant;
* @Version: 1.0 * @Version: 1.0
*/ */
public class Common3dResponseUtil { public class Common3dResponseUtil {
private static final String CODE="47100";
private Common3dResponseUtil() {
}
public static Common3dResponse success() public static Common3dResponse success()
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(1); response.setId(1);
response.setCode("47100"); response.setCode(CODE);
response.setMessage(Constant.RESULT_SUCCESS); response.setMessage(Constant.RESULT_SUCCESS);
return response; return response;
} }
...@@ -25,7 +30,7 @@ public class Common3dResponseUtil { ...@@ -25,7 +30,7 @@ public class Common3dResponseUtil {
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(1); response.setId(1);
response.setCode("47100"); response.setCode(CODE);
response.setMessage(Constant.RESULT_SUCCESS); response.setMessage(Constant.RESULT_SUCCESS);
response.setBody(obj); response.setBody(obj);
return response; return response;
...@@ -35,7 +40,7 @@ public class Common3dResponseUtil { ...@@ -35,7 +40,7 @@ public class Common3dResponseUtil {
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(1); response.setId(1);
response.setCode("47100"); response.setCode(CODE);
response.setBody(obj); response.setBody(obj);
response.setMessage(message); response.setMessage(message);
return response; return response;
...@@ -45,7 +50,7 @@ public class Common3dResponseUtil { ...@@ -45,7 +50,7 @@ public class Common3dResponseUtil {
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(0); response.setId(0);
response.setCode("47100"); response.setCode(CODE);
response.setMessage(Constant.RESULT_FAILURE); response.setMessage(Constant.RESULT_FAILURE);
return response; return response;
} }
...@@ -54,7 +59,7 @@ public class Common3dResponseUtil { ...@@ -54,7 +59,7 @@ public class Common3dResponseUtil {
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(0); response.setId(0);
response.setCode("47100"); response.setCode(CODE);
response.setMessage(message); response.setMessage(message);
return response; return response;
} }
...@@ -63,7 +68,7 @@ public class Common3dResponseUtil { ...@@ -63,7 +68,7 @@ public class Common3dResponseUtil {
{ {
Common3dResponse response = new Common3dResponse(); Common3dResponse response = new Common3dResponse();
response.setId(0); response.setId(0);
response.setCode("47100"); response.setCode(CODE);
response.setBody(obj); response.setBody(obj);
response.setMessage(message); response.setMessage(message);
return response; return response;
......
...@@ -63,4 +63,7 @@ public class ArrayUtil { ...@@ -63,4 +63,7 @@ public class ArrayUtil {
public static <T, R> Set<R> collectSet(final List<T> arrayList, Function<T, R> function) { public static <T, R> Set<R> collectSet(final List<T> arrayList, Function<T, R> function) {
return arrayList.stream().map(function).collect(Collectors.toSet()); return arrayList.stream().map(function).collect(Collectors.toSet());
} }
private ArrayUtil() {
}
} }
...@@ -223,8 +223,7 @@ public class BillCodeManagerUtil { ...@@ -223,8 +223,7 @@ public class BillCodeManagerUtil {
if (null == prefix || null == code) { if (null == prefix || null == code) {
throw new IllegalArgumentException("未输入正确参数,编码前缀(prefix),编码(code)!"); throw new IllegalArgumentException("未输入正确参数,编码前缀(prefix),编码(code)!");
} }
System.out.println("生成code :" + code);
String tmp_prefix = prefix.toUpperCase(); String tmp_prefix = prefix.toUpperCase();
switch (tmp_prefix) { switch (tmp_prefix) {
case INBOUND: case INBOUND:
...@@ -252,7 +251,6 @@ public class BillCodeManagerUtil { ...@@ -252,7 +251,6 @@ public class BillCodeManagerUtil {
case LOSS: case LOSS:
return checkWastageCode(code); return checkWastageCode(code);
default: default:
System.out.println("由于未在本类中定义前缀,因此默认使用 DF !!!!!!!!!!!!!!!!!!!!");
return checkOtherCode(code); return checkOtherCode(code);
} }
} }
...@@ -305,5 +303,7 @@ public class BillCodeManagerUtil { ...@@ -305,5 +303,7 @@ public class BillCodeManagerUtil {
private static String getRecoedCode(String key) { private static String getRecoedCode(String key) {
return codes.get(key); return codes.get(key);
} }
private BillCodeManagerUtil() {
}
} }
...@@ -20,8 +20,6 @@ import org.springframework.util.ObjectUtils; ...@@ -20,8 +20,6 @@ import org.springframework.util.ObjectUtils;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.*; import java.util.*;
...@@ -32,6 +30,8 @@ import java.util.*; ...@@ -32,6 +30,8 @@ import java.util.*;
*/ */
public class ChartsUtils { public class ChartsUtils {
private ChartsUtils() {
}
public static String pieChart(List<Map<String, Object>> data, String title) { public static String pieChart(List<Map<String, Object>> data, String title) {
//如 果不使用Font,中文将显示不出来 //如 果不使用Font,中文将显示不出来
...@@ -40,9 +40,7 @@ public class ChartsUtils { ...@@ -40,9 +40,7 @@ public class ChartsUtils {
// 创建数据:饼状图就是名称和值(比例) // 创建数据:饼状图就是名称和值(比例)
Map<String, Double> map = new HashMap<String, Double>(); Map<String, Double> map = new HashMap<String, Double>();
// for (int i = 0; i < name.size(); i++) {
// map.put(name.get(i), value.get(i));
// }
for (Map<String, Object> item : data) { for (Map<String, Object> item : data) {
map.put(String.valueOf(item.get("type")),Double.parseDouble(ObjectUtils.isEmpty(item.get("value"))?"0":String.valueOf(item.get("value")))); map.put(String.valueOf(item.get("type")),Double.parseDouble(ObjectUtils.isEmpty(item.get("value"))?"0":String.valueOf(item.get("value"))));
...@@ -50,39 +48,19 @@ public class ChartsUtils { ...@@ -50,39 +48,19 @@ public class ChartsUtils {
} }
// 创建JFreeChart // 创建JFreeChart
JFreeChart chart = createPieChart(title, map, font); JFreeChart chart = createPieChart(title, map, font);
BufferedImage image = chart.createBufferedImage(600, 600); BufferedImage image = chart!=null?chart.createBufferedImage(600, 600):null;
byte[] bytes = null; byte[] bytes = null;
try { try {
bytes = ChartUtilities.encodeAsPNG(image); bytes = ChartUtilities.encodeAsPNG(image);
} catch (IOException e1) { } catch (IOException e1) {
System.out.println("生成饼图失败"); e1.printStackTrace();
} }
return Base64.getEncoder().encodeToString(bytes); return Base64.getEncoder().encodeToString(bytes);
} }
private static byte[] fileToByte(File file) {
byte[] fileBytes = null;
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
fileBytes = new byte[(int) file.length()];
fis.read(fileBytes);
fis.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return fileBytes;
}
/** /**
...@@ -97,8 +75,8 @@ public class ChartsUtils { ...@@ -97,8 +75,8 @@ public class ChartsUtils {
try { try {
Set<Map.Entry<String, Double>> set = data.entrySet(); Set<Map.Entry<String, Double>> set = data.entrySet();
DefaultPieDataset pds = new DefaultPieDataset(); DefaultPieDataset pds = new DefaultPieDataset();
Iterator iterator = set.iterator(); Iterator<Map.Entry<String, Double>> iterator = set.iterator();
Map.Entry entry; Map.Entry<String, Double> entry;
while (iterator.hasNext()) { while (iterator.hasNext()) {
entry = (Map.Entry) iterator.next(); entry = (Map.Entry) iterator.next();
pds.setValue(entry.getKey().toString(), Double.parseDouble(entry.getValue().toString())); pds.setValue(entry.getKey().toString(), Double.parseDouble(entry.getValue().toString()));
...@@ -123,11 +101,9 @@ public class ChartsUtils { ...@@ -123,11 +101,9 @@ public class ChartsUtils {
plot.setBackgroundAlpha(0.0f); plot.setBackgroundAlpha(0.0f);
//设置标签生成器(默认{0}) //设置标签生成器(默认{0})
//{0}:key {1}:value {2}:百分比 {3}:sum //{0}:key {1}:value {2}:百分比 {3}:sum
plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}({1})/{2}")); // 一般在{1}后面加单位,如:{0}({1}次)/{2} plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}({1})/{2}"));
//将内存中的图片写到本地硬盘 //将内存中的图片写到本地硬盘
// ChartUtilities.saveChartAsJPEG(new File("H:/a.png"), chart, 600, 300);
// 标注位于上侧 // 标注位于上侧
// chart.getLegend().setPosition(RectangleEdge.TOP);
// 设置标注无边框 // 设置标注无边框
chart.getLegend().setFrame(new BlockBorder(Color.WHITE)); chart.getLegend().setFrame(new BlockBorder(Color.WHITE));
return chart; return chart;
...@@ -156,7 +132,7 @@ public class ChartsUtils { ...@@ -156,7 +132,7 @@ public class ChartsUtils {
try { try {
bytes = ChartUtilities.encodeAsPNG(image); bytes = ChartUtilities.encodeAsPNG(image);
} catch (IOException e1) { } catch (IOException e1) {
System.out.println("生成折线图失败"); e1.printStackTrace();
} }
return Base64.getEncoder().encodeToString(bytes); return Base64.getEncoder().encodeToString(bytes);
......
...@@ -18,4 +18,6 @@ public class CodeGenerate { ...@@ -18,4 +18,6 @@ public class CodeGenerate {
return id; return id;
} }
private CodeGenerate() {
}
} }
...@@ -5,8 +5,10 @@ import org.springframework.util.CollectionUtils; ...@@ -5,8 +5,10 @@ import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
public class CommonPageParamUtil { public class CommonPageParamUtil {
private CommonPageParamUtil() {
}
public static CommonPageInfoParam fillCommonPageInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable) { public static CommonPageInfoParam fillCommonPageInfoParam(List<CommonRequest> queryRequests, CommonPageable commonPageable) {
CommonPageInfoParam param = new CommonPageInfoParam(); CommonPageInfoParam param = new CommonPageInfoParam();
for(int i=0;i<queryRequests.size();i++){ for(int i=0;i<queryRequests.size();i++){
String name = queryRequests.get(i).getName(); String name = queryRequests.get(i).getName();
......
...@@ -6,53 +6,57 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -6,53 +6,57 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
public class CommonResponseUtil public class CommonResponseUtil
{ {
public static ResponseModel success() private CommonResponseUtil() {
}
public static ResponseModel<Object> success()
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setDevMessage(Constant.RESULT_SUCCESS); res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value()); res.setStatus(HttpStatus.OK.value());
return res; return res;
} }
public static ResponseModel success(Object obj) public static ResponseModel<Object> success(Object obj)
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setResult(obj); res.setResult(obj);
res.setDevMessage(Constant.RESULT_SUCCESS); res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value()); res.setStatus(HttpStatus.OK.value());
return res; return res;
} }
public static ResponseModel success(Object obj, String message) public static ResponseModel<Object> success(Object obj, String message)
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setResult(obj); res.setResult(obj);
res.setDevMessage(message); res.setDevMessage(message);
res.setStatus(HttpStatus.OK.value()); res.setStatus(HttpStatus.OK.value());
return res; return res;
} }
public static ResponseModel failure() public static ResponseModel<Object> failure()
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setDevMessage(Constant.RESULT_FAILURE); res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res; return res;
} }
public static ResponseModel failure(String message) public static ResponseModel<Object> failure(String message)
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setDevMessage(Constant.RESULT_FAILURE); res.setDevMessage(Constant.RESULT_FAILURE);
res.setMessage(message); res.setMessage(message);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res; return res;
} }
public static ResponseModel failure(Object obj, String message) public static ResponseModel<Object> failure(Object obj, String message)
{ {
ResponseModel res = new ResponseModel(); ResponseModel<Object> res = new ResponseModel<>();
res.setResult(obj); res.setResult(obj);
res.setMessage(message);
res.setDevMessage(Constant.RESULT_FAILURE); res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res; return res;
......
...@@ -17,6 +17,9 @@ import java.text.ParseException; ...@@ -17,6 +17,9 @@ import java.text.ParseException;
public class ConverterUtil { public class ConverterUtil {
private ConverterUtil() {
}
/** /**
* Gets a String from a Object in a null-safe manner. * Gets a String from a Object in a null-safe manner.
* <p> * <p>
...@@ -113,6 +116,7 @@ public class ConverterUtil { ...@@ -113,6 +116,7 @@ public class ConverterUtil {
* @return the value of the Object as a Boolean, <code>null</code> if null object input * @return the value of the Object as a Boolean, <code>null</code> if null object input
*/ */
public static Boolean getAsBoolean(final Object obj) { public static Boolean getAsBoolean(final Object obj) {
Boolean fla=null;
if (obj != null) { if (obj != null) {
if (obj instanceof Boolean) { if (obj instanceof Boolean) {
return (Boolean) obj; return (Boolean) obj;
...@@ -125,7 +129,7 @@ public class ConverterUtil { ...@@ -125,7 +129,7 @@ public class ConverterUtil {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }
return null; return fla;
} }
/** /**
......
package com.yeejoin.equipmanage.common.utils; package com.yeejoin.equipmanage.common.utils;
public class CustomUtil { public class CustomUtil {
private CustomUtil() {
}
/** /**
* 去掉末尾的0 * 去掉末尾的0
......
...@@ -10,6 +10,8 @@ import org.jsoup.select.Elements; ...@@ -10,6 +10,8 @@ import org.jsoup.select.Elements;
import java.util.*; import java.util.*;
public class DocUtil { public class DocUtil {
private DocUtil() {
}
/** /**
* doc对应的html转换 * doc对应的html转换
...@@ -17,8 +19,7 @@ public class DocUtil { ...@@ -17,8 +19,7 @@ public class DocUtil {
* @return * @return
*/ */
public static Map<String, Object> processDoc(String html){ public static Map<String, Object> processDoc(String html){
String res = html.replaceAll("black", "white"); String res = html.replace("background-color:#ffffff","");
res = html.replaceAll("background-color:#ffffff","");
Document doc = Jsoup.parse(res); Document doc = Jsoup.parse(res);
updateStyle(doc); updateStyle(doc);
...@@ -36,12 +37,12 @@ public class DocUtil { ...@@ -36,12 +37,12 @@ public class DocUtil {
if(level>5){ if(level>5){
level = -1; level = -1;
} }
id = attr.getValue(); attr.getValue();
} }
} }
if(level>-1){ if(level>-1){
Elements children = element.children(); Elements children = element.children();
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
for (Element element2 : children) { for (Element element2 : children) {
sb.append(element2.text()); sb.append(element2.text());
} }
...@@ -77,8 +78,7 @@ public class DocUtil { ...@@ -77,8 +78,7 @@ public class DocUtil {
} }
lastlevel = level; lastlevel = level;
} }
// System.out.println(JSON.toJSONString(root.getChildren()));
// System.out.println(doc.toString());
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("nodes", root.getChildren()); map.put("nodes", root.getChildren());
map.put("html", doc.toString()); map.put("html", doc.toString());
...@@ -92,8 +92,7 @@ public class DocUtil { ...@@ -92,8 +92,7 @@ public class DocUtil {
* @return * @return
*/ */
public static Map<String, Object> processDocx(String html){ public static Map<String, Object> processDocx(String html){
String res = html.replaceAll("black", "white"); String res = html.replace("background-color:#ffffff","");
res = html.replaceAll("background-color:#ffffff","");
Document doc = Jsoup.parse(res); Document doc = Jsoup.parse(res);
updateStyle(doc); updateStyle(doc);
Elements head = doc.getElementsByTag("head"); Elements head = doc.getElementsByTag("head");
...@@ -113,6 +112,7 @@ public class DocUtil { ...@@ -113,6 +112,7 @@ public class DocUtil {
try { try {
level = Integer.parseInt(s.substring(1)); level = Integer.parseInt(s.substring(1));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
} }
} }
} }
...@@ -120,7 +120,7 @@ public class DocUtil { ...@@ -120,7 +120,7 @@ public class DocUtil {
} }
if(level>-1){ if(level>-1){
Elements children = element.children(); Elements children = element.children();
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
for (Element element2 : children) { for (Element element2 : children) {
sb.append(element2.text()); sb.append(element2.text());
} }
...@@ -156,8 +156,7 @@ public class DocUtil { ...@@ -156,8 +156,7 @@ public class DocUtil {
} }
lastlevel = level; lastlevel = level;
} }
// System.out.println(JSON.toJSONString(root.getChildren()));
// System.out.println(doc.toString());
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("nodes", root.getChildren()); map.put("nodes", root.getChildren());
map.put("html", doc.toString()); map.put("html", doc.toString());
...@@ -166,18 +165,7 @@ public class DocUtil { ...@@ -166,18 +165,7 @@ public class DocUtil {
//修改样式为白色 //修改样式为白色
private static void updateStyle(Document doc) { private static void updateStyle(Document doc) {
// Elements styleEle = doc.getElementsByTag("style");
// styleEle.append("th{border:solid #FFFFFF}" +
// "td{border:solid #ffffff;border-top:solid #FFFFFF !important;border-bottom:solid #ffffff !important"
// + ",border-right:solid #ffffff !important;border-left:solid #ffffff !important}" +
// "table{border:solid ;background-color: transparent !important}"+
// "a{color:#FFFFFF}");
// Elements bodyEle = doc.getElementsByTag("body");
// bodyEle.attr("style", "color:#FFFFFF");
// Elements spans = doc.getElementsByTag("span");
// spans.attr("style", "color:#FFFFFF");
// Elements as = doc.getElementsByTag("a");
// as.attr("style", "color:#FFFFFF");
Elements table = doc.getElementsByTag("table"); Elements table = doc.getElementsByTag("table");
table.attr("style", "width: 100%"); table.attr("style", "width: 100%");
......
package com.yeejoin.equipmanage.common.utils; package com.yeejoin.equipmanage.common.utils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
...@@ -16,7 +17,10 @@ import java.util.function.Predicate; ...@@ -16,7 +17,10 @@ import java.util.function.Predicate;
*/ */
@Slf4j @Slf4j
public class EnumsUtils { public class EnumsUtils {
private static Map<Class,Object> map = new ConcurrentHashMap<>(); private EnumsUtils() {
}
private static Map<Class<T>,Object> map = new ConcurrentHashMap<>();
/** /**
* 根据条件获取枚举对象 * 根据条件获取枚举对象
...@@ -26,9 +30,10 @@ public class EnumsUtils { ...@@ -26,9 +30,10 @@ public class EnumsUtils {
* @return * @return
*/ */
public static <T> Optional<T> getEnumObject(Class<T> className, Predicate<T> predicate) { public static <T> Optional<T> getEnumObject(Class<T> className, Predicate<T> predicate) {
Optional<T> da=new Optional<>();
if(!className.isEnum()){ if(!className.isEnum()){
log.info("Class 不是枚举类"); log.info("Class 不是枚举类");
return null; return da;
} }
Object obj = map.get(className); Object obj = map.get(className);
T[] ts = null; T[] ts = null;
......
...@@ -21,6 +21,8 @@ import java.util.stream.Collectors; ...@@ -21,6 +21,8 @@ import java.util.stream.Collectors;
* @date 2021/1/8 09:32 * @date 2021/1/8 09:32
*/ */
public class EquipmentStateUtil { public class EquipmentStateUtil {
private EquipmentStateUtil() {
}
private final static Logger log = LoggerFactory.getLogger(EquipmentStateUtil.class); private final static Logger log = LoggerFactory.getLogger(EquipmentStateUtil.class);
...@@ -58,7 +60,7 @@ public class EquipmentStateUtil { ...@@ -58,7 +60,7 @@ public class EquipmentStateUtil {
} }
} }
String status = getStatus(stateVo); String status = getStatus(stateVo);
log.info("此装备的状态为: " + status + "(屏蔽-5, 火灾告警-4, 故障-3, 正常-2, 挂起-1)"); log.info("此装备的状态为(屏蔽-5, 火灾告警-4, 故障-3, 正常-2, 挂起-1): " );
return status; return status;
} }
...@@ -257,7 +259,7 @@ public class EquipmentStateUtil { ...@@ -257,7 +259,7 @@ public class EquipmentStateUtil {
break; break;
} }
} }
log.info("此装备"+index.getQrCode()+"的状态为: " + status + "(屏蔽-5, 火灾告警-4, 故障-3, 正常-2, 挂起-1)"); log.info("此装备状态为(屏蔽-5, 火灾告警-4, 故障-3, 正常-2, 挂起-1):" );
return status; return status;
} }
......
...@@ -26,7 +26,10 @@ import java.util.Map; ...@@ -26,7 +26,10 @@ import java.util.Map;
*/ */
public class ExcelUtil public class ExcelUtil
{ {
private ExcelUtil() {
}
private static final String TITLE="title";
/** /**
* *
* <pre> * <pre>
...@@ -65,7 +68,6 @@ public class ExcelUtil ...@@ -65,7 +68,6 @@ public class ExcelUtil
for (short j = 0; j < list.size(); j = (short) (j + 1)) for (short j = 0; j < list.size(); j = (short) (j + 1))
{ {
HSSFCell cell = row.createCell(j); HSSFCell cell = row.createCell(j);
// cell.setEncoding((short) 1);
if (i == 0) if (i == 0)
{ {
cell.setCellStyle(style); cell.setCellStyle(style);
...@@ -157,17 +159,13 @@ public class ExcelUtil ...@@ -157,17 +159,13 @@ public class ExcelUtil
{ {
String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1"); String name = new String(fileName.getBytes("UTF-8"), "ISO8859_1");
OutputStream output = response.getOutputStream(); OutputStream output = response.getOutputStream();
// response.reset();
response.setHeader("Content-disposition", response.setHeader("Content-disposition",
"attachment; filename=" + name); "attachment; filename=" + name);
response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setContentType("application/vnd.ms-excel;charset=utf-8");
workbook.write(output); workbook.write(output);
output.flush(); output.flush();
output.close(); output.close();
// // 输出Excel文件--保存到本地
// OutputStream output = new FileOutputStream(new File("F:/"+fileName));
// workbook.write(output); // 输出
// output.close();
} }
catch (IOException e) catch (IOException e)
{ {
...@@ -241,11 +239,9 @@ public class ExcelUtil ...@@ -241,11 +239,9 @@ public class ExcelUtil
HSSFCellStyle style = workbook.createCellStyle(); HSSFCellStyle style = workbook.createCellStyle();
HSSFFont font = workbook.createFont(); HSSFFont font = workbook.createFont();
// font.setColor((short) 16);
font.setBold(true); font.setBold(true);
font.setFontHeightInPoints((short) 10); font.setFontHeightInPoints((short) 10);
style.setFont(font); style.setFont(font);
// style.setFillForegroundColor((short) 9);
style.setAlignment(HorizontalAlignment.CENTER); style.setAlignment(HorizontalAlignment.CENTER);
setBorderStyle(style); setBorderStyle(style);
...@@ -262,8 +258,6 @@ public class ExcelUtil ...@@ -262,8 +258,6 @@ public class ExcelUtil
font3.setFontHeightInPoints((short) 12); font3.setFontHeightInPoints((short) 12);
style3.setFont(font3); style3.setFont(font3);
style3.setWrapText(true); style3.setWrapText(true);
// style3.setFillForegroundColor((short) 13);
// style3.setAlignment(HorizontalAlignment.CENTER);
style3.setVerticalAlignment(VerticalAlignment.CENTER); style3.setVerticalAlignment(VerticalAlignment.CENTER);
HSSFRow statisticRow = sheet.createRow(0); HSSFRow statisticRow = sheet.createRow(0);
...@@ -331,10 +325,7 @@ public class ExcelUtil ...@@ -331,10 +325,7 @@ public class ExcelUtil
style.setWrapText(true); style.setWrapText(true);
style.setAlignment(HorizontalAlignment.CENTER);// 左右居中 style.setAlignment(HorizontalAlignment.CENTER);// 左右居中
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
// style.setLeftBorderColor(HSSFColor.BLACK.index);// 左边框的颜色
// style.setRightBorderColor(HSSFColor.BLACK.index);// 右边框的颜色
// style.setBottomBorderColor(HSSFColor.BLACK.index); // 设置单元格的边框颜色
// style.setFillForegroundColor(HSSFColor.WHITE.index);
style.setBorderBottom(BorderStyle.THIN); style.setBorderBottom(BorderStyle.THIN);
style.setBorderLeft(BorderStyle.THIN); style.setBorderLeft(BorderStyle.THIN);
style.setBorderRight(BorderStyle.THIN); style.setBorderRight(BorderStyle.THIN);
...@@ -536,7 +527,7 @@ public class ExcelUtil ...@@ -536,7 +527,7 @@ public class ExcelUtil
CellStyle style3 = getTitleStyle(workbook); CellStyle style3 = getTitleStyle(workbook);
/********************标题行************************/ /********************标题行************************/
setTitleValue(headers.get("title"), style3, sheet); setTitleValue(headers.get(TITLE), style3, sheet);
/**********************一级表头**********************/ /**********************一级表头**********************/
List<CellRangeAddress> rangelist = new ArrayList<CellRangeAddress>();// 合并单元格集合 List<CellRangeAddress> rangelist = new ArrayList<CellRangeAddress>();// 合并单元格集合
...@@ -559,8 +550,7 @@ public class ExcelUtil ...@@ -559,8 +550,7 @@ public class ExcelUtil
//需要为合并的每个单元格都赋值,否则第二个合并后的单元格值无法显示 //需要为合并的每个单元格都赋值,否则第二个合并后的单元格值无法显示
firstHeadCell.setCellValue(firstHeadValue); firstHeadCell.setCellValue(firstHeadValue);
//设置单元格宽度自适应 //设置单元格宽度自适应
// sheet.setColumnWidth(j, firstHeadValue.getBytes().length*256);
} }
start=start+Integer.valueOf(firstHeadArray[1]);//计算下一个标题的单元格起始位置 start=start+Integer.valueOf(firstHeadArray[1]);//计算下一个标题的单元格起始位置
...@@ -611,7 +601,7 @@ public class ExcelUtil ...@@ -611,7 +601,7 @@ public class ExcelUtil
setMidContentValue(contents, style, sheet, 4); setMidContentValue(contents, style, sheet, 4);
/**********************填充表格内容最后一行**********************/ /**********************填充表格内容最后一行**********************/
int titleSize =Integer.valueOf(headers.get("title").get(0).split(":")[1]); int titleSize =Integer.valueOf(headers.get(TITLE).get(0).split(":")[1]);
Row endContentRow = sheet.createRow(4+contents.size()); Row endContentRow = sheet.createRow(4+contents.size());
endContentRow.setHeightInPoints(30); endContentRow.setHeightInPoints(30);
sheet.addMergedRegion(new CellRangeAddress sheet.addMergedRegion(new CellRangeAddress
...@@ -654,7 +644,7 @@ public class ExcelUtil ...@@ -654,7 +644,7 @@ public class ExcelUtil
CellStyle style3 = getTitleStyle(workbook); CellStyle style3 = getTitleStyle(workbook);
/********************填充标题行************************/ /********************填充标题行************************/
setTitleValue(headers.get("title"), style3, sheet); setTitleValue(headers.get(TITLE), style3, sheet);
/**********************填充表头**********************/ /**********************填充表头**********************/
Row headRow = sheet.createRow(1); Row headRow = sheet.createRow(1);
...@@ -670,7 +660,7 @@ public class ExcelUtil ...@@ -670,7 +660,7 @@ public class ExcelUtil
setMidContentValue(contents, style, sheet, 3); setMidContentValue(contents, style, sheet, 3);
/**********************填充表格内容最后一行**********************/ /**********************填充表格内容最后一行**********************/
int titleSize =Integer.valueOf(headers.get("title").get(0).split(":")[1]); int titleSize =Integer.valueOf(headers.get(TITLE).get(0).split(":")[1]);
Row endContentRow = sheet.createRow(3+contents.size()); Row endContentRow = sheet.createRow(3+contents.size());
endContentRow.setHeightInPoints(30); endContentRow.setHeightInPoints(30);
sheet.addMergedRegion(new CellRangeAddress sheet.addMergedRegion(new CellRangeAddress
...@@ -727,11 +717,9 @@ public class ExcelUtil ...@@ -727,11 +717,9 @@ public class ExcelUtil
{ {
CellStyle style = workbook.createCellStyle(); CellStyle style = workbook.createCellStyle();
Font font = workbook.createFont(); Font font = workbook.createFont();
// font.setColor((short) 16);
//font.setBold(true);
font.setFontHeightInPoints((short) 10); font.setFontHeightInPoints((short) 10);
style.setFont(font); style.setFont(font);
// style.setFillForegroundColor((short) 9);
style.setAlignment(HorizontalAlignment.CENTER); style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
setBorderStyle(style); setBorderStyle(style);
...@@ -807,8 +795,7 @@ public class ExcelUtil ...@@ -807,8 +795,7 @@ public class ExcelUtil
style.setAlignment(HorizontalAlignment.CENTER); style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER);
// style3.setFillForegroundColor((short) 13);
return style; return style;
} }
......
...@@ -26,6 +26,8 @@ import java.util.regex.Pattern; ...@@ -26,6 +26,8 @@ import java.util.regex.Pattern;
* @create: 2020-05-28 13:57 * @create: 2020-05-28 13:57
**/ **/
public class ExcelUtils { public class ExcelUtils {
private ExcelUtils() {
}
/** /**
* excel 导出 * excel 导出
...@@ -104,7 +106,7 @@ public class ExcelUtils { ...@@ -104,7 +106,7 @@ public class ExcelUtils {
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
workbook.write(response.getOutputStream()); workbook.write(response.getOutputStream());
} catch (IOException e) { } catch (IOException e) {
//throw new NormalException(e.getMessage()); e.printStackTrace();
} }
} }
...@@ -133,8 +135,9 @@ public class ExcelUtils { ...@@ -133,8 +135,9 @@ public class ExcelUtils {
* @return * @return
*/ */
public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) { public static <T> List<T> importExcel(String filePath, Integer titleRows, Integer headerRows, Class<T> pojoClass) {
List<T> da=null;
if (StringUtils.isBlank(filePath)) { if (StringUtils.isBlank(filePath)) {
return null; return da;
} }
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(titleRows); params.setTitleRows(titleRows);
...@@ -143,10 +146,9 @@ public class ExcelUtils { ...@@ -143,10 +146,9 @@ public class ExcelUtils {
try { try {
list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params); list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
//throw new NormalException("模板不能为空"); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
//throw new NormalException(e.getMessage());
} }
return list; return list;
} }
...@@ -162,8 +164,9 @@ public class ExcelUtils { ...@@ -162,8 +164,9 @@ public class ExcelUtils {
* @return * @return
*/ */
public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) { public static <T> List<T> importExcel(MultipartFile file, Integer titleRows, Integer headerRows, Class<T> pojoClass) {
List<T> da=null;
if (file == null) { if (file == null) {
return null; return da;
} }
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(titleRows); params.setTitleRows(titleRows);
...@@ -172,10 +175,9 @@ public class ExcelUtils { ...@@ -172,10 +175,9 @@ public class ExcelUtils {
try { try {
list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params); list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params);
} catch (NoSuchElementException e) { } catch (NoSuchElementException e) {
// throw new NormalException("excel文件不能为空"); e.printStackTrace();
} catch (Exception e) { } catch (Exception e) {
//throw new NormalException(e.getMessage()); e.printStackTrace();
System.out.println(e.getMessage());
} }
return list; return list;
} }
......
...@@ -12,6 +12,8 @@ import java.io.IOException; ...@@ -12,6 +12,8 @@ import java.io.IOException;
* @since 2018/12/27 17:56 * @since 2018/12/27 17:56
*/ */
public class ExtendedIOUtils { public class ExtendedIOUtils {
private ExtendedIOUtils() {
}
public static void flush(Flushable... resources) throws IOException { public static void flush(Flushable... resources) throws IOException {
Assert.noNullElements(resources, "resources invalid"); Assert.noNullElements(resources, "resources invalid");
......
package com.yeejoin.equipmanage.common.utils;
/**
* @description:
* @author: tw
* @createDate: 2023/3/15
*/
public class finalString {
public static final String URL="cs/v1/fireASF/dataSync";
public static final String ISNOTIOT="isNotIot";
public static final String URLST="cs/v1/fireAST/dataSync";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment