Procházet zdrojové kódy

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

gitadmin před 1 měsícem
rodič
revize
e40bd2653c

+ 1 - 1
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -110,7 +110,7 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
     public Object list(InputRestrictProject in) {
         in.setAid(TokenManager.getAdminId());
         String aname=null;
-        List<OutRestrictProject> list = restrictProjectMapper.selectByUidAndAid(in);
+        List<OutRestrictProject> list = restrictProjectMapper.selectByAid(in);
         User u = userMapper.queryById(in.getUid());
         for (OutRestrictProject e : list) {
             if (e.getType()==null){

+ 1 - 1
src/main/java/com/goafanti/common/dao/RestrictProjectMapper.java

@@ -36,7 +36,7 @@ public interface RestrictProjectMapper {
      * @param in
      * @return
      */
-    List<OutRestrictProject> selectByUidAndAid(InputRestrictProject in);
+    List<OutRestrictProject> selectByAid(InputRestrictProject in);
 
     List<OutRestrictProject> selectByUid(String id);
 

+ 2 - 2
src/main/java/com/goafanti/common/mapper/RestrictProjectMapper.xml

@@ -120,7 +120,7 @@
 
 
 
-    <select id="selectByUidAndAid" resultType="com.goafanti.business.bo.OutRestrictProject">
+    <select id="selectByAid" resultType="com.goafanti.business.bo.OutRestrictProject">
         select a.id pid ,b.id,a.bname projectName,b.type,b.lock_time lockTime,b.release_time releaseTime ,
                c.nickname userName ,d.name adminName,b.create_time createTime,b.uid,b.aid
         from business_project a
@@ -181,7 +181,7 @@
                c.nickname userName ,d.name adminName,b.create_time createTime,b.uid,b.aid
         from  restrict_project b left join business_project a on b.pid =a.id
                  left join user c on b.uid=c.id left join admin d on b.aid=d.id
-        where  b.aid= #{aid,jdbcType=VARCHAR} and b.type in (1,2)
+        where  b.uid= #{uid,jdbcType=VARCHAR} and b.type in (1,2)
     </select>
     <select id="selectByParam" resultMap="BaseResultMap">
         select

+ 20 - 0
src/main/java/com/goafanti/customer/controller/AdminCustomerApiController.java

@@ -334,6 +334,10 @@ public class AdminCustomerApiController extends BaseApiController{
 			return res;
 		}
 		//判断电话号码
+//		if (customerService.checkContactMobile(in.getContactMobile())>1){
+//			res.getError().add(buildError("电话已经在系统填入多次"));
+//			return res;
+//		}
 		if (!RegexUtils.isMobile(in.getContactMobile())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "联系人电话格式错误", "联系人电话"));
 			return res;
@@ -372,6 +376,10 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("手机号码格式错误"));
 			return res;
 		}
+//		if (customerService.checkContactMobile(in.getContactMobile())>1){
+//			res.getError().add(buildError("电话已经在系统填入多次"));
+//			return res;
+//		}
 		in.setType(1);
 		//新增为私有客户
 		in.setShareType(0);
@@ -1135,6 +1143,14 @@ public class AdminCustomerApiController extends BaseApiController{
 			res.getError().add(buildError("联系人号码和联系人姓名不能为空"));
 			return res;
 		}
+		if (!RegexUtils.isMobile(ocb.getMobile())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "联系人电话格式错误", "联系人电话"));
+			return res;
+		}
+//		if (customerService.checkContactMobile(ocb.getMobile())>1){
+//			res.getError().add(buildError("电话已经在系统填入多次"));
+//			return res;
+//		}
 		customerService.addOneContact(ocb);
 		return res;
 	}
@@ -1705,6 +1721,10 @@ public class AdminCustomerApiController extends BaseApiController{
 				res.getError().add(buildError("","手机号码格式错误"));
 				return res;
 			}
+//			if (customerService.checkContactMobile(in.getContactMobile())>1){
+//				res.getError().add(buildError("电话已经在系统填入多次"));
+//				return res;
+//			}
 		}
 		Result result = receiveCustomer(in.getId(), null);
 		res.getError().addAll(result.getError());

+ 1 - 0
src/main/java/com/goafanti/customer/service/CustomerService.java

@@ -601,4 +601,5 @@ public interface CustomerService {
 
 	Object updateAndReceiveCustomer(InputUpdateAndReceiveCustomer in);
 
+	Integer checkContactMobile(String contactMobile);
 }

+ 7 - 2
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -2930,7 +2930,6 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 	public Pagination<OutChannelListBo> channelUserList(InputChannelListBo in) {
 		Map<String, Object> params = new HashMap<>();
 		addParams(in, params);
-
 		Pagination<OutChannelListBo> p = (Pagination<OutChannelListBo>) findPage(
 				"channelUserList", "channelUserCout", params, in.getPageNo(),
 				in.getPageSize());
@@ -3239,9 +3238,15 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
 		return null;
 	}
 
+    @Override
+    public Integer checkContactMobile(String contactMobile) {
+		List<OrganizationContactBook> organizationContactBooks = organizationContactBookMapper.selectUserByContact(contactMobile);
+		//返回电话录入数量
+		return organizationContactBooks.size();
+    }
 
 
-	private List<InputExcelUser> pushUserName(List<InputExcelUser> list) {
+    private List<InputExcelUser> pushUserName(List<InputExcelUser> list) {
 		List<InputExcelUser> res=new ArrayList<>();
 		List<InputExcelUser> list2=new ArrayList<>();
 		int i = 0;

+ 5 - 0
src/main/java/com/goafanti/order/controller/AdminNewOrderApiController.java

@@ -105,6 +105,11 @@ public class AdminNewOrderApiController extends CertifyApiController {
 			res.getError().add(buildError("订单主要任务已存在","订单主要任务已存在"));
 			return res;
 		}
+		if(orderNewService.checkLimit(in)){
+			res.getError().add(buildError("限定客户订单只能添加限定项目"));
+			return res;
+		}
+
 		return res.data(orderNewService.addOrderTask(in));
 	}
 

+ 2 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -251,4 +251,6 @@ public interface OrderNewService {
     Object pushOrderNewUser();
 
 	void updateOrderUrl(TOrderNew orderNew);
+
+	boolean checkLimit(InputAddTask in);
 }

+ 24 - 0
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -4,6 +4,7 @@ package com.goafanti.order.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.DepartmentService;
+import com.goafanti.business.bo.OutRestrictProject;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.OrderOperator;
@@ -152,6 +153,8 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	private TemporaryReceivablesMapper temporaryReceivablesMapper;
 	@Autowired
 	private ProjectAsyncService projectAsyncService;
+	@Autowired
+	private RestrictProjectMapper restrictProjectMapper;
 
 
 	@Value(value = "${upload.path}")
@@ -2747,4 +2750,25 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		tOrderNewMapper.update(orderNew);
 	}
 
+	@Override
+	public boolean checkLimit(InputAddTask in) {
+		TOrderNewBo orderNewBo = tOrderNewMapper.getOrderNewDetail(in.getOrderNo());
+		if (orderNewBo.getUserType() == 3) {
+			//如果是限定项目订单,则需要判断限定项目是否是开单人的私有或者签单限定
+			List<OutRestrictProject> outRestrictProjects = restrictProjectMapper.selectByUid(orderNewBo.getBuyerId());
+			if (outRestrictProjects != null) {
+				for (OutRestrictProject e : outRestrictProjects) {
+					if (e.getPid().equals(in.getCommodityId())) {
+						if ((e.getType() == 1 || e.getType() == 2) && e.getAid().equals(TokenManager.getAdminId())) {
+							return false;
+						}
+					}
+				}
+			}
+		} else {
+			return false;
+		}
+		return true;
+	}
+
 }

+ 0 - 24
src/main/java/com/goafanti/test/controller/TestController.java

@@ -1,24 +0,0 @@
-package com.goafanti.test.controller;
-
-import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.utils.AsyncUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-@RestController
-@RequestMapping(value = "/open")
-public class TestController {
-
-    @Resource
-    private AsyncUtils asyncUtils;
-
-    @GetMapping(value = "/test")
-    public String test(){
-        asyncUtils.send(new EmailBo("催款处理失败",  AFTConstants.ADMIN_EMAIL,  "超管", "平台"));
-        return "test";
-    }
-}