|
|
@@ -3,6 +3,7 @@ package com.goafanti.customer.controller;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.lang.reflect.InvocationTargetException;
|
|
|
+import java.lang.reflect.Type;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
@@ -53,6 +54,8 @@ public class AdminCustomerApiController extends BaseApiController{
|
|
|
private AttachmentService aftFileService;
|
|
|
@Value(value = "${upload.private.path}")
|
|
|
private String uploadPrivatePath = null;
|
|
|
+ @Value(value = "${user.receive.max}")
|
|
|
+ private Integer USER_RECEIVE_MAX = null;
|
|
|
@Resource
|
|
|
private AdminService adminService;
|
|
|
|
|
|
@@ -323,7 +326,7 @@ public class AdminCustomerApiController extends BaseApiController{
|
|
|
res.getError().add(buildError("","创建客户参数不全"));
|
|
|
return res;
|
|
|
}
|
|
|
- if (customerService.checkMax(TokenManager.getAdminId())) {
|
|
|
+ if (customerService.checkMax(null,TokenManager.getAdminId())) {
|
|
|
res.getError().add(buildError("","私有客户已达最大限制"));
|
|
|
return res;
|
|
|
}
|
|
|
@@ -622,24 +625,36 @@ public class AdminCustomerApiController extends BaseApiController{
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
- /** 领取客户 **/
|
|
|
+ /**
|
|
|
+ * 领取客户
|
|
|
+ * @param uid 客户编号
|
|
|
+ * @param oldAid 原来的客户归属人
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@RequestMapping(value = "/receiveCustomer", method = RequestMethod.GET)
|
|
|
- public Result receiveCustomer(String uid,String oldAid){
|
|
|
+ public Result receiveCustomer(String uid, String oldAid) {
|
|
|
Result res = new Result();
|
|
|
- if(StringUtils.isBlank(uid) || StringUtils.isBlank("oldAid")){
|
|
|
+ if (StringUtils.isBlank(uid) || StringUtils.isBlank("oldAid")) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, ""));
|
|
|
return res;
|
|
|
}
|
|
|
- if (customerService.checkMax(TokenManager.getAdminId())) {
|
|
|
- res.getError().add(buildError("","私有客户已达最大限制"));
|
|
|
+
|
|
|
+ if (customerService.receiveEveryDay(uid)){
|
|
|
+ res.getError().add(buildError(ErrorConstants.CUSTOM_EREXCESS, USER_RECEIVE_MAX.toString(),USER_RECEIVE_MAX.toString()));
|
|
|
+ return res;
|
|
|
+
|
|
|
+ }
|
|
|
+ if (customerService.checkMax(uid,TokenManager.getAdminId())) {
|
|
|
+ res.getError().add(buildError("", "私有客户已达最大限制"));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
if (customerService.checkBeforeChannel(uid)) {
|
|
|
- res.getError().add(buildError("","渠道客户丢失后不可再领取"));
|
|
|
+ res.getError().add(buildError("", "外联客户丢失后不可再领取"));
|
|
|
return res;
|
|
|
}
|
|
|
- customerService.updateByOperatorType(uid,null, oldAid,AFTConstants.USER_RECEIVE,null);
|
|
|
+
|
|
|
+ customerService.updateByOperatorType(uid, null, oldAid, AFTConstants.USER_RECEIVE, null);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -873,7 +888,7 @@ public class AdminCustomerApiController extends BaseApiController{
|
|
|
operatorType=AFTConstants.USER_TRANSFER_TO_OTHER;
|
|
|
}
|
|
|
if ((operatorType ==AFTConstants.USER_TRANSFER_TO_OTHER||operatorType ==AFTConstants.USER_RECEIVE)
|
|
|
- && customerService.checkMax(aid)) {
|
|
|
+ && customerService.checkMax(uid,aid)) {
|
|
|
res.getError().add(buildError("","对方私有客户已达最大限制"));
|
|
|
return res;
|
|
|
}
|