Commit 91c06195 authored by lisong's avatar lisong

修改接口

parent c12583ea
package com.yeejoin.amos.fas.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -42,6 +43,8 @@ public class ContingencyInstanceInfo extends Model<ContingencyInstanceInfo>{
private String orgCode;
@TableField
private String duration;
}
......@@ -78,6 +78,16 @@ public class ContingencyPlanInstance extends BusinessEntity{
@Column(name = "person_img")
private String personImg;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPersonImg() {
return personImg;
}
......
......@@ -223,7 +223,7 @@ public class PlanVisual3dController extends BaseController {
}
@Permission
@ApiOperation(httpMethod = "GET", value = "分页查询处置详情信息", notes = "分页查询处置详情信息")
@ApiOperation(httpMethod = "GET", value = "分页查询预案下处置动作列表", notes = "分页查询预案下处置动作列表")
@GetMapping(value = "/plan/selectDisposalActionPage")
public ResponseModel selectDisposalActionPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
......@@ -243,7 +243,7 @@ public class PlanVisual3dController extends BaseController {
}
@Permission
@ApiOperation(httpMethod = "GET", value = "分页查询处置详情信息", notes = "分页查询处置详情信息")
@ApiOperation(httpMethod = "GET", value = "查询预案下处置动作列表", notes = "查询预案下处置动作列表")
@GetMapping(value = "/plan/selectDisposalActionList")
public ResponseModel selectDisposalActionList(@RequestParam(value = "batchNo") String batchNo,
@RequestParam(value = "dataType") int dataType
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.fas.core.util.DateUtil;
import com.yeejoin.amos.fas.dao.entity.ContingencyInstanceInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
......@@ -21,7 +22,12 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn
@Override
public ContingencyInstanceInfo selectDisposalDetails(String disposalId) {
return contingencyInstanceInfoMapper.selectDisposalDetails(disposalId);
ContingencyInstanceInfo instanceInfo = contingencyInstanceInfoMapper.selectDisposalDetails(disposalId);
if (!ObjectUtils.isEmpty(instanceInfo.getStartTime()) && !ObjectUtils.isEmpty(instanceInfo.getEndTime())){
String datePoorToMin = getDatePoorToMin(instanceInfo.getEndTime(), instanceInfo.getStartTime());
instanceInfo.setDuration(datePoorToMin);
}
return instanceInfo;
}
@Override
......@@ -38,6 +44,12 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn
start = 0;
}
List<ContingencyInstanceInfo> infoList = contingencyInstanceInfoMapper.selectDisposalListPage((int) start, size, orgCode);
for (ContingencyInstanceInfo instanceInfo : infoList) {
if (!ObjectUtils.isEmpty(instanceInfo.getStartTime()) && !ObjectUtils.isEmpty(instanceInfo.getEndTime())){
String datePoorToMin = getDatePoorToMin(instanceInfo.getEndTime(), instanceInfo.getStartTime());
instanceInfo.setDuration(datePoorToMin);
}
}
page.setRecords(infoList);
}
return page;
......@@ -64,5 +76,23 @@ public class ContingencyInstanceInfoServiceImpl implements ContingencyInstanceIn
}
return false;
}
public static String getDatePoorToMin(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff / nh;
// 计算差多少分钟
long min = diff % nh / nm;
// 计算差多少秒//输出结果
long sec = diff % nd % nh % nm / ns;
return hour + "小时" + min + "分钟 " + sec + "秒";
}
}
......@@ -35,28 +35,33 @@
where is_delete = 0 and org_code = #{orgCode}
</select>
<select id="selectDisposalActionPage" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select `id`, `record_type`, `category`, `content`, `icon`, `sort`, `sequence_num`
, `batch_no`, `create_date`, `create_user`, `update_date`
, `update_user`, `is_delete`, `tips`, IFNULL(`runstate`, 0) AS runstate, `file_path`
select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
, cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date`
, cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path`
, `file_type`, `role_name`, `role_code`, `start_user_name`
, `start_user_id`, `person_img` from contingency_plan_instance
, cpi.`start_user_id`, cpi.`person_img`,cii.name
from contingency_plan_instance cpi left join contingency_instance_info cii
on cpi.batch_no = cii.id
<where>
<if test="batchNo != null and batchNo != ''">
batch_no = #{batchNo}
</if>
<if test="type != null and type != ''">
and record_type = #{type}
</if>
<if test="status != null and status != ''">
and runstate = #{status}
</if>
<if test="list != null and list.size() >0">
<if test="batchNo != null and batchNo != ''">
cpi.batch_no = #{batchNo}
</if>
<if test="type != null and type != ''">
and cpi.record_type = #{type}
</if>
<if test="status != null and status != ''">
and cpi.runstate is null
</if>
<if test="list != null and list.size() >0">
<foreach collection="list" item="role" index="index" open="and (" close=") " separator="or">
role_code like concat('%',#{role},'%')
</foreach>
</if>
</where>
<foreach collection="list" item="role" index="index" open="and (" close=") " separator="or">
cpi.role_code like concat('%',#{role},'%')
</foreach>
</if>
</where>
order by cpi.`create_date`
LIMIT #{current}, #{size}
</select>
<select id="selectCountDisposalActionPage" resultType="java.lang.Integer">
......@@ -69,7 +74,7 @@
and record_type = #{type}
</if>
<if test="status != null and status != ''">
and runstate = #{status}
and runstate is null
</if>
<if test="list != null and list.size() >0">
......@@ -81,30 +86,31 @@
</select>
<select id="selectDisposalActionList" resultType="com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance">
select `id`, `record_type`, `category`, `content`, `icon`, `sort`, `sequence_num`
, `batch_no`, `create_date`, `create_user`, `update_date`
, `update_user`, `is_delete`, `tips`, IFNULL(`runstate`, 0) AS runstate, `file_path`
select cpi.id, cpi.`record_type`, cpi.`category`, cpi.`content`, cpi.`icon`, cpi.`sort`, cpi.`sequence_num`
, cpi.`batch_no`, cpi.`create_date`, cpi.`create_user`, cpi.`update_date`
, cpi.`update_user`, cpi.`is_delete`, cpi.`tips`, IFNULL(cpi.`runstate`, 0) AS runstate, cpi.`file_path`
, `file_type`, `role_name`, `role_code`, `start_user_name`
, `start_user_id`, `person_img`
from contingency_plan_instance
, cpi.`start_user_id`, cpi.`person_img`,cii.name
from contingency_plan_instance cpi left join contingency_instance_info cii
on cpi.batch_no = cii.id
<where>
<if test="batchNo != null and batchNo != ''">
batch_no = #{batchNo}
cpi.batch_no = #{batchNo}
</if>
<if test="type != null and type != ''">
and record_type = #{type}
and cpi.record_type = #{type}
</if>
<if test="status != null and status != ''">
and runstate = #{status}
and cpi.runstate is null
</if>
<if test="list != null and list.size() >0">
<foreach collection="list" item="role" index="index" open="and (" close=") " separator="or">
role_code like concat('%',#{role},'%')
cpi.role_code like concat('%',#{role},'%')
</foreach>
</if>
</where>
order by cpi.`create_date`
</select>
</mapper>
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