|
|
@@ -685,12 +685,17 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
order.setItemCompletionFactor(orderScoreInfo.getItemCompletionFactor());
|
|
|
order.setModifyReason(orderScoreInfo.getModifyReason());
|
|
|
order.setReviewScoreNum(orderScoreInfo.getReviewScoreNum());
|
|
|
- if(orderScoreInfo.getReviewScoreNum() == 1){
|
|
|
+ /*if(orderScoreInfo.getReviewScoreNum() == 1){
|
|
|
order.setScoringStatus("to_confirm");
|
|
|
}else if(orderScoreInfo.getReviewScoreNum() == 2){
|
|
|
order.setScoringStatus("to_final");
|
|
|
+ }*/
|
|
|
+ if(oldOrder.getRestartTime() != null){
|
|
|
+ order.setScoringStatus("archived");
|
|
|
+ order.setWorkOrderStatus("archived");
|
|
|
+ }else{
|
|
|
+ order.setScoringStatus("to_archive");
|
|
|
}
|
|
|
-
|
|
|
// 计算复评总分并设置到工单对象
|
|
|
if (orderScoreInfo.getScorePersonList() != null) {
|
|
|
double totalScore = orderScoreInfo.getScorePersonList().stream()
|
|
|
@@ -709,6 +714,7 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
GxtWorkOrderPerson workPerson = new GxtWorkOrderPerson();
|
|
|
workPerson.setId(person.getId());
|
|
|
workPerson.setReviewScore(person.getReviewScore());
|
|
|
+ workPerson.setScore(person.getReviewScore() != null ? BigDecimal.valueOf(person.getReviewScore()) : null);
|
|
|
personList.add(workPerson);
|
|
|
}
|
|
|
gxtWorkOrderService.updateWorkOrderPersonList(personList);
|
|
|
@@ -728,7 +734,22 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
flow.setActionTime(DateUtils.getNowDate());
|
|
|
flow.setActionRemark("提交复评");
|
|
|
gxtWorkOrderFlowService.insertGxtWorkOrderFlow(flow);
|
|
|
-
|
|
|
+ if("archived".equals(order.getWorkOrderStatus())){
|
|
|
+ // 添加归档流程记录
|
|
|
+ flow = new GxtWorkOrderFlow();
|
|
|
+ flow.setOrderId(order.getId());
|
|
|
+ flow.setOrderCode(orderScoreInfo.getWorkOrderProjectNo());
|
|
|
+ flow.setActionType("archive");
|
|
|
+ flow.setFromStatus("to_archive");
|
|
|
+ flow.setToStatus("archived");
|
|
|
+ flow.setOperatorId(1L); // 系统自动操作,使用系统用户ID
|
|
|
+ flow.setOperatorName("系统自动");
|
|
|
+ flow.setActionTime(DateUtils.getNowDate());
|
|
|
+ flow.setActionRemark("系统自动归档工单");
|
|
|
+ gxtWorkOrderFlowService.insertGxtWorkOrderFlow(flow);
|
|
|
+ }
|
|
|
+ // 更新月度统计数据
|
|
|
+ updateMonthlyScoreData(orderScoreInfo);
|
|
|
return result;
|
|
|
}
|
|
|
return 0;
|
|
|
@@ -886,7 +907,7 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
}
|
|
|
|
|
|
// 更新月度统计数据
|
|
|
- updateMonthlyScoreData(orderScoreInfo);
|
|
|
+ updateMonthlyScoreDataForFinalEval(orderScoreInfo);
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -1324,8 +1345,31 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
}
|
|
|
}
|
|
|
} else if (orderScoreInfo.getOrderType() == 2) {
|
|
|
- // 维保工单保持不变
|
|
|
- updateMonthlyScoreData(orderScoreInfo);
|
|
|
+ // 维保工单
|
|
|
+ GxtWorkOrder order = gxtWorkOrderService.selectGxtWorkOrderById(orderScoreInfo.getId());
|
|
|
+ // 获取工单完成时间所在的月份
|
|
|
+ if (order.getCreateTime() != null) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
+ String monthPeriod = sdf.format(order.getCreateTime());
|
|
|
+
|
|
|
+ // 获取场站ID
|
|
|
+ Long deptId = order.getPcsStationPid();
|
|
|
+
|
|
|
+ // 获取月度统计信息
|
|
|
+ GxtMonthScore queryScore = new GxtMonthScore();
|
|
|
+ queryScore.setDeptId(deptId);
|
|
|
+ queryScore.setMonthPeriod(monthPeriod);
|
|
|
+ List<GxtMonthScore> scoreList = gxtMonthScoreService.selectGxtMonthScoreList(queryScore);
|
|
|
+ GxtMonthScore monthScore = null;
|
|
|
+ if (!scoreList.isEmpty()) {
|
|
|
+ monthScore = scoreList.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (monthScore != null) {
|
|
|
+ // 仅更新用户评分统计(基于reviewScore和finalScore的差值)
|
|
|
+ updateUserScoresForFinalEval(monthScore, order);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -1383,7 +1427,60 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新用户评分统计(终评专用版本,基于reviewScore和finalScore的差值)- 维保工单版本
|
|
|
+ * @param monthScore 月度统计信息
|
|
|
+ * @param order 工单对象
|
|
|
+ */
|
|
|
+ private void updateUserScoresForFinalEval(GxtMonthScore monthScore, GxtWorkOrder order) {
|
|
|
+ try {
|
|
|
+ // 获取参与该工单的所有人员(当前数据库中的最新数据)
|
|
|
+ List<GxtWorkOrderPerson> orderPersons = gxtWorkOrderService.selectWorkOrderPersonListByOrderId(order.getId());
|
|
|
+
|
|
|
+ // 获取现有的用户评分统计列表
|
|
|
+ GxtUserScore queryUserScore = new GxtUserScore();
|
|
|
+ queryUserScore.setMonthScoreId(monthScore.getId());
|
|
|
+ List<GxtUserScore> userScores = gxtUserScoreService.selectGxtUserScoreList(queryUserScore);
|
|
|
+
|
|
|
+ if (userScores != null && !orderPersons.isEmpty()) {
|
|
|
+ // 遍历工单中的每个人员
|
|
|
+ for (GxtWorkOrderPerson orderPerson : orderPersons) {
|
|
|
+ // 计算差值:finalScore - reviewScore
|
|
|
+ Double reviewScore = orderPerson.getReviewScore() != null ? orderPerson.getReviewScore() : 0.0;
|
|
|
+ Double finalScore = orderPerson.getFinalScore() != null ? orderPerson.getFinalScore() : 0.0;
|
|
|
+ BigDecimal scoreDiff = new BigDecimal(String.valueOf(finalScore - reviewScore));
|
|
|
+
|
|
|
+ // 在月度统计中查找该用户
|
|
|
+ for (GxtUserScore userScore : userScores) {
|
|
|
+ // 使用userName进行匹配
|
|
|
+ if (orderPerson.getNickName() != null && orderPerson.getNickName().equals(userScore.getUserName())) {
|
|
|
+ // 更新用户得分(加上差值)
|
|
|
+ BigDecimal currentMaintenanceTotalScore = (userScore.getMaintenanceTotalScore() != null) ?
|
|
|
+ userScore.getMaintenanceTotalScore() : BigDecimal.ZERO;
|
|
|
+
|
|
|
+ userScore.setMaintenanceTotalScore(currentMaintenanceTotalScore.add(scoreDiff));
|
|
|
+
|
|
|
+ // 更新最终评分
|
|
|
+ BigDecimal repairTotalScore = (userScore.getRepairTotalScore() != null) ?
|
|
|
+ userScore.getRepairTotalScore() : BigDecimal.ZERO;
|
|
|
+
|
|
|
+ BigDecimal finalScoreTotal = repairTotalScore.add(currentMaintenanceTotalScore).add(scoreDiff);
|
|
|
+ userScore.setFinalScore(finalScoreTotal);
|
|
|
+ userScore.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ userScore.setUpdateTime(new Date());
|
|
|
+ // 更新用户评分统计
|
|
|
+ gxtUserScoreService.updateGxtUserScore(userScore);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存确认信息
|
|
|
*
|
|
|
@@ -1547,35 +1644,70 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
@Transactional
|
|
|
public int appeal(OrderScoreInfo orderScoreInfo) {
|
|
|
try {
|
|
|
- GxtRepairOrder order = gxtRepairOrderService.selectGxtRepairOrderById(orderScoreInfo.getId());
|
|
|
-
|
|
|
- // 更新工单状态为申诉中
|
|
|
- GxtRepairOrder updateOrder = new GxtRepairOrder();
|
|
|
- updateOrder.setId(orderScoreInfo.getId());
|
|
|
- updateOrder.setConfirmStatus(3); // 使用confirmStatus字段标记为已申诉(值为3)
|
|
|
- updateOrder.setAppealReason(orderScoreInfo.getAppealReason());
|
|
|
- updateOrder.setScoringStatus("appealing"); // 申诉中状态
|
|
|
- updateOrder.setAppealUserId(SecurityUtils.getUserId());
|
|
|
- updateOrder.setAppealUserName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
- updateOrder.setAppealTime(DateUtils.getNowDate());
|
|
|
- int result = gxtRepairOrderService.updateGxtRepairOrderForScore(updateOrder);
|
|
|
-
|
|
|
- // 添加工单流转记录
|
|
|
- GxtRepairOrderFlow flow = new GxtRepairOrderFlow();
|
|
|
- flow.setOrderId(orderScoreInfo.getId());
|
|
|
- flow.setOrderCode(order.getWorkOrderProjectNo());
|
|
|
- flow.setActionType("appealRating");
|
|
|
- flow.setFromStatus(order.getWorkOrderStatus());
|
|
|
- flow.setToStatus(order.getWorkOrderStatus());
|
|
|
- flow.setFromScoreStatus(order.getScoringStatus());
|
|
|
- flow.setToScoreStatus("appealing");
|
|
|
- flow.setOperatorId(SecurityUtils.getUserId());
|
|
|
- flow.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
- flow.setActionTime(DateUtils.getNowDate());
|
|
|
- flow.setActionRemark("发起申诉:" + orderScoreInfo.getAppealReason());
|
|
|
- repairOrderFlowService.insertGxtRepairOrderFlow(flow);
|
|
|
-
|
|
|
- return result;
|
|
|
+ if (orderScoreInfo.getOrderType() == 1) {
|
|
|
+ // 维修工单申诉
|
|
|
+ GxtRepairOrder order = gxtRepairOrderService.selectGxtRepairOrderById(orderScoreInfo.getId());
|
|
|
+
|
|
|
+ // 更新工单状态为申诉中
|
|
|
+ GxtRepairOrder updateOrder = new GxtRepairOrder();
|
|
|
+ updateOrder.setId(orderScoreInfo.getId());
|
|
|
+ updateOrder.setConfirmStatus(3); // 使用confirmStatus字段标记为已申诉(值为3)
|
|
|
+ updateOrder.setAppealReason(orderScoreInfo.getAppealReason());
|
|
|
+ updateOrder.setScoringStatus("appealing"); // 申诉中状态
|
|
|
+ updateOrder.setAppealUserId(SecurityUtils.getUserId());
|
|
|
+ updateOrder.setAppealUserName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ updateOrder.setAppealTime(DateUtils.getNowDate());
|
|
|
+ int result = gxtRepairOrderService.updateGxtRepairOrderForScore(updateOrder);
|
|
|
+
|
|
|
+ // 添加工单流转记录
|
|
|
+ GxtRepairOrderFlow flow = new GxtRepairOrderFlow();
|
|
|
+ flow.setOrderId(orderScoreInfo.getId());
|
|
|
+ flow.setOrderCode(order.getWorkOrderProjectNo());
|
|
|
+ flow.setActionType("appealRating");
|
|
|
+ flow.setFromStatus(order.getWorkOrderStatus());
|
|
|
+ flow.setToStatus(order.getWorkOrderStatus());
|
|
|
+ flow.setFromScoreStatus(order.getScoringStatus());
|
|
|
+ flow.setToScoreStatus("appealing");
|
|
|
+ flow.setOperatorId(SecurityUtils.getUserId());
|
|
|
+ flow.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ flow.setActionTime(DateUtils.getNowDate());
|
|
|
+ flow.setActionRemark("发起申诉:" + orderScoreInfo.getAppealReason());
|
|
|
+ repairOrderFlowService.insertGxtRepairOrderFlow(flow);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ } else if (orderScoreInfo.getOrderType() == 2) {
|
|
|
+ // 维保工单申诉
|
|
|
+ GxtWorkOrder order = gxtWorkOrderService.selectGxtWorkOrderById(orderScoreInfo.getId());
|
|
|
+
|
|
|
+ // 更新工单状态为申诉中
|
|
|
+ GxtWorkOrder updateOrder = new GxtWorkOrder();
|
|
|
+ updateOrder.setId(orderScoreInfo.getId());
|
|
|
+ updateOrder.setConfirmStatus(3); // 使用confirmStatus字段标记为已申诉(值为3)
|
|
|
+ updateOrder.setAppealReason(orderScoreInfo.getAppealReason());
|
|
|
+ updateOrder.setScoringStatus("appealing"); // 申诉中状态
|
|
|
+ updateOrder.setAppealUserId(SecurityUtils.getUserId());
|
|
|
+ updateOrder.setAppealUserName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ updateOrder.setAppealTime(DateUtils.getNowDate());
|
|
|
+ int result = gxtWorkOrderService.updateGxtWorkOrderForScore(updateOrder);
|
|
|
+
|
|
|
+ // 添加工单流转记录
|
|
|
+ GxtWorkOrderFlow flow = new GxtWorkOrderFlow();
|
|
|
+ flow.setOrderId(orderScoreInfo.getId());
|
|
|
+ flow.setOrderCode(order.getWorkOrderProjectNo());
|
|
|
+ flow.setActionType("appealRating");
|
|
|
+ flow.setFromStatus(order.getWorkOrderStatus());
|
|
|
+ flow.setToStatus(order.getWorkOrderStatus());
|
|
|
+ flow.setFromScoreStatus(order.getScoringStatus());
|
|
|
+ flow.setToScoreStatus("appealing");
|
|
|
+ flow.setOperatorId(SecurityUtils.getUserId());
|
|
|
+ flow.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
+ flow.setActionTime(DateUtils.getNowDate());
|
|
|
+ flow.setActionRemark("发起申诉:" + orderScoreInfo.getAppealReason());
|
|
|
+ gxtWorkOrderFlowService.insertGxtWorkOrderFlow(flow);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException("发起申诉失败:" + e.getMessage(), e);
|
|
|
}
|