|
@@ -71,15 +71,15 @@ import java.util.stream.Collectors;
|
|
|
@RequestMapping("/emergency/emergency-repair")
|
|
|
public class EmergencyRepairController {
|
|
|
|
|
|
- private EmergencyRepairService emergencyRepairService;
|
|
|
- private ErRecordCostService erRecordCostService;
|
|
|
- private ErRecordImgService erRecordImgService;
|
|
|
- private LiftFaultService liftFaultService;
|
|
|
- private EvaluationService evaluationService;
|
|
|
+ private EmergencyRepairService emergencyRepairService;
|
|
|
+ private ErRecordCostService erRecordCostService;
|
|
|
+ private ErRecordImgService erRecordImgService;
|
|
|
+ private LiftFaultService liftFaultService;
|
|
|
+ private EvaluationService evaluationService;
|
|
|
private PlatformCompanyLiftRelevanceService platformCompanyLiftRelevanceService;
|
|
|
- private EmergencyHistoryService emergencyHistoryService;
|
|
|
- private JmsMessagingTemplate jmsMessagingTemplate;
|
|
|
- private PushUserService pushUserService;
|
|
|
+ private EmergencyHistoryService emergencyHistoryService;
|
|
|
+ private JmsMessagingTemplate jmsMessagingTemplate;
|
|
|
+ private PushUserService pushUserService;
|
|
|
|
|
|
private static final Map<String, String> headerAlias = new LinkedHashMap<>();
|
|
|
|
|
@@ -197,16 +197,16 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
List<PushUserInfo> director = pushUserService.listHighDirector(mtCompanyId);
|
|
|
List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
- if(!userIds.isEmpty()){
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
pushUserInfos.addAll(userInfos);
|
|
|
}
|
|
|
- if(!pushUserInfos.isEmpty()){
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
RepairResponse info = emergencyRepairService.infoById(id);
|
|
|
PushMessage pushMessage = PushMessage.emergencyAssign(info.getAreaName(), info.getProjectName(), info.getDevicePosition(),
|
|
|
info.getRegistrationCode(), info.getCallerDate(), info.getIsTrapped(),
|
|
|
info.getCallerFaultDescription(), info.getWorkerName());
|
|
|
- if(ApiConstants.ACCESS_TYPE_PUBLIC == entity.getMobileType()) {
|
|
|
+ if (ApiConstants.ACCESS_TYPE_PUBLIC == entity.getMobileType()) {
|
|
|
pushMessage = PushMessage.emergencyAssignByProperty(info.getAreaName(), info.getProjectName(), info.getDevicePosition(),
|
|
|
info.getRegistrationCode(), info.getCallerDate(), info.getIsTrapped(),
|
|
|
info.getCallerFaultDescription(), info.getWorkerName());
|
|
@@ -255,7 +255,7 @@ public class EmergencyRepairController {
|
|
|
// }
|
|
|
LocalDate repairBegin = request.getRepairBegin();
|
|
|
LocalDate repairEnd = request.getRepairEnd();
|
|
|
- if(Objects.nonNull(repairBegin) && Objects.nonNull(repairEnd)){
|
|
|
+ if (Objects.nonNull(repairBegin) && Objects.nonNull(repairEnd)) {
|
|
|
Validate.isTrue(repairBegin.isBefore(repairEnd), ValuePool.beginTimeToEndTimeIllegal(repairBegin, repairEnd));
|
|
|
}
|
|
|
IPage<RepairResponse> pages = emergencyRepairService.pageByCondition(request);
|
|
@@ -283,6 +283,7 @@ public class EmergencyRepairController {
|
|
|
|
|
|
/**
|
|
|
* 急修收款中急修列表,不检查status
|
|
|
+ *
|
|
|
* @param request RepairRequest
|
|
|
* @return RestResponse
|
|
|
*/
|
|
@@ -305,7 +306,7 @@ public class EmergencyRepairController {
|
|
|
public RestResponse pageWorker(@Val @RequestBody RepairRequest request) {
|
|
|
if (Objects.equals(ValuePool.EMERGENCY_STATE_COMPLETE, request.getStatus())) {
|
|
|
request.addDesc("recovery_date");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
request.addDesc("assign_time");
|
|
|
}
|
|
|
IPage<RepairResponse> pages = emergencyRepairService.pageByCondition(request);
|
|
@@ -356,16 +357,16 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
List<PushUserInfo> director = pushUserService.listHighDirector(mtCompanyId);
|
|
|
List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
- if(!userIds.isEmpty()){
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
pushUserInfos.addAll(userInfos);
|
|
|
}
|
|
|
RepairResponse info = emergencyRepairService.infoById(id);
|
|
|
- if(!pushUserInfos.isEmpty()){
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
PushMessage.emergencyTransfer(info.getAreaName(), info.getProjectName(), info.getDevicePosition(), info.getRegistrationCode(), info.getCallerDate(), info.getIsTrapped(), info.getCallerFaultDescription(), info.getWorkerName()).sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfos);
|
|
|
}
|
|
|
//【原被派单人】收到消息:
|
|
|
- if(Objects.nonNull(originId)){
|
|
|
+ if (Objects.nonNull(originId)) {
|
|
|
PushUserInfo originWorker = pushUserService.listByUserId(mtCompanyId, originId);
|
|
|
PushMessage.emergencyTransferForOriginal(info.getAreaName(), info.getProjectName(), info.getDevicePosition(), info.getRegistrationCode(), info.getWorkerName()).sendTokenOnPlatform(jmsMessagingTemplate, originWorker);
|
|
|
}
|
|
@@ -403,7 +404,7 @@ public class EmergencyRepairController {
|
|
|
public RestResponse pageByUser(@Val @RequestBody RepairRequest request) {
|
|
|
if (Objects.equals(ValuePool.EMERGENCY_STATE_COMPLETE, request.getStatus())) {
|
|
|
request.addDesc("recovery_date");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
request.addDesc("assign_time");
|
|
|
}
|
|
|
IPage<RepairResponse> pages = emergencyRepairService.pageByUser(request);
|
|
@@ -433,7 +434,7 @@ public class EmergencyRepairController {
|
|
|
Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_TO_DO, ValuePool.EMERGENCY_MUST_TO_DO);
|
|
|
LocalDateTime assignTime = entity.getAssignTime();
|
|
|
LocalDateTime takingTime = request.getTakingTime();
|
|
|
- if(Objects.nonNull(assignTime)){
|
|
|
+ if (Objects.nonNull(assignTime)) {
|
|
|
Validate.isTrue(assignTime.isBefore(takingTime), ValuePool.emergencyProcessTimeIllegal("派单时间", assignTime));
|
|
|
}
|
|
|
entity.setTakingTime(takingTime);
|
|
@@ -450,11 +451,11 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
List<PushUserInfo> director = pushUserService.listHighDirector(mtCompanyId);
|
|
|
List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
- if(!userIds.isEmpty()){
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
pushUserInfos.addAll(userInfos);
|
|
|
}
|
|
|
- if(!pushUserInfos.isEmpty()){
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
RepairResponse info = emergencyRepairService.infoById(id);
|
|
|
PushMessage pushMessage = PushMessage.emergencyTaking(info.getAreaName(), info.getProjectName(),
|
|
|
info.getDevicePosition(), info.getRegistrationCode(), info.getCallerDate());
|
|
@@ -483,7 +484,7 @@ public class EmergencyRepairController {
|
|
|
Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
|
|
|
LocalDateTime takingTime = entity.getTakingTime();
|
|
|
LocalDateTime arriveTime = request.getArriveTime();
|
|
|
- if(Objects.nonNull(takingTime)){
|
|
|
+ if (Objects.nonNull(takingTime)) {
|
|
|
Validate.isTrue(takingTime.isBefore(arriveTime), ValuePool.emergencyProcessTimeIllegal("接单时间", takingTime));
|
|
|
}
|
|
|
entity.setArriveTime(arriveTime);
|
|
@@ -500,11 +501,11 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
List<PushUserInfo> director = pushUserService.listHighDirector(mtCompanyId);
|
|
|
List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
- if(!userIds.isEmpty()){
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
pushUserInfos.addAll(userInfos);
|
|
|
}
|
|
|
- if(!pushUserInfos.isEmpty()){
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
RepairResponse info = emergencyRepairService.infoById(id);
|
|
|
PushMessage pushMessage = PushMessage.emergencyArrive(info.getAreaName(), info.getProjectName(),
|
|
|
info.getDevicePosition(), info.getRegistrationCode(), info.getCallerDate(), info.getArriveTime());
|
|
@@ -533,7 +534,7 @@ public class EmergencyRepairController {
|
|
|
Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
|
|
|
LocalDateTime arriveTime = entity.getArriveTime();
|
|
|
LocalDateTime stopDate = request.getStopDate();
|
|
|
- if(Objects.nonNull(arriveTime)){
|
|
|
+ if (Objects.nonNull(arriveTime)) {
|
|
|
Validate.isTrue(arriveTime.isBefore(stopDate), ValuePool.emergencyProcessTimeIllegal("到达时间", arriveTime));
|
|
|
}
|
|
|
entity.setStopDate(stopDate);
|
|
@@ -557,7 +558,7 @@ public class EmergencyRepairController {
|
|
|
|
|
|
List<ErRecordCost> costs = erRecordCostService.listByErRecordId(repair.getId());
|
|
|
List<ErRecordCost> erRecordCosts = request.getErRecordCosts();
|
|
|
- if(Objects.isNull(costs)){
|
|
|
+ if (Objects.isNull(costs)) {
|
|
|
costs = new ArrayList<>();
|
|
|
}
|
|
|
costs.addAll(erRecordCosts);
|
|
@@ -718,6 +719,7 @@ public class EmergencyRepairController {
|
|
|
@PostMapping("repairOrder")
|
|
|
@Validation(fields = {"id", "recoveryDate", "mainSign", "erRecordImg", "fieldDescription",
|
|
|
"faultPart", "faultReason", "faultHandle", "faultNature", "faultDuty"})
|
|
|
+ @SuppressWarnings("all")
|
|
|
public RestResponse repairOrder(@Val @RequestBody RepairRequest request) {
|
|
|
Long id = request.getId();
|
|
|
EmergencyRepair entity = emergencyRepairService.getById(id);
|
|
@@ -725,7 +727,7 @@ public class EmergencyRepairController {
|
|
|
Validate.equals(entity.getStatus(), ValuePool.EMERGENCY_STATE_DOING, ValuePool.EMERGENCY_MUST_IN_DOING);
|
|
|
LocalDateTime stopDate = entity.getStopDate();
|
|
|
LocalDateTime recoveryDate = request.getRecoveryDate();
|
|
|
- if(Objects.nonNull(stopDate)){
|
|
|
+ if (Objects.nonNull(stopDate)) {
|
|
|
Validate.isTrue(stopDate.isBefore(recoveryDate), ValuePool.emergencyProcessTimeIllegal("停梯时间", stopDate));
|
|
|
}
|
|
|
List<ErRecordImg> erRecordImgs = new ArrayList<>();
|
|
@@ -750,10 +752,20 @@ public class EmergencyRepairController {
|
|
|
entity.setStatus(ValuePool.EMERGENCY_STATE_COMPLETE);
|
|
|
RestResponse result = emergencyRepairService.repairOrder(entity, erRecordImgs);
|
|
|
log.debug("急修完成后,修改platform_company_lift_relevance,电梯状态到正常(状态值2)");
|
|
|
- platformCompanyLiftRelevanceService.update(Wrappers.<PlatformCompanyLiftRelevance>update().
|
|
|
- eq("mt_company_id", request.getMtCompanyId()).
|
|
|
- eq("lift_id", request.getLiftId()).
|
|
|
- set("lift_company_status", CommonEnum.LiftStatus.NORMAL.getCode()));
|
|
|
+
|
|
|
+ //更新平台电梯关联表
|
|
|
+ boolean flag = platformCompanyLiftRelevanceService.update(
|
|
|
+ Wrappers.<PlatformCompanyLiftRelevance>update()
|
|
|
+ .in("mt_company_id", new ArrayList<Long>() {{
|
|
|
+ add(entity.getMtCompanyId());
|
|
|
+ add(ApiConstants.PLATFORM_COMPANY_ID);
|
|
|
+ }})
|
|
|
+ .eq("lift_id", entity.getLiftId())
|
|
|
+ .set("lift_company_status", CommonEnum.LiftStatus.NORMAL.getCode())
|
|
|
+ );
|
|
|
+ if (!flag) {
|
|
|
+ throw new RuntimeException("急修更改平台电梯关联表数据失败!");
|
|
|
+ }
|
|
|
|
|
|
if (Objects.equals("1", result.getStatusCode())) {
|
|
|
Long mtCompanyId = entity.getMtCompanyId();
|
|
@@ -764,11 +776,11 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
List<PushUserInfo> director = pushUserService.listHighDirector(mtCompanyId);
|
|
|
List<PushUserInfo> pushUserInfos = new ArrayList<>(director);
|
|
|
- if(!userIds.isEmpty()){
|
|
|
+ if (!userIds.isEmpty()) {
|
|
|
List<PushUserInfo> userInfos = pushUserService.listByUserIds(mtCompanyId, userIds);
|
|
|
pushUserInfos.addAll(userInfos);
|
|
|
}
|
|
|
- if(!pushUserInfos.isEmpty()){
|
|
|
+ if (!pushUserInfos.isEmpty()) {
|
|
|
RepairResponse info = emergencyRepairService.infoById(id);
|
|
|
PushMessage pushMessage = PushMessage.emergencyOrder(info.getAreaName(), info.getProjectName(),
|
|
|
info.getDevicePosition(), info.getRegistrationCode(), info.getCallerDate(), info.getRecoveryDate());
|