Commit 593ecd52 authored by kongfm's avatar kongfm

接口测试修正

parent 0fc27454
...@@ -90,4 +90,6 @@ public class RescueProcessDto extends BaseDto { ...@@ -90,4 +90,6 @@ public class RescueProcessDto extends BaseDto {
@ApiModelProperty(value = "救援反馈方式code") @ApiModelProperty(value = "救援反馈方式code")
private String rescueFeedbackCode; private String rescueFeedbackCode;
@ApiModelProperty(value = "救援时长")
private String arriveUseTime;
} }
...@@ -27,8 +27,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -27,8 +27,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.TimeZone;
/** /**
* 救援过程表服务实现类 * 救援过程表服务实现类
...@@ -42,7 +44,6 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu ...@@ -42,7 +44,6 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
@Autowired @Autowired
DispatchPaperServiceImpl dispatchPaperServiceImpl; DispatchPaperServiceImpl dispatchPaperServiceImpl;
@Autowired @Autowired
private DataDictionaryServiceImpl iDataDictionaryService; private DataDictionaryServiceImpl iDataDictionaryService;
...@@ -76,14 +77,26 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu ...@@ -76,14 +77,26 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
QueryWrapper<RescueProcess> templateQueryWrapper = new QueryWrapper<>(); QueryWrapper<RescueProcess> templateQueryWrapper = new QueryWrapper<>();
templateQueryWrapper.eq("alert_id",alertId); templateQueryWrapper.eq("alert_id",alertId);
RescueProcess rescueProcess = this.getOne(templateQueryWrapper); RescueProcess rescueProcess = this.getOne(templateQueryWrapper);
if(rescueProcess != null) { if(rescueProcess == null) {
return Bean.toModel(rescueProcess, rescueProcessDto);
} else {
rescueProcess = new RescueProcess(); rescueProcess = new RescueProcess();
rescueProcess.setAlertId(alertId); rescueProcess.setAlertId(alertId);
this.save(rescueProcess); this.save(rescueProcess);
return Bean.toModel(rescueProcess, rescueProcessDto);
} }
Bean.toModel(rescueProcess, rescueProcessDto);
// 到达时长 不超过30分钟为否,超过为是
// 到达时长 救援响应人员到达时间—救援派遣成功时间
//判断是否存在到达时间
Date dispatchTime = rescueProcessDto.getDispatchTime();
Date arriveTime = rescueProcessDto.getArriveTime();
if(arriveTime != null && dispatchTime != null) {
Long arriveTimes = arriveTime.getTime() - dispatchTime.getTime(); // 相差毫秒数
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");//这里想要只保留分秒可以写成"mm:ss"
formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
String hms = formatter.format(arriveTimes);
rescueProcessDto.setIsTimeout(arriveTimes < 1800000 ? false : true);
rescueProcessDto.setArriveUseTime(hms);
}
return rescueProcessDto;
} }
@Override @Override
......
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