Browse Source

新增订单项目的时候,判定修改,提示修改

anderx 1 year ago
parent
commit
3957e2be7b

+ 17 - 4
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -236,14 +236,27 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			order.setTotalAmount(order.getTotalAmount());
 		}
 		RestrictProject outRestrictProjects = restrictProjectMapper.selectByParam(new InputRestrictProject(order.getBuyerId(), TokenManager.getAdminId(), t.getCommodityId()));
+		//没有限定或为公共时
 		if (outRestrictProjects==null||outRestrictProjects.getType()==0){
 			User user = userMapper.selectByPrimaryKey(order.getBuyerId());
-			if (user.getShareType()==2&&user.getAid().equals(AFTConstants.CAOJIN_AID)){
-				throw new BusinessException("该项目已为他人限定项目,无法创建");
-			}else {
-				throw new BusinessException("该项目已为公共限定项目,请先领取");
+			//客户归属不属自己
+			if (!user.getAid().equals(TokenManager.getAdminId())){
+				//是签单 是曹津
+				if (user.getShareType()==2&&user.getAid().equals(AFTConstants.CAOJIN_AID)){
+					throw new BusinessException("该项目已为他人限定项目,无法创建");
+				}else if (user.getShareType()==2&&!user.getAid().equals(AFTConstants.CAOJIN_AID)){
+					//是签单 不是曹津
+					BusinessProject businessProject = businessProjectMapper.selectByPrimaryKey(t.getCommodityId());
+					//判定是否是限定项目
+					if (businessProject.getRestrictStatus()==1){
+						throw new BusinessException("该项目已为公共限定项目,请先领取");
+					}else {
+						throw new BusinessException("该客户为他人签单,您只能签订限定项目");
+					}
+				}
 			}
 		}else  if (!outRestrictProjects.getAid().equals(TokenManager.getAdminId())){
+			//有限定但不是自己的
 			throw new BusinessException("该项目已为他人限定项目,无法创建");
 		}