|
|
@@ -1031,86 +1031,7 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
|
|
|
public int appeal(OrderScoreInfo orderScoreInfo) {
|
|
|
try {
|
|
|
GxtRepairOrder order = gxtRepairOrderService.selectGxtRepairOrderById(orderScoreInfo.getId());
|
|
|
- /*
|
|
|
- // 只有维修工单能发起申诉
|
|
|
- if (orderScoreInfo.getOrderType() != 1) {
|
|
|
- throw new RuntimeException("只有维修工单才能发起申诉");
|
|
|
- }
|
|
|
-
|
|
|
- // 检查申诉时效性(本月工单或上月工单延期5天)
|
|
|
- if (order.getRealEndTime() == null) {
|
|
|
- throw new RuntimeException("工单尚未完成,不能发起申诉");
|
|
|
- }
|
|
|
-
|
|
|
- Calendar now = Calendar.getInstance();
|
|
|
- Calendar orderEnd = Calendar.getInstance();
|
|
|
- orderEnd.setTime(order.getRealEndTime());
|
|
|
-
|
|
|
- // 当前月份和年份
|
|
|
- int currentYear = now.get(Calendar.YEAR);
|
|
|
- int currentMonth = now.get(Calendar.MONTH);
|
|
|
- int currentDay = now.get(Calendar.DAY_OF_MONTH);
|
|
|
-
|
|
|
- // 工单完成月份和年份
|
|
|
- int orderYear = orderEnd.get(Calendar.YEAR);
|
|
|
- int orderMonth = orderEnd.get(Calendar.MONTH);
|
|
|
-
|
|
|
- // 判断是否符合申诉时效
|
|
|
- boolean isValidAppealPeriod = false;
|
|
|
- if (currentYear == orderYear && currentMonth == orderMonth) {
|
|
|
- // 本月工单
|
|
|
- isValidAppealPeriod = true;
|
|
|
- } else if (currentYear == orderYear && currentMonth == orderMonth + 1) {
|
|
|
- // 上月工单,在本月5号之前可申诉
|
|
|
- if (currentDay <= 5) {
|
|
|
- isValidAppealPeriod = true;
|
|
|
- }
|
|
|
- } else if (currentYear == orderYear + 1 && currentMonth == 0 && orderMonth == 11) {
|
|
|
- // 跨年情况:当前1月,工单完成于上年12月,在1月5号之前可申诉
|
|
|
- if (currentDay <= 5) {
|
|
|
- isValidAppealPeriod = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!isValidAppealPeriod) {
|
|
|
- throw new RuntimeException("超出申诉时效,不能发起申诉");
|
|
|
- }
|
|
|
-
|
|
|
- // 检查工单状态是否为"待归档"或"已归档"
|
|
|
- String scoringStatus = order.getScoringStatus();
|
|
|
- if (!"to_archive".equals(scoringStatus) && !"archived".equals(scoringStatus)) {
|
|
|
- throw new RuntimeException("只有状态为\"待归档\"或\"已归档\"的工单才能发起申诉");
|
|
|
- }
|
|
|
-
|
|
|
- // 检查是否已经申诉过(通过confirmStatus字段判断)
|
|
|
- if (order.getConfirmStatus() != null && order.getConfirmStatus() == 3) {
|
|
|
- throw new RuntimeException("该工单已经发起过申诉,不能重复申诉");
|
|
|
- }
|
|
|
-
|
|
|
- // 检查当前用户是否有权限发起申诉(工作负责人或检修人员)
|
|
|
- Long currentUserId = SecurityUtils.getUserId();
|
|
|
- boolean hasPermission = false;
|
|
|
-
|
|
|
- // 检查是否为工作负责人
|
|
|
- if (order.getTeamLeaderId() != null && order.getTeamLeaderId().equals(currentUserId)) {
|
|
|
- hasPermission = true;
|
|
|
- }
|
|
|
-
|
|
|
- // 检查是否为检修人员
|
|
|
- if (!hasPermission) {
|
|
|
- List<GxtRepairOrderPerson> persons = gxtRepairOrderService.selectRepairOrderPersonListByOrderId(orderScoreInfo.getId());
|
|
|
- for (GxtRepairOrderPerson person : persons) {
|
|
|
- if (person.getUserId() != null && person.getUserId().equals(currentUserId)) {
|
|
|
- hasPermission = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if (!hasPermission) {
|
|
|
- throw new RuntimeException("您没有权限对此工单发起申诉");
|
|
|
- }
|
|
|
- */
|
|
|
// 更新工单状态为申诉中
|
|
|
GxtRepairOrder updateOrder = new GxtRepairOrder();
|
|
|
updateOrder.setId(orderScoreInfo.getId());
|