Browse Source

Merge branch 'test' of jishutao/kede-server into prod

anderx 2 years ago
parent
commit
d79b766a9a

+ 3 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -167,4 +167,7 @@ public interface AdminMapper {
     List<AdminCustomerBo > selectByDeps(@Param("depIds") List<Department> depIds,@Param("seniorStaff") Integer seniorStaff);
 
     Admin getAdminByFinanceId(String id);
+
+
+    List<Integer> selectRoleTypeByid(String aid);
 }

+ 5 - 0
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -1219,4 +1219,9 @@
     from department a left join admin b on a.finance_id=b.id
     where a.id= #{id}
   </select>
+  <select id="selectRoleTypeByid" resultType="java.lang.Integer">
+    select b.role_type
+    from user_role a left join `role` b on a.rid =b.id
+    where a.uid = #{aid}
+  </select>
 </mapper>

+ 33 - 36
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -1,32 +1,5 @@
 package com.goafanti.customer.controller;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import com.goafanti.common.utils.*;
-import com.goafanti.core.mybatis.page.Pagination;
-import com.goafanti.customer.bo.*;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.validation.BindingResult;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.goafanti.admin.service.AdminService;
@@ -41,8 +14,29 @@ import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Attachment;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
+import com.goafanti.common.utils.*;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.customer.bo.*;
 import com.goafanti.customer.service.CustomerService;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @RestController
 @RequestMapping("/api/admin/customer")
@@ -660,8 +654,11 @@ public class AdminCustomerApiController extends BaseApiController{
 				res.getError().add(buildError(ErrorConstants.CUSTOM_EREXCESS,  USER_RECEIVE_MAX.toString(),USER_RECEIVE_MAX.toString()));
 				return res;
 			}else if (check==-3){
-				res.getError().add(buildError("", "私有客户已达最大限制"));
-				return res;
+				//客服营销员不限制上线
+				if (!TokenManager.hasRole(AFTConstants.CUSTOMER_SERVICE_SALESMAN)){
+					res.getError().add(buildError("", "私有客户已达最大限制"));
+					return res;
+				}
 			}else if (check==-4){
 				res.getError().add(buildError("", "外联客户丢失后不可再领取"));
 				return res;
@@ -922,13 +919,13 @@ public class AdminCustomerApiController extends BaseApiController{
 			return res;
 		}
 		//默认为私有转交,4为签单转交
-				if (operatorType==null) {
-					operatorType=AFTConstants.USER_TRANSFER_TO_OTHER;
-				}
-		if ((operatorType ==AFTConstants.USER_TRANSFER_TO_OTHER||operatorType ==AFTConstants.USER_RECEIVE)
-				&& customerService.checkMax(uid,aid)) {
-			res.getError().add(buildError("","对方私有客户已达最大限制"));
-			return res;
+		if (operatorType==null) operatorType=AFTConstants.USER_TRANSFER_TO_OTHER;
+		//转交,对方不是客服营销员才需要判断最大限制
+		if (operatorType ==AFTConstants.USER_TRANSFER_TO_OTHER&&(!customerService.checkAid(aid,Integer.valueOf(AFTConstants.CUSTOMER_SERVICE_SALESMAN)))){
+			if (customerService.checkMax(uid,aid)){
+				res.getError().add(buildError("","对方私有客户已达最大限制"));
+				return res;
+			}
 		}
 		if(data==null)data=0;
 		res.setData(customerService.updateByOperatorType(uid, aid, oldAid, operatorType, data));

+ 16 - 9
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -1,21 +1,19 @@
 package com.goafanti.customer.service;
 
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-
 import com.goafanti.common.bo.Result;
-import com.goafanti.customer.bo.*;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
 import com.goafanti.common.bo.userDaysBo;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.OrganizationContactBook;
 import com.goafanti.common.model.User;
 import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.customer.bo.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
 
 public interface CustomerService {
 	/**
@@ -561,4 +559,13 @@ public interface CustomerService {
     Pagination<?> selectUserLastSign(InputSelectUserLastSignBo in);
 
 	Result selectUserLastSignExport(InputSelectUserLastSignBo in);
+
+
+	/**
+	 * 判断管理员角色
+	 * @param aid
+	 * @param roleType
+	 * @return
+	 */
+	boolean checkAid(String aid, Integer roleType);
 }

+ 9 - 4
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -1335,7 +1335,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 			User u=userMapper.selectByPrimaryKey(uid);
 			if (u.getShareType()!=1)return -1;
 			if (u.getNewChannel()==1)return 0;
-
 		}
 		if (userMapper.UserReceiveCount(TokenManager.getAdminId()) >= USER_RECEIVE_MAX)return  -2;
 		if(checkMax(uid,TokenManager.getAdminId()))return -3;
@@ -2256,9 +2255,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 
 	@Override
 	public boolean checkMax(String uid,String aid) {
-		if (TokenManager.hasRole(AFTConstants.CUSTOMER_SERVICE_SALESMAN)){
-			return false;
-		}
 		boolean isUs = false;
 		if (uid !=null &&uid.contains(",")) {
 			isUs = true;
@@ -2749,6 +2745,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return excelUtil.exportExcel(list,"用户最后跟进表",uploadPath);
 	}
 
+	@Override
+	public boolean checkAid(String aid, Integer roleType) {
+		List<Integer> roleTypes = adminMapper.selectRoleTypeByid(aid);
+		for (Integer rt : roleTypes) {
+			if (rt.equals(roleType))return true;
+		}
+		return false;
+	}
+
 	private void pushDays(Pagination<OutUserLastSignBo> p) {
 		List<OutUserLastSignBo> list = (List<OutUserLastSignBo>) p.getList();
 		pushDays(list);

+ 1 - 1
src/main/resources/props/error.properties

@@ -122,7 +122,7 @@ ORDER_CAN_NOT_MODIFY = \u5F53\u524D\u8BA2\u5355{0}\u4E0D\u80FD\u4FEE\u6539
 
 ORDER_ALREADY_FREEZE = \u8BE5\u8BA2\u5355{0}\u5DF2\u7ECF\u51BB\u7ED3
 
-ORDER_ALREADY_REVOKE = \u8BA2\u5355{0}\u5DF2\u7ECF\u9501\u5B9A
+ORDER_ALREADY_REVOKE = \u8BA2\u5355{0}\u6B63\u5728\u53D8\u66F4\u4E2D\uFF08\u5DF2\u9501\u5B9A\uFF09\uFF0C\u8BF7\u5728\u53D8\u66F4\u5B8C\u6210\u540E\uFF0C\u7EE7\u7EED\u64CD\u4F5C
 
 ORDER_NOT_EXIST = \u8BA2\u5355{0}\u4E0D\u5B58\u5728