Sfoglia il codice sorgente

审核人员、客户经理、营销经理检索全部客户名称

Antiloveg 8 anni fa
parent
commit
b196ee8168

+ 23 - 16
src/main/java/com/goafanti/admin/controller/AdminSuperviseApiController.java

@@ -29,6 +29,7 @@ import com.goafanti.common.model.AdminLocation;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.user.service.UserService;
 
 
 @Controller
 @Controller
 @RequestMapping(value = "/api/admin/supervise")
 @RequestMapping(value = "/api/admin/supervise")
@@ -39,7 +40,9 @@ public class AdminSuperviseApiController extends CertifyApiController {
 	private PasswordUtil			passwordUtil;
 	private PasswordUtil			passwordUtil;
 	@Resource
 	@Resource
 	private AdminLocationService	adminLocationService;
 	private AdminLocationService	adminLocationService;
-	
+	@Resource
+	private UserService				userService;
+
 	/**
 	/**
 	 * 审核人员、客户经理、营销经理检索全部客户名称
 	 * 审核人员、客户经理、营销经理检索全部客户名称
 	 */
 	 */
@@ -59,7 +62,11 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			return res;
 			return res;
 		}
 		}
 		
 		
-		
+		if (UserType.PERSONAL.getCode().equals(type)){
+			res.setData(userService.findUserNameByNameAndMobile(name, mobile));
+		} else {
+			res.setData(userService.findOrgNameByNameAndMobile(name, mobile));
+		}
 		return res;
 		return res;
 	}
 	}
 
 
@@ -69,10 +76,10 @@ public class AdminSuperviseApiController extends CertifyApiController {
 	@RequestMapping(value = "/adminOwnLocation", method = RequestMethod.GET)
 	@RequestMapping(value = "/adminOwnLocation", method = RequestMethod.GET)
 	public Result adminOwnLocation() {
 	public Result adminOwnLocation() {
 		Result res = new Result();
 		Result res = new Result();
-		/*if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 			res.setData(AFTConstants.SUPERADMIN);
 			res.setData(AFTConstants.SUPERADMIN);
 			return res;
 			return res;
-		}*/
+		}
 		res.setData(adminLocationService.findLocation(TokenManager.getAdminId()));
 		res.setData(adminLocationService.findLocation(TokenManager.getAdminId()));
 		return res;
 		return res;
 	}
 	}
@@ -288,7 +295,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 							return res;
 							return res;
 						}
 						}
 						adminLocationList.add(disposeAdminLocation(al, ad, province, c));
 						adminLocationList.add(disposeAdminLocation(al, ad, province, c));
-						if (areaAdminFlag){
+						if (areaAdminFlag) {
 							locationList.add(c);
 							locationList.add(c);
 						}
 						}
 					}
 					}
@@ -297,10 +304,10 @@ public class AdminSuperviseApiController extends CertifyApiController {
 				adminLocationList.add(disposeAdminLocation(al, ad, province, null));
 				adminLocationList.add(disposeAdminLocation(al, ad, province, null));
 			}
 			}
 		}
 		}
-		if (areaAdminFlag){
+		if (areaAdminFlag) {
 			List<Integer> albList = disposeAdminLocationBo();
 			List<Integer> albList = disposeAdminLocationBo();
-			if (!albList.containsAll(locationList)){
-				res.getError().add(buildError("","所选所在地区域不在负责区域,无法添加或修改"));
+			if (!albList.containsAll(locationList)) {
+				res.getError().add(buildError("", "所选所在地区域不在负责区域,无法添加或修改"));
 				return res;
 				return res;
 			}
 			}
 		}
 		}
@@ -318,20 +325,20 @@ public class AdminSuperviseApiController extends CertifyApiController {
 		}
 		}
 		return al;
 		return al;
 	}
 	}
-	
-	private List<Integer> disposeAdminLocationBo(){
+
+	private List<Integer> disposeAdminLocationBo() {
 		List<AdminLocationBo> alb = adminLocationService.findLocation(TokenManager.getAdminId());
 		List<AdminLocationBo> alb = adminLocationService.findLocation(TokenManager.getAdminId());
 		List<Integer> albList = null;
 		List<Integer> albList = null;
-		if (!alb.isEmpty()){
+		if (!alb.isEmpty()) {
 			Integer albProvince = null;
 			Integer albProvince = null;
-			 albList = new ArrayList<>();
-			for (AdminLocationBo bo : alb){
+			albList = new ArrayList<>();
+			for (AdminLocationBo bo : alb) {
 				albProvince = bo.getProvince();
 				albProvince = bo.getProvince();
 				albList.add(albProvince);
 				albList.add(albProvince);
-				if (!StringUtils.isBlank(bo.getCity())){
+				if (!StringUtils.isBlank(bo.getCity())) {
 					String[] albArr = bo.getCity().trim().split(",|,");
 					String[] albArr = bo.getCity().trim().split(",|,");
-					if (null != albArr && albArr.length > 0){
-						for (String ss : albArr){
+					if (null != albArr && albArr.length > 0) {
+						for (String ss : albArr) {
 							albList.add(Integer.valueOf(ss));
 							albList.add(Integer.valueOf(ss));
 						}
 						}
 					}
 					}

+ 6 - 0
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -2,6 +2,8 @@ package com.goafanti.common.dao;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.User;
 import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserDownLoadBo;
@@ -28,4 +30,8 @@ public interface UserMapper {
 	UserDownLoadBo selectUserDownLoadBoByUserId(String id);
 	UserDownLoadBo selectUserDownLoadBoByUserId(String id);
 
 
 	List<OrgListBo> selectUserByAid(String aid);
 	List<OrgListBo> selectUserByAid(String aid);
+
+	String findUserByNameAndMobile(@Param("name")String name, @Param("mobile")String mobile);
+
+	String findOrgByNameAndMobile(@Param("name")String name, @Param("mobile")String mobile);
 }
 }

+ 28 - 0
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -356,4 +356,32 @@
     ON u.id = o.uid 
     ON u.id = o.uid 
     where u.aid = #{aid,jdbcType=VARCHAR}
     where u.aid = #{aid,jdbcType=VARCHAR}
   </select>
   </select>
+  
+  <select id="findUserByNameAndMobile" resultType="java.lang.String">
+  	select 
+  		ui.username
+  	from user u 
+  	left join user_identity ui on u.id = ui.uid
+  	where u.lvl &gt; 0 and u.type = 0 and ui.audit_status = 5
+  	<if test="name != null">
+  		and ui.username = #{name,jdbcType=VARCHAR}
+  	</if>
+  	<if test="mobile != null">
+  		and u.mobile = #{mobile,jdbcType=VARCHAR}
+  	</if>
+  </select>
+  
+  <select id="findOrgByNameAndMobile" resultType="java.lang.String">
+  	select 
+  		oi.unit_name 
+  	from user u 
+  	left join organization_identity oi on u.id = oi.uid
+  	where u.lvl &gt; 0 and u.type = 1 and oi.audit_status = 5
+  	<if test="name != null">
+  		and oi.unit_name = #{name,jdbcType=VARCHAR}
+  	</if>
+  	<if test="mobile != null">
+  		and u.mobile = #{mobile,jdbcType=VARCHAR}
+  	</if>
+  </select>
 </mapper>
 </mapper>

+ 4 - 0
src/main/java/com/goafanti/user/service/UserService.java

@@ -47,4 +47,8 @@ public interface UserService {
 
 
 	List<OrgUnitNames> selectAchievementOrgOwner(String name);
 	List<OrgUnitNames> selectAchievementOrgOwner(String name);
 
 
+	String findUserNameByNameAndMobile(String name, String mobile);
+
+	String findOrgNameByNameAndMobile(String name, String mobile);
+
 }
 }

+ 10 - 0
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -275,6 +275,16 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		}
 		}
 		return map;
 		return map;
 	}
 	}
+
+	@Override
+	public String findUserNameByNameAndMobile(String name, String mobile) {
+		return userMapper.findUserByNameAndMobile(name, mobile);
+	}
+
+	@Override
+	public String findOrgNameByNameAndMobile(String name, String mobile) {
+		return userMapper.findOrgByNameAndMobile(name, mobile);
+	}
 	
 	
 
 
 }
 }