|
@@ -309,6 +309,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public CommonResult InsertRepairRecord(repairRecordRequest rrr, BindingResult bindingResult) throws Exception {
|
|
public CommonResult InsertRepairRecord(repairRecordRequest rrr, BindingResult bindingResult) throws Exception {
|
|
|
|
|
+ System.out.println("提交订单"+JSON.toJSON(rrr));
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
|
String st = paramUtils.getParamError(bindingResult);
|
|
String st = paramUtils.getParamError(bindingResult);
|
|
|
return CommonResult.fail(st);
|
|
return CommonResult.fail(st);
|
|
@@ -349,7 +350,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
//楼栋条件 员工必填楼栋 满足楼栋条件才能派
|
|
//楼栋条件 员工必填楼栋 满足楼栋条件才能派
|
|
|
List<AutoDispatchUserVo> users = repairUserService.autoDispatchUser(rrr.getSchoolId(), dateNow, rrr.getArticleId(), rrr.getBuildId());
|
|
List<AutoDispatchUserVo> users = repairUserService.autoDispatchUser(rrr.getSchoolId(), dateNow, rrr.getArticleId(), rrr.getBuildId());
|
|
|
|
|
|
|
|
- String shiftStr = StringUtils.join(users.stream().map(AutoDispatchUserVo::getArticleId).collect(Collectors.toList()), ",");
|
|
|
|
|
|
|
+ String shiftStr = StringUtils.join(users.stream().map(AutoDispatchUserVo::getShiftId).collect(Collectors.toList()), ",");
|
|
|
List<String> shifts = Arrays.asList(shiftStr.split(",")).stream().distinct().collect(Collectors.toList());
|
|
List<String> shifts = Arrays.asList(shiftStr.split(",")).stream().distinct().collect(Collectors.toList());
|
|
|
RepairDispatchRecord rdr = null;
|
|
RepairDispatchRecord rdr = null;
|
|
|
//只获取不是值班 或下班后的排班数据
|
|
//只获取不是值班 或下班后的排班数据
|
|
@@ -417,6 +418,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ System.out.println("提交订单异常"+e.getMessage());
|
|
|
throw new Exception("报修单提交失败!");
|
|
throw new Exception("报修单提交失败!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -485,6 +487,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ System.out.println("提交订单异常2"+e.getMessage());
|
|
|
throw new Exception("报修单提交失败!");
|
|
throw new Exception("报修单提交失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -846,6 +849,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
for (RepairRecordPageVo r : result.getList()) {
|
|
for (RepairRecordPageVo r : result.getList()) {
|
|
|
if (r.getMaintenanceState() == 1) {
|
|
if (r.getMaintenanceState() == 1) {
|
|
|
r.setState("待接单");
|
|
r.setState("待接单");
|
|
|
|
|
+ r.setClose(1);
|
|
|
} else if (r.getMaintenanceState() == 2) {
|
|
} else if (r.getMaintenanceState() == 2) {
|
|
|
r.setState("维修中");
|
|
r.setState("维修中");
|
|
|
} else if (r.getMaintenanceState() == 3) {
|
|
} else if (r.getMaintenanceState() == 3) {
|
|
@@ -1022,8 +1026,8 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public CommonResult queryPendingOrder(int currentPage, int pageCount) {
|
|
|
|
|
- PageUtils<pendingOrderVo> result = repairRecordService.queryPendingOrder(currentPage, pageCount);
|
|
|
|
|
|
|
+ public CommonResult queryPendingOrder(int currentPage, int pageCount, int schoolId) {
|
|
|
|
|
+ PageUtils<pendingOrderVo> result = repairRecordService.queryPendingOrder(currentPage, pageCount, schoolId);
|
|
|
return CommonResult.ok(result);
|
|
return CommonResult.ok(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1231,9 +1235,15 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//获取操作人的派单数据
|
|
//获取操作人的派单数据
|
|
|
- RepairDispatchRecord dispatch = repairDispatchRecordService.queryOwnRepairDispatch(recordId, userId);
|
|
|
|
|
- if (dispatch == null) {
|
|
|
|
|
- return CommonResult.fail("派单数据异常,接单失败");
|
|
|
|
|
|
|
+ List<RepairDispatchRecord> rdrs = repairDispatchRecordService.queryDispatchByRecordId(recordId);
|
|
|
|
|
+ RepairDispatchRecord dispatch = null;
|
|
|
|
|
+ if(rdrs != null && rdrs.size() > 0){
|
|
|
|
|
+ Optional<RepairDispatchRecord> data = rdrs.stream().filter(e -> e.getUsersId().equals(userId)).findFirst();
|
|
|
|
|
+ if(data != null && data.isPresent()){
|
|
|
|
|
+ dispatch = data.get();
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return CommonResult.fail("该工单存在待处理人,接单失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String dateNow = TimeExchange.DateToString(nowDate, "yyyy-MM-dd");
|
|
String dateNow = TimeExchange.DateToString(nowDate, "yyyy-MM-dd");
|
|
@@ -1315,27 +1325,47 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
|
|
|
|
|
//将工单状态更新为维修中
|
|
//将工单状态更新为维修中
|
|
|
recordData.setMaintenanceState(eRecordStatu.Maintenance.getValue());
|
|
recordData.setMaintenanceState(eRecordStatu.Maintenance.getValue());
|
|
|
- String mi = dispatch.getOrderType() == eDispatchType.Cooperation.getValue() ? recordData.getMaintenancerId() == null ? String.valueOf(userId) : recordData.getMaintenancerId() + "," + String.valueOf(userId) : String.valueOf(userId);
|
|
|
|
|
|
|
+ String mi = recordData.getMaintenancerId() == null ? String.valueOf(userId) : recordData.getMaintenancerId() + "," + String.valueOf(userId);
|
|
|
recordData.setMaintenancerId(mi);
|
|
recordData.setMaintenancerId(mi);
|
|
|
recordData.setMaintenancerName(result.getUserName());
|
|
recordData.setMaintenancerName(result.getUserName());
|
|
|
recordData.setMaintenancerPhone(result.getUserPhone());
|
|
recordData.setMaintenancerPhone(result.getUserPhone());
|
|
|
recordData.setIsDuty(isDuty);
|
|
recordData.setIsDuty(isDuty);
|
|
|
|
|
+
|
|
|
int updateRecord = repairRecordService.updateRepairRecord(recordData);
|
|
int updateRecord = repairRecordService.updateRepairRecord(recordData);
|
|
|
if (updateRecord <= 0) {
|
|
if (updateRecord <= 0) {
|
|
|
throw new Exception("接单失败!");
|
|
throw new Exception("接单失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //更新派单记录
|
|
|
|
|
- dispatch.setReceivingTime(nowDate);
|
|
|
|
|
- int updateDispatch = repairDispatchRecordService.insertRepairDispatchRecord(dispatch);
|
|
|
|
|
- if (updateDispatch <= 0) {
|
|
|
|
|
- throw new Exception("接单失败!");
|
|
|
|
|
|
|
+ int disId = 0;
|
|
|
|
|
+ if(dispatch == null){
|
|
|
|
|
+ //更新派单记录
|
|
|
|
|
+ dispatch = new RepairDispatchRecord();
|
|
|
|
|
+ dispatch.setAssignedTime(new Date());
|
|
|
|
|
+ dispatch.setAcceptanceAssessTime(result.getAcceptanceAssessTime());
|
|
|
|
|
+ dispatch.setOrderType(0);
|
|
|
|
|
+ dispatch.setIsLoseEfficacy(0);
|
|
|
|
|
+ dispatch.setUsersId(userId);
|
|
|
|
|
+ dispatch.setReceivingTime(nowDate);
|
|
|
|
|
+ int insertDispatch = repairDispatchRecordService.insertRepairDispatchRecord(dispatch);
|
|
|
|
|
+ if (insertDispatch <= 0) {
|
|
|
|
|
+ throw new Exception("接单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ disId =insertDispatch;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //更新派单记录
|
|
|
|
|
+ dispatch.setReceivingTime(nowDate);
|
|
|
|
|
+ int updateDispatch = repairDispatchRecordService.updateRepairDispatchRecord(dispatch);
|
|
|
|
|
+ if (updateDispatch <= 0) {
|
|
|
|
|
+ throw new Exception("接单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+ disId = dispatch.getId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
//创建接单记录
|
|
//创建接单记录
|
|
|
RepairReceiving rr = new RepairReceiving();
|
|
RepairReceiving rr = new RepairReceiving();
|
|
|
rr.setRecordId(recordId);
|
|
rr.setRecordId(recordId);
|
|
|
- rr.setDispatchId(dispatch.getId());
|
|
|
|
|
|
|
+ rr.setDispatchId(disId);
|
|
|
rr.setUserId(userId);
|
|
rr.setUserId(userId);
|
|
|
rr.setReceivingTime(new Date());
|
|
rr.setReceivingTime(new Date());
|
|
|
rr.setMaintenanceAssessTime(maintenanceAssessTime);
|
|
rr.setMaintenanceAssessTime(maintenanceAssessTime);
|
|
@@ -1398,6 +1428,12 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
return CommonResult.fail("维修单状态异常,派单失败");
|
|
return CommonResult.fail("维修单状态异常,派单失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //查询该订单是否存在被派单数据
|
|
|
|
|
+ List<RepairDispatchRecord> repairDis = repairDispatchRecordService.queryDispatchByRecordId(rsor.getRecordId());
|
|
|
|
|
+ if(repairDis != null && repairDis.size() > 0){
|
|
|
|
|
+ return CommonResult.fail("该订单存在待接单师傅,请勿再次派单");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Integer isDuty = 0;
|
|
Integer isDuty = 0;
|
|
|
Date nowDate = new Date();
|
|
Date nowDate = new Date();
|
|
|
String dateHour = new SimpleDateFormat("HH:mm").format(new Date());
|
|
String dateHour = new SimpleDateFormat("HH:mm").format(new Date());
|
|
@@ -1501,6 +1537,16 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
senderId = user.getId();
|
|
senderId = user.getId();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ RepairSystemMessages rsm = new RepairSystemMessages();
|
|
|
|
|
+ rsm.setIsRead(0);
|
|
|
|
|
+ rsm.setRecordId(rsor.getRecordId());
|
|
|
|
|
+ rsm.setRecipientId(rsor.getId());
|
|
|
|
|
+ rsm.setContent("管理员为您派发工单,请尽快处理!");
|
|
|
|
|
+ int insertRsm = repairSystemMessagesService.insertRepairSystemMessages(rsm);
|
|
|
|
|
+ if (insertRsm <= 0) {
|
|
|
|
|
+ throw new Exception("派单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//添加跟踪记录 派单不加跟踪记录
|
|
//添加跟踪记录 派单不加跟踪记录
|
|
|
RepairTrackRecord rtr = new RepairTrackRecord();
|
|
RepairTrackRecord rtr = new RepairTrackRecord();
|
|
|
rtr.setRecordId(rsor.getRecordId());
|
|
rtr.setRecordId(rsor.getRecordId());
|
|
@@ -2726,6 +2772,7 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
sendCountMap.put(usersId, integers);
|
|
sendCountMap.put(usersId, integers);
|
|
|
} else {
|
|
} else {
|
|
|
ArrayList<Integer> integers = new ArrayList<>();
|
|
ArrayList<Integer> integers = new ArrayList<>();
|
|
|
|
|
+ integers.add(recordId);
|
|
|
sendCountMap.put(usersId, integers);
|
|
sendCountMap.put(usersId, integers);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2771,94 +2818,102 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
ArrayList<MaintenanceWorkerVo> vos = new ArrayList<>();
|
|
ArrayList<MaintenanceWorkerVo> vos = new ArrayList<>();
|
|
|
|
|
|
|
|
users.forEach(repairUser -> {
|
|
users.forEach(repairUser -> {
|
|
|
- MaintenanceWorkerVo maintenanceWorkerVo = new MaintenanceWorkerVo();
|
|
|
|
|
|
|
+ MaintenanceWorkerVo maintenanceWorkerVo = new MaintenanceWorkerVo();
|
|
|
// 名字
|
|
// 名字
|
|
|
- maintenanceWorkerVo.setName(repairUser.getUserName());
|
|
|
|
|
|
|
+ maintenanceWorkerVo.setName(repairUser.getUserName());
|
|
|
|
|
|
|
|
// 学校
|
|
// 学校
|
|
|
- Integer schoolId = repairUser.getSchoolId();
|
|
|
|
|
- for (RepairSchool repairSchool : schoolList) {
|
|
|
|
|
- Integer id = repairSchool.getId();
|
|
|
|
|
- if (id.equals(schoolId)) {
|
|
|
|
|
- maintenanceWorkerVo.setSchoolName(repairSchool.getName());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Integer schoolId = repairUser.getSchoolId();
|
|
|
|
|
+ for (RepairSchool repairSchool : schoolList) {
|
|
|
|
|
+ Integer id = repairSchool.getId();
|
|
|
|
|
+ if (id.equals(schoolId)) {
|
|
|
|
|
+ maintenanceWorkerVo.setSchoolName(repairSchool.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- Integer id = repairUser.getId();
|
|
|
|
|
|
|
+ Integer id = repairUser.getId();
|
|
|
// 工单集合
|
|
// 工单集合
|
|
|
- List<Integer> recordsList = receivingCountMap.get(id);
|
|
|
|
|
- int size = recordsList.size();
|
|
|
|
|
- BigDecimal b = new BigDecimal(size);
|
|
|
|
|
|
|
+ List<Integer> recordsList = receivingCountMap.get(id);
|
|
|
|
|
+ int size = recordsList.size();
|
|
|
|
|
+ BigDecimal b = new BigDecimal(size);
|
|
|
|
|
|
|
|
// 工单总数
|
|
// 工单总数
|
|
|
- maintenanceWorkerVo.setWorkOrderTotal(size);
|
|
|
|
|
|
|
+ maintenanceWorkerVo.setWorkOrderTotal(size);
|
|
|
|
|
|
|
|
// 超时率
|
|
// 超时率
|
|
|
- if (maintainTimeOutMap.containsKey(id)) {
|
|
|
|
|
- Integer integer = maintainTimeOutMap.get(id);
|
|
|
|
|
- BigDecimal a = new BigDecimal(integer);
|
|
|
|
|
- BigDecimal c = b;
|
|
|
|
|
|
|
+ if (maintainTimeOutMap.containsKey(id)) {
|
|
|
|
|
+ Integer integer = maintainTimeOutMap.get(id);
|
|
|
|
|
+ BigDecimal a = new BigDecimal(integer);
|
|
|
|
|
+ BigDecimal c = b;
|
|
|
// 接单
|
|
// 接单
|
|
|
- if (sendTimeOutMap.containsKey(id)) {
|
|
|
|
|
- Integer integer1 = sendTimeOutMap.get(id);
|
|
|
|
|
- BigDecimal bigDecimal = new BigDecimal(integer1);
|
|
|
|
|
- a = a.add(bigDecimal);
|
|
|
|
|
- List<Integer> integers = sendCountMap.get(id);
|
|
|
|
|
- c = c.add(new BigDecimal(integers.size()));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (sendTimeOutMap.containsKey(id)) {
|
|
|
|
|
+ Integer integer1 = sendTimeOutMap.get(id);
|
|
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(integer1);
|
|
|
|
|
+ a = a.add(bigDecimal);
|
|
|
|
|
+ List<Integer> integers = sendCountMap.get(id);
|
|
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(integers.size());
|
|
|
|
|
+ c = c.add(bigDecimal1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- BigDecimal bigDecimal = a.divide(c, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
- BigDecimal multiply = bigDecimal.multiply(new BigDecimal(100));
|
|
|
|
|
- maintenanceWorkerVo.setTimeOut(multiply + "%");
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ BigDecimal bigDecimal = a.divide(c, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ BigDecimal multiply = bigDecimal.multiply(new BigDecimal(100));
|
|
|
|
|
+ maintenanceWorkerVo.setTimeOut(multiply + "%");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 平均维修时间
|
|
// 平均维修时间
|
|
|
- Long aLong = maintainMap.get(id);
|
|
|
|
|
- BigDecimal bigDecimal = new BigDecimal(aLong);
|
|
|
|
|
- BigDecimal maintain = bigDecimal.divide(b, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
- maintenanceWorkerVo.setMaintain(maintain);
|
|
|
|
|
-
|
|
|
|
|
- // 平均响应时长
|
|
|
|
|
- if (sendMap.containsKey(id)) {
|
|
|
|
|
- Long aLong1 = sendMap.get(id);
|
|
|
|
|
- BigDecimal bigDecimal1 = new BigDecimal(aLong1);
|
|
|
|
|
- List<Integer> integers = sendCountMap.get(id);
|
|
|
|
|
- BigDecimal bigDecimal2 = new BigDecimal(integers.size());
|
|
|
|
|
- BigDecimal send = bigDecimal1.divide(bigDecimal2, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
- maintenanceWorkerVo.setAnswer(send);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Long aLong = maintainMap.get(id);
|
|
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(aLong);
|
|
|
|
|
+ BigDecimal maintain = bigDecimal.divide(b, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ maintenanceWorkerVo.setMaintain(maintain);
|
|
|
|
|
+
|
|
|
|
|
+ // 平均响应时长
|
|
|
|
|
+ if (sendMap.containsKey(id)) {
|
|
|
|
|
+ Long aLong1 = sendMap.get(id);
|
|
|
|
|
+ BigDecimal bigDecimal1 = new BigDecimal(aLong1);
|
|
|
|
|
+ List<Integer> integers = sendCountMap.get(id);
|
|
|
|
|
+ if (integers.size()<=0) {
|
|
|
|
|
+ maintenanceWorkerVo.setAnswer(null);
|
|
|
|
|
+ }else {
|
|
|
|
|
+ BigDecimal bigDecimal2 = new BigDecimal(integers.size());
|
|
|
|
|
+ BigDecimal send = bigDecimal1.divide(bigDecimal2, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
|
|
+ maintenanceWorkerVo.setAnswer(send);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
// 总费用
|
|
// 总费用
|
|
|
- LambdaQueryWrapper<RepairRecord> recordWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- recordWrapper.in(RepairRecord::getId, recordsList);
|
|
|
|
|
-
|
|
|
|
|
- List<RepairRecord> list = repairRecordService.list(recordWrapper);
|
|
|
|
|
- BigDecimal totalPrice = new BigDecimal(0);
|
|
|
|
|
- for (RepairRecord repairRecord : list) {
|
|
|
|
|
- BigDecimal price = repairRecord.getPrice();
|
|
|
|
|
- if (ObjectUtils.isNotEmpty(price)) {
|
|
|
|
|
- totalPrice = totalPrice.add(price);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- maintenanceWorkerVo.setTotalPrice(totalPrice);
|
|
|
|
|
|
|
+ LambdaQueryWrapper<RepairRecord> recordWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ recordWrapper.in(RepairRecord::getId, recordsList);
|
|
|
|
|
+
|
|
|
|
|
+ List<RepairRecord> list = repairRecordService.list(recordWrapper);
|
|
|
|
|
+ BigDecimal totalPrice = new BigDecimal(0);
|
|
|
|
|
+ for (RepairRecord repairRecord : list) {
|
|
|
|
|
+ BigDecimal price = repairRecord.getPrice();
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(price)) {
|
|
|
|
|
+ totalPrice = totalPrice.add(price);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ maintenanceWorkerVo.setTotalPrice(totalPrice);
|
|
|
|
|
|
|
|
// 好评率
|
|
// 好评率
|
|
|
- LambdaQueryWrapper<RepairEvaluate> evaluateWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- evaluateWrapper.in(RepairEvaluate::getRecordId, recordsList);
|
|
|
|
|
|
|
+ LambdaQueryWrapper<RepairEvaluate> evaluateWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ evaluateWrapper.in(RepairEvaluate::getRecordId, recordsList);
|
|
|
// 根据工单id来查询对应的评价
|
|
// 根据工单id来查询对应的评价
|
|
|
- List<RepairEvaluate> repairEvaluates = repairEvaluateService.list(evaluateWrapper);
|
|
|
|
|
- BigDecimal evaluatesDecimal = new BigDecimal(repairEvaluates.size());
|
|
|
|
|
- BigDecimal satisfaction = new BigDecimal(0);
|
|
|
|
|
- for (RepairEvaluate repairEvaluate : repairEvaluates) {
|
|
|
|
|
- Integer star = repairEvaluate.getStar();
|
|
|
|
|
- if (star > 3) {
|
|
|
|
|
- satisfaction = satisfaction.add(new BigDecimal(1));
|
|
|
|
|
|
|
+ List<RepairEvaluate> repairEvaluates = repairEvaluateService.list(evaluateWrapper);
|
|
|
|
|
+ if (ObjectUtils.isEmpty(repairEvaluates) && repairEvaluates.size() <= 0) {
|
|
|
|
|
+ maintenanceWorkerVo.setDegreePraise(0 + "%");
|
|
|
|
|
+ } else{
|
|
|
|
|
+ BigDecimal evaluatesDecimal = new BigDecimal(repairEvaluates.size());
|
|
|
|
|
+ BigDecimal satisfaction = new BigDecimal(0);
|
|
|
|
|
+ for (RepairEvaluate repairEvaluate : repairEvaluates) {
|
|
|
|
|
+ Integer star = repairEvaluate.getStar();
|
|
|
|
|
+ if (star > 3) {
|
|
|
|
|
+ satisfaction = satisfaction.add(new BigDecimal(1));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ BigDecimal degreePraise = satisfaction.divide(evaluatesDecimal, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
+ maintenanceWorkerVo.setDegreePraise(degreePraise + "%");
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- BigDecimal degreePraise = satisfaction.divide(evaluatesDecimal, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100));
|
|
|
|
|
- maintenanceWorkerVo.setDegreePraise(degreePraise + "%");
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
vos.add(maintenanceWorkerVo);
|
|
vos.add(maintenanceWorkerVo);
|
|
|
|
|
|
|
@@ -3395,6 +3450,17 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
return CommonResult.ok(vos);
|
|
return CommonResult.ok(vos);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 总数据分析
|
|
|
|
|
+ * @return
|
|
|
|
|
+ * @throws Exception
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult repairTotalData() throws Exception {
|
|
|
|
|
+ RepairTotalDataVo vo=repairRecordService.repairTotalData();
|
|
|
|
|
+ return CommonResult.ok(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public CommonResult mobileReply(MobileRevertRequest mrr, BindingResult bindingResult) throws Exception {
|
|
public CommonResult mobileReply(MobileRevertRequest mrr, BindingResult bindingResult) throws Exception {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
@@ -3519,6 +3585,75 @@ public class RepairRecordController implements RepairRecordControllerAPI {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
|
|
+ public CommonResult closePCOrder(int recordId, String userhead, String reason) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ //获取订单
|
|
|
|
|
+ RepairRecord recordData = repairRecordService.getRepairById(recordId);
|
|
|
|
|
+ if (recordData == null) {
|
|
|
|
|
+ return CommonResult.fail("订单不存在,关单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //待接单才能关单
|
|
|
|
|
+ if (recordData.getMaintenanceState() != eRecordStatu.Dispatch.getValue()) {
|
|
|
|
|
+ return CommonResult.fail("待接单状态的工单才能关闭");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ String userID = AesUtils.decrypt(userhead);
|
|
|
|
|
+ RepairAdmin operateData = repairAdminService.getRepairById(userID);
|
|
|
|
|
+ if (operateData == null) {
|
|
|
|
|
+ return CommonResult.fail("操作人信息不合法,无法进行关单!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //发送人
|
|
|
|
|
+ Integer userId = 0;//超级管理员用ID为0
|
|
|
|
|
+ if (!operateData.getIsSuper().equals(eIsSuper.Super.getValue())) {
|
|
|
|
|
+ RepairUser user = repairUserService.getRepairByCardNumber(operateData.getCardNumber());
|
|
|
|
|
+ if (user == null) {
|
|
|
|
|
+ return CommonResult.fail("管理端账号未与移动端账号绑定,无法进行关单!");
|
|
|
|
|
+ }
|
|
|
|
|
+ userId = user.getId();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ //将工单状态更新为维修中
|
|
|
|
|
+ recordData.setCustomsOfficerId(userId.toString());
|
|
|
|
|
+ recordData.setRemark(reason);
|
|
|
|
|
+ recordData.setMaintenanceState(eRecordStatu.Closed.getValue());
|
|
|
|
|
+ int updateRecord = repairRecordService.updateRepairRecord(recordData);
|
|
|
|
|
+ if (updateRecord <= 0) {
|
|
|
|
|
+ return CommonResult.fail("关单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ RepairSystemMessages rsm = new RepairSystemMessages();
|
|
|
|
|
+ rsm.setIsRead(0);
|
|
|
|
|
+ rsm.setRecordId(recordId);
|
|
|
|
|
+ rsm.setRecipientId(recordData.getUserId());
|
|
|
|
|
+ rsm.setContent("工单已被师傅关闭,关单原因为:" + reason + "!");
|
|
|
|
|
+ int insertRsm = repairSystemMessagesService.insertRepairSystemMessages(rsm);
|
|
|
|
|
+ if (insertRsm <= 0) {
|
|
|
|
|
+ throw new Exception("关单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //添加跟踪记录
|
|
|
|
|
+ RepairTrackRecord rtr = new RepairTrackRecord();
|
|
|
|
|
+ rtr.setRecordId(recordId);
|
|
|
|
|
+ rtr.setMaintenanceState(eRecordStatu.Closed.getValue());
|
|
|
|
|
+ rtr.setContent("订单关闭");
|
|
|
|
|
+ rtr.setUserId(Integer.valueOf(userId));
|
|
|
|
|
+ rtr.setUserZzstr("技术员");
|
|
|
|
|
+ int insertRtr = repairTrackRecordService.insertRepairTrackRecord(rtr);
|
|
|
|
|
+ if (insertRtr <= 0) {
|
|
|
|
|
+ throw new Exception("关单失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ throw new Exception("关单失败!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return CommonResult.ok("关单成功");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Transactional(rollbackFor = {Exception.class})
|
|
|
public CommonResult finishOrder(finishOrderRequest data, @RequestHeader("user_head") String userhead, BindingResult bindingResult) throws Exception {
|
|
public CommonResult finishOrder(finishOrderRequest data, @RequestHeader("user_head") String userhead, BindingResult bindingResult) throws Exception {
|
|
|
try {
|
|
try {
|
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|