Merge branch 'master' of http://42.192.7.176:3000/suojin/jonhon-mes-svr into liweidong
commit
16dc1cd0d8
27 changed files with 1126 additions and 22 deletions
@ -0,0 +1,40 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.mapper; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.desk.energy.pojo.entity.EpTowerRecAlarm; |
||||
|
||||
/** |
||||
* 酸雾塔报警记录对照表 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
public interface EpTowerRecAlarmMapper extends BaseMapper<EpTowerRecAlarm> { |
||||
|
||||
} |
||||
@ -0,0 +1,4 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.desk.energy.mapper.EpTowerRecAlarmMapper"> |
||||
</mapper> |
||||
@ -0,0 +1,40 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.mapper; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.springblade.desk.energy.pojo.entity.RpParameterSet; |
||||
|
||||
/** |
||||
* 参数设置表 Mapper 接口 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
public interface RpParameterSetMapper extends BaseMapper<RpParameterSet> { |
||||
|
||||
} |
||||
@ -0,0 +1,4 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.springblade.desk.energy.mapper.RpParameterSetMapper"> |
||||
</mapper> |
||||
@ -0,0 +1,76 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.io.Serial; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 酸雾塔报警记录对照表 实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
@Data |
||||
@TableName("EP_TOWER_REC_ALARM") |
||||
@Schema(description = "EpTowerRecAlarm对象") |
||||
public class EpTowerRecAlarm extends BaseEntity implements Serializable { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 编号 |
||||
*/ |
||||
@Schema(description = "编号") |
||||
private String code; |
||||
|
||||
/** |
||||
* 点位 |
||||
*/ |
||||
@Schema(description = "点位") |
||||
private String key; |
||||
|
||||
/** |
||||
* 错误点 |
||||
*/ |
||||
@Schema(description = "错误点") |
||||
private String errorPoint; |
||||
|
||||
/** |
||||
* 消息文本 |
||||
*/ |
||||
@Schema(description = "消息文本") |
||||
private String messText; |
||||
|
||||
} |
||||
@ -0,0 +1,194 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.pojo.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import lombok.Data; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
|
||||
import java.io.Serial; |
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* 参数设置表 实体类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
@Data |
||||
@TableName("RP_PARAMETER_SET") |
||||
@Schema(description = "RpParameterSet对象") |
||||
public class RpParameterSet implements Serializable { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 日期 |
||||
*/ |
||||
@Schema(description = "日期") |
||||
private String rpsDate; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
@Schema(description = "时间") |
||||
private String rpsTime; |
||||
|
||||
/** |
||||
* NF产水导电率A |
||||
*/ |
||||
@Schema(description = "NF产水导电率A") |
||||
private String nfA; |
||||
|
||||
/** |
||||
* NF产水导电率B |
||||
*/ |
||||
@Schema(description = "NF产水导电率B") |
||||
private String nfB; |
||||
|
||||
/** |
||||
* NF进水导电率 |
||||
*/ |
||||
@Schema(description = "NF进水导电率") |
||||
private String nf; |
||||
|
||||
/** |
||||
* RO1_1_产水导电率A |
||||
*/ |
||||
@Schema(description = "RO1_1_产水导电率A") |
||||
private String ro11A; |
||||
|
||||
/** |
||||
* RO1_1_产水导电率B |
||||
*/ |
||||
@Schema(description = "RO1_1_产水导电率B") |
||||
private String ro11B; |
||||
|
||||
/** |
||||
* RO1_1_产水导电率C |
||||
*/ |
||||
@Schema(description = "RO1_1_产水导电率C") |
||||
private String ro11C; |
||||
|
||||
/** |
||||
* RO1_1_进水导电率 |
||||
*/ |
||||
@Schema(description = "RO1_1_进水导电率") |
||||
private String ro11; |
||||
|
||||
/** |
||||
* RO1_1_浓水PH值 |
||||
*/ |
||||
@Schema(description = "RO1_1_浓水PH值") |
||||
private String ro11Ph; |
||||
|
||||
/** |
||||
* RO2_1_产水导电 |
||||
*/ |
||||
@Schema(description = "RO2_1_产水导电") |
||||
private String ro21; |
||||
|
||||
/** |
||||
* RO2_1_进水导电率 |
||||
*/ |
||||
@Schema(description = "RO2_1_进水导电率") |
||||
private String ro21Rate; |
||||
|
||||
/** |
||||
* RO2_2_产水导电率 |
||||
*/ |
||||
@Schema(description = "RO2_2_产水导电率") |
||||
private String ro22Rate; |
||||
|
||||
/** |
||||
* RO2_2_进水导电 |
||||
*/ |
||||
@Schema(description = "RO2_2_进水导电") |
||||
private String ro22; |
||||
|
||||
/** |
||||
* 电镀镍PH值 |
||||
*/ |
||||
@Schema(description = "电镀镍PH值") |
||||
private String electPh; |
||||
|
||||
/** |
||||
* 废液反应池ORP_A |
||||
*/ |
||||
@Schema(description = "废液反应池ORP_A") |
||||
private String orpA; |
||||
|
||||
/** |
||||
* 废液反应池ORP_B |
||||
*/ |
||||
@Schema(description = "废液反应池ORP_B") |
||||
private String orpB; |
||||
|
||||
/** |
||||
* 废液反应池PH_A |
||||
*/ |
||||
@Schema(description = "废液反应池PH_A") |
||||
private String phA; |
||||
|
||||
/** |
||||
* 废液反应池PH_B |
||||
*/ |
||||
@Schema(description = "废液反应池PH_B") |
||||
private String phB; |
||||
|
||||
/** |
||||
* 废液反应池温度_A |
||||
*/ |
||||
@Schema(description = "废液反应池温度_A") |
||||
private String tempA; |
||||
|
||||
/** |
||||
* 废液反应池温度_B |
||||
*/ |
||||
@Schema(description = "废液反应池温度_B") |
||||
private String tempB; |
||||
|
||||
/** |
||||
* 生化溶解氧 |
||||
*/ |
||||
@Schema(description = "生化溶解氧") |
||||
private String oxygen; |
||||
|
||||
/** |
||||
* 阴阳床产水PH |
||||
*/ |
||||
@Schema(description = "阴阳床产水PH") |
||||
private String ph; |
||||
|
||||
/** |
||||
* 预处理ORP |
||||
*/ |
||||
@Schema(description = "预处理ORP") |
||||
private String orp; |
||||
|
||||
} |
||||
@ -0,0 +1,40 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.service; |
||||
|
||||
|
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.desk.energy.pojo.entity.EpTowerRecAlarm; |
||||
|
||||
/** |
||||
* 酸雾塔报警记录对照表 服务类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
public interface IEpTowerRecAlarmService extends BaseService<EpTowerRecAlarm> { |
||||
|
||||
} |
||||
@ -0,0 +1,45 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.service; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import org.springblade.desk.energy.pojo.entity.RpParameterSet; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 参数设置表 服务类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
public interface IRpParameterSetService extends IService<RpParameterSet> { |
||||
|
||||
void setParameterSet(List<JSONObject> objList); |
||||
} |
||||
@ -0,0 +1,44 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.service.impl; |
||||
|
||||
|
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.desk.energy.mapper.EpTowerRecAlarmMapper; |
||||
import org.springblade.desk.energy.pojo.entity.EpTowerRecAlarm; |
||||
import org.springblade.desk.energy.service.IEpTowerRecAlarmService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* 酸雾塔报警记录对照表 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
@Service |
||||
public class EpTowerRecAlarmServiceImpl extends BaseServiceImpl<EpTowerRecAlarmMapper, EpTowerRecAlarm> implements IEpTowerRecAlarmService { |
||||
|
||||
} |
||||
@ -0,0 +1,93 @@ |
||||
/** |
||||
* BladeX Commercial License Agreement |
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p> |
||||
* Use of this software is governed by the Commercial License Agreement |
||||
* obtained after purchasing a license from BladeX. |
||||
* <p> |
||||
* 1. This software is for development use only under a valid license |
||||
* from BladeX. |
||||
* <p> |
||||
* 2. Redistribution of this software's source code to any third party |
||||
* without a commercial license is strictly prohibited. |
||||
* <p> |
||||
* 3. Licensees may copyright their own code but cannot use segments |
||||
* from this software for such purposes. Copyright of this software |
||||
* remains with BladeX. |
||||
* <p> |
||||
* Using this software signifies agreement to this License, and the software |
||||
* must not be used for illegal purposes. |
||||
* <p> |
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is |
||||
* not liable for any claims arising from secondary or illegal development. |
||||
* <p> |
||||
* Author: Chill Zhuang (bladejava@qq.com) |
||||
*/ |
||||
package org.springblade.desk.energy.service.impl; |
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.desk.energy.mapper.RpParameterSetMapper; |
||||
import org.springblade.desk.energy.pojo.entity.RpParameterSet; |
||||
import org.springblade.desk.energy.service.IRpParameterSetService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 参数设置表 服务实现类 |
||||
* |
||||
* @author BladeX |
||||
* @since 2026-04-20 |
||||
*/ |
||||
@Service |
||||
public class RpParameterSetServiceImpl extends ServiceImpl<RpParameterSetMapper, RpParameterSet> implements IRpParameterSetService { |
||||
|
||||
@Override |
||||
public void setParameterSet(List<JSONObject> objList) { |
||||
if (objList == null || objList.isEmpty()) { |
||||
return; |
||||
} |
||||
JSONObject obj = new JSONObject(objList.size()); |
||||
for (JSONObject jsonObject : objList) { |
||||
if (jsonObject == null) { |
||||
continue; |
||||
} |
||||
if (StringUtils.isNotEmpty(jsonObject.getString("identifierName"))) { |
||||
obj.put(jsonObject.getString("identifierName"), jsonObject.getString("defaultValue")); |
||||
} |
||||
} |
||||
|
||||
RpParameterSet rpParameterSet = new RpParameterSet(); |
||||
// 拿出所需的值存储
|
||||
rpParameterSet.setRpsDate(obj.getString("$日期")); |
||||
rpParameterSet.setRpsTime(obj.getString("$时间")); |
||||
rpParameterSet.setNfA(obj.getString("NF产水电导率A")); |
||||
rpParameterSet.setNfB(obj.getString("NF产水电导率B")); |
||||
rpParameterSet.setNf(obj.getString("NF进水电导率")); |
||||
rpParameterSet.setRo11A(obj.getString("RO1_1_产水电导率A")); |
||||
rpParameterSet.setRo11B(obj.getString("RO1_1_产水电导率B")); |
||||
rpParameterSet.setRo11C(obj.getString("RO1_1_产水电导率C")); |
||||
rpParameterSet.setRo11(obj.getString("RO1_1_进水电导率")); |
||||
rpParameterSet.setRo11Ph(obj.getString("RO1_浓水PH值")); |
||||
rpParameterSet.setRo21(obj.getString("RO2_1_产水电导率")); |
||||
rpParameterSet.setRo21Rate(obj.getString("RO2_1_进水电导率")); |
||||
rpParameterSet.setRo22Rate(obj.getString("RO2_2_产水电导率")); |
||||
rpParameterSet.setRo22(obj.getString("RO2_2_进水电导率")); |
||||
rpParameterSet.setElectPh(obj.getString("电镀镍PH值")); |
||||
rpParameterSet.setOrpA(obj.getString("废液反应池ORP_A")); |
||||
rpParameterSet.setOrpB(obj.getString("废液反应池ORP_B")); |
||||
rpParameterSet.setPhA(obj.getString("废液反应池PH_A")); |
||||
rpParameterSet.setPhB(obj.getString("废液反应池PH_B")); |
||||
rpParameterSet.setTempA(obj.getString("废液反应池温度_A")); |
||||
rpParameterSet.setTempB(obj.getString("废液反应池温度_B")); |
||||
rpParameterSet.setOxygen(obj.getString("生化溶解氧")); |
||||
rpParameterSet.setPh(obj.getString("阴阳床产水PH")); |
||||
rpParameterSet.setOrp(obj.getString("预处理ORP")); |
||||
|
||||
save(rpParameterSet); |
||||
} |
||||
} |
||||
@ -0,0 +1,146 @@ |
||||
package org.springblade.desk.energy.util;/** |
||||
* @date : 2026/4/21 10:02 |
||||
*/ |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 文件名称 |
||||
* @module 归属项目 |
||||
* @author *** |
||||
* @date 2025/11/26 10:27 |
||||
*/ |
||||
public class TimeSpan implements Serializable { |
||||
private static final long serialVersionUID = 807778275482047920L; |
||||
private static final long MILLISECONDS_OF_DAY = 86400000L; |
||||
private static final long MILLISECONDS_OF_HOUR = 3600000L; |
||||
private static final long MILLISECONDS_OF_MINUTE = 60000L; |
||||
private static final long MILLISECONDS_OF_SECOND = 1000L; |
||||
private long totalMilliseconds; |
||||
private int days; |
||||
private int hours; |
||||
private int minutes; |
||||
private int seconds; |
||||
private int milliseconds; |
||||
|
||||
public static TimeSpan days(int day) { |
||||
return new TimeSpan((long)day * 86400000L); |
||||
} |
||||
|
||||
public static TimeSpan hours(int hour) { |
||||
return new TimeSpan((long)hour * 3600000L); |
||||
} |
||||
|
||||
public static TimeSpan minutes(int minute) { |
||||
return new TimeSpan((long)minute * 60000L); |
||||
} |
||||
|
||||
public TimeSpan(Date sd, Date ed) { |
||||
this(ed.getTime() - sd.getTime()); |
||||
} |
||||
|
||||
public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { |
||||
this((long)days * 86400000L + (long)hours * 3600000L + (long)minutes * 60000L + (long)seconds * 1000L + (long)milliseconds); |
||||
} |
||||
|
||||
public TimeSpan(long mscs) { |
||||
this.totalMilliseconds = 0L; |
||||
this.days = 0; |
||||
this.hours = 0; |
||||
this.minutes = 0; |
||||
this.seconds = 0; |
||||
this.milliseconds = 0; |
||||
this.totalMilliseconds = mscs; |
||||
boolean isNav = this.totalMilliseconds < 0L; |
||||
long millBanlance = Math.abs(this.totalMilliseconds); |
||||
this.days = (int)(millBanlance / 86400000L); |
||||
millBanlance -= 86400000L * (long)this.days; |
||||
if (isNav) { |
||||
this.days = 0 - this.days; |
||||
} |
||||
|
||||
if (millBanlance > 0L) { |
||||
this.hours = (int)(millBanlance / 3600000L); |
||||
millBanlance -= 3600000L * (long)this.hours; |
||||
if (isNav) { |
||||
this.hours = 0 - this.hours; |
||||
} |
||||
|
||||
if (millBanlance > 0L) { |
||||
this.minutes = (int)(millBanlance / 60000L); |
||||
millBanlance -= 60000L * (long)this.minutes; |
||||
if (isNav) { |
||||
this.minutes = 0 - this.minutes; |
||||
} |
||||
|
||||
if (millBanlance > 0L) { |
||||
this.seconds = (int)(millBanlance / 1000L); |
||||
millBanlance -= 1000L * (long)this.seconds; |
||||
if (isNav) { |
||||
this.seconds = 0 - this.seconds; |
||||
} |
||||
|
||||
if (millBanlance > 0L) { |
||||
this.milliseconds = (int)millBanlance; |
||||
if (isNav) { |
||||
this.milliseconds = 0 - this.milliseconds; |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public int getDays() { |
||||
return this.days; |
||||
} |
||||
|
||||
public int getHours() { |
||||
return this.hours; |
||||
} |
||||
|
||||
public int getMinutes() { |
||||
return this.minutes; |
||||
} |
||||
|
||||
public int getSeconds() { |
||||
return this.seconds; |
||||
} |
||||
|
||||
public int getMilliseconds() { |
||||
return this.milliseconds; |
||||
} |
||||
|
||||
public long getTotalMilliseconds() { |
||||
return this.totalMilliseconds; |
||||
} |
||||
|
||||
public double getTotalSeconds() { |
||||
return 1.0D * (double)this.totalMilliseconds / 1000.0D; |
||||
} |
||||
|
||||
public double getTotalMinutes() { |
||||
return 1.0D * (double)this.totalMilliseconds / 60000.0D; |
||||
} |
||||
|
||||
public double getTotalHours() { |
||||
return 1.0D * (double)this.totalMilliseconds / 3600000.0D; |
||||
} |
||||
|
||||
public double getTotalDays() { |
||||
return 1.0D * (double)this.totalMilliseconds / 8.64E7D; |
||||
} |
||||
|
||||
|
||||
public static final TimeSpan dateDiff(Date date1, Date date2) { |
||||
long diff = 0L; |
||||
if (date1 != null && date2 != null) { |
||||
diff = date2.getTime() - date1.getTime(); |
||||
} |
||||
|
||||
return new TimeSpan(diff); |
||||
} |
||||
|
||||
} |
||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue