Prechádzať zdrojové kódy

工单自评、复评添加后端验证

ouyj 3 mesiacov pred
rodič
commit
59fdd07c7e

+ 13 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtOrderScoreServiceImpl.java

@@ -4,6 +4,7 @@ import com.ygtx.common.constant.CacheConstants;
 import com.ygtx.common.constant.Constants;
 import com.ygtx.common.core.domain.entity.SysDept;
 import com.ygtx.common.core.redis.RedisCache;
+import com.ygtx.common.exception.ServiceException;
 import com.ygtx.common.utils.DateUtils;
 import com.ygtx.common.utils.SecurityUtils;
 import com.ygtx.common.utils.StringUtils;
@@ -526,6 +527,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
         try {
             if (orderScoreInfo.getOrderType() == 1) {
                 GxtRepairOrder oldOrder = gxtRepairOrderService.selectGxtRepairOrderById(orderScoreInfo.getId());
+                if(!oldOrder.getScoringStatus().equals("to_self") && !oldOrder.getScoringStatus().equals("returned") ){
+                    throw new ServiceException("该工单状态已变更,不能自评!");
+                }
                 // 维修工单自评
                 GxtRepairOrder order = new GxtRepairOrder();
                 order.setId(orderScoreInfo.getId());
@@ -579,6 +583,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
                 return result;
             } else if (orderScoreInfo.getOrderType() == 2) {
                 GxtWorkOrder oldOrder = gxtWorkOrderService.selectGxtWorkOrderById(orderScoreInfo.getId());
+                if(!oldOrder.getScoringStatus().equals("to_self") && !oldOrder.getScoringStatus().equals("returned") ){
+                    throw new ServiceException("该工单状态已变更,不能自评!");
+                }
                 // 维保工单自评
                 GxtWorkOrder order = new GxtWorkOrder();
                 order.setId(orderScoreInfo.getId());
@@ -655,6 +662,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
         try {
             if (orderScoreInfo.getOrderType() == 1) {
                 GxtRepairOrder oldOrder = gxtRepairOrderService.selectGxtRepairOrderById(orderScoreInfo.getId());
+                if(!oldOrder.getScoringStatus().equals("to_re")){
+                    throw new ServiceException("该工单状态已变更,不能复评!");
+                }
                 // 维修工单复评
                 GxtRepairOrder order = new GxtRepairOrder();
                 order.setId(orderScoreInfo.getId());
@@ -761,6 +771,9 @@ public class GxtOrderScoreServiceImpl implements IGxtOrderScoreService {
             } else if (orderScoreInfo.getOrderType() == 2) {
                 // 维保工单复评
                 GxtWorkOrder oldOrder = gxtWorkOrderService.selectGxtWorkOrderById(orderScoreInfo.getId());
+                if(!oldOrder.getScoringStatus().equals("to_re")){
+                    throw new ServiceException("该工单状态已变更,不能复评!");
+                }
                 GxtWorkOrder order = new GxtWorkOrder();
                 order.setId(orderScoreInfo.getId());
                 order.setItemCompletionFactor(orderScoreInfo.getItemCompletionFactor());