|
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
@@ -124,10 +125,7 @@ public class EmergencyRepairController {
|
|
|
entity.setAssignTime(LocalDateTime.now());
|
|
|
entity.setStatus(Values.ER_STATUS_TO_REPAIRED);
|
|
|
boolean result = emergencyRepairService.save(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -164,6 +162,21 @@ public class EmergencyRepairController {
|
|
|
return RestResponse.success(countPage);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @description 根据条件分页查询
|
|
|
+ * @date 2019/12/9 9:39
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("pageWorker")
|
|
|
+ public RestResponse pageWorker(@RequestBody RepairRequest request){
|
|
|
+ if(request.getWorkerId() == null || request.getWorkerId() <= 0){
|
|
|
+ return RestResponse.failParam();
|
|
|
+ }
|
|
|
+ IPage<RepairResponse> pages = emergencyRepairService.pageByCondition(request);
|
|
|
+ return null != pages ? RestResponse.success(pages) : RestResponse.fail();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @description 急修转派
|
|
|
* @date 2019/12/11 9:25
|
|
@@ -181,13 +194,14 @@ public class EmergencyRepairController {
|
|
|
if(null == entity){
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
+ //如果已经接单,在急修中了不能被转派
|
|
|
+ if (entity.getStatus() == Values.ER_STATUS_REPAIRING) {
|
|
|
+ return RestResponse.fail("急修已经接单,不能转派");
|
|
|
+ }
|
|
|
//本急修单的负责维保工
|
|
|
entity.setWorkerId1(workerId);
|
|
|
boolean result = emergencyRepairService.saveOrUpdate(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -214,10 +228,7 @@ public class EmergencyRepairController {
|
|
|
//新状态(-1 暂停中,0 待修理;1 修理中;2 已完成 3 已关闭)
|
|
|
entity.setStatus(Values.ER_STATUS_CLOSE);
|
|
|
boolean result = emergencyRepairService.saveOrUpdate(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -228,10 +239,7 @@ public class EmergencyRepairController {
|
|
|
@PostMapping("pageByUser")
|
|
|
public RestResponse pageByUser(@RequestBody RepairRequest request){
|
|
|
IPage<RepairResponse> pages = emergencyRepairService.pageByUser(request);
|
|
|
- if(null == pages){
|
|
|
- return RestResponse.fail();
|
|
|
- }
|
|
|
- return RestResponse.success(pages);
|
|
|
+ return null != pages ? RestResponse.success(pages) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -252,13 +260,10 @@ public class EmergencyRepairController {
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
entity.setTakingTime(takingTime);
|
|
|
- //状态改成修理中
|
|
|
+ //状态改成修理中 todo:修改电梯的业务状态为急修中,如果存在维保中,要修改
|
|
|
entity.setStatus(Values.ER_STATUS_REPAIRING);
|
|
|
- boolean result = emergencyRepairService.updateById(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ boolean result = emergencyRepairService.taking(entity);
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -286,10 +291,7 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
entity.setArriveTime(arriveTime);
|
|
|
boolean result = emergencyRepairService.updateById(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -318,11 +320,8 @@ public class EmergencyRepairController {
|
|
|
}
|
|
|
entity.setStopDate(stopDate);
|
|
|
entity.setSafetyConfirm(safetyConfirm);
|
|
|
- boolean result = emergencyRepairService.stopLift(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ boolean result = emergencyRepairService.updateById(entity);
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -338,14 +337,12 @@ public class EmergencyRepairController {
|
|
|
if(id == null || null == erCostItems || erCostItems.isEmpty()){
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
- for (ErCostItem item: erCostItems){
|
|
|
- item.setErRecordId(id);
|
|
|
- }
|
|
|
+ BigDecimal costTotal = new BigDecimal(0);
|
|
|
+ erCostItems.forEach(item -> {
|
|
|
+ costTotal.add(item.getCostMoney());
|
|
|
+ });
|
|
|
boolean result = erCostItemService.saveBatch(erCostItems);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -360,10 +357,7 @@ public class EmergencyRepairController {
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
boolean result = erCostItemService.removeById(erCostItemId);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -378,10 +372,7 @@ public class EmergencyRepairController {
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
boolean result = erCostItemService.updateBatchById(erCostItems);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -396,8 +387,7 @@ public class EmergencyRepairController {
|
|
|
return RestResponse.success(liftFaultService.list());
|
|
|
}
|
|
|
List<LiftFault> lists = liftFaultService.listByLiftCategory(liftCategory);
|
|
|
-
|
|
|
- return RestResponse.success(lists);
|
|
|
+ return null != lists ? RestResponse.success(lists) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -465,26 +455,31 @@ public class EmergencyRepairController {
|
|
|
if(null == recordId || recordId <= 0){
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
+ String customerSign = request.getCustomerSign();
|
|
|
+ if(StrUtil.isEmpty(customerSign)){
|
|
|
+ return RestResponse.fail("请签名");
|
|
|
+ }
|
|
|
EmergencyRepair repair = emergencyRepairService.getById(recordId);
|
|
|
if(null == repair){
|
|
|
return RestResponse.failParam();
|
|
|
}
|
|
|
if(repair.getStatus() != Values.ER_STATUS_FINISH){
|
|
|
- return RestResponse.fail("急修未完成不能评价");
|
|
|
+ return RestResponse.fail("该急修未完成不能评价");
|
|
|
+ }
|
|
|
+ Evaluation old = evaluationService.findByRecord(recordId);
|
|
|
+ if (null != old) {
|
|
|
+ return RestResponse.fail("该急修已经存在评价");
|
|
|
}
|
|
|
Evaluation evaluation = new Evaluation();
|
|
|
//复制属性到评价bean
|
|
|
BeanUtil.copyProperties(request,evaluation);
|
|
|
evaluation.setPostDate(LocalDateTime.now());
|
|
|
boolean result = evaluationService.save(evaluation);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 生成急修单
|
|
|
+ * 生成急修单,添加主要,次要急修人签名
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
@@ -498,6 +493,11 @@ public class EmergencyRepairController {
|
|
|
if(null == recoveryDate){
|
|
|
return RestResponse.fail("请填写恢复时间");
|
|
|
}
|
|
|
+ String mainSign = request.getMainSign();
|
|
|
+ String secondSign = request.getSecondSign();
|
|
|
+ if(StrUtil.hasEmpty(mainSign,secondSign)){
|
|
|
+ return RestResponse.fail("请签名");
|
|
|
+ }
|
|
|
EmergencyRepair entity = emergencyRepairService.getById(id);
|
|
|
if(null == entity){
|
|
|
return RestResponse.failParam();
|
|
@@ -512,9 +512,6 @@ public class EmergencyRepairController {
|
|
|
//修改状态已完成
|
|
|
entity.setStatus(Values.ER_STATUS_FINISH);
|
|
|
boolean result = emergencyRepairService.updateById(entity);
|
|
|
- if(result){
|
|
|
- return RestResponse.success(result);
|
|
|
- }
|
|
|
- return RestResponse.fail();
|
|
|
+ return result ? RestResponse.success(result) : RestResponse.fail();
|
|
|
}
|
|
|
}
|