Browse Source

将角色资源新增、修改合并成一个借口

anderx 7 years ago
parent
commit
10d936736f

+ 11 - 0
src/main/java/com/goafanti/customer/service/impl/CustomerServiceImpl.java

@@ -412,6 +412,9 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 					//更新业务表
 					userBusiness.setId(ub.getBusinessId());
 					if (us.getFollowSituation()==5) {//如果已签合同,则不允许变更
+					/*if (ub.getFollowSituation()!=5&&checkCustomerInformation(uid)) {
+						throw new BusinessException(new Error("","请到客户资料-客户资料维护模块完善您的客户信息!"));
+						}*/
 						if (ub.getCustomerStatus()!=us.getCustomerStatus()|| ub.getFollowSituation()!=5) {
 							throw new BusinessException(new Error(ErrorConstants.BUSINESS_ALREADY_LOCKED,""));
 						}
@@ -1312,4 +1315,12 @@ public class CustomerServiceImpl  extends BaseMybatisDao<UserMapper> implements
 		Map<String,Object> params = disposeParams(cli);
 		return (Pagination<CustomerListIn>) findPage("selectDepCustomerInformationList","selectDepCustomerInformationCount",params,pageNo,pageSize);
 		}
+	
+	public boolean checkCustomerInformation(String uid) {
+		int i=userMapper.checkCustomerInformation(uid);
+		if (i<1) {
+			return true;
+		}
+		return false;
+	}
 }

+ 13 - 18
src/main/java/com/goafanti/permission/controller/NewRoleApiController.java

@@ -128,6 +128,12 @@ public class NewRoleApiController extends BaseApiController{
 		res.setData(newRoleService.bindUser(rid, uid));
 		return res;
 	}
+	/**
+	 * 新增角色资源
+	 * @param rid 角色ID
+	 * @param resources 资源
+	 * @return
+	 */
 	@RequestMapping(value = "/role/addResources", method = RequestMethod.POST)
 	public Result addResources(String rid, String resources) {
 		Result res = new Result();
@@ -139,27 +145,16 @@ public class NewRoleApiController extends BaseApiController{
 			res.getError().add(buildError("","角色资源不能为空"));
 			return res;
 		}
-		if (newRoleService.checkRid(rid)) {
-			res.getError().add(buildError("","角色资源已存在"));
-			return res;
-		}
+		
 		res.setData(newRoleService.addResources(rid, resources));
 		return res;
 	}
-	@RequestMapping(value = "/role/updateResources", method = RequestMethod.POST)
-	public Result updateResources(String rid, String resources) {
-		Result res = new Result();
-		if (StringUtils.isBlank(rid)) {
-			res.getError().add(buildError("","角色错误"));
-			return res;
-		}
-		if (StringUtils.isBlank(resources)) {
-			res.getError().add(buildError("","角色资源不能为空"));
-			return res;
-		}
-		res.setData(newRoleService.updateResources(rid, resources));
-		return res;
-	}
+	/**
+	 * 离职人员转交
+	 * @param aid 离职ID
+	 * @param transferId 转交ID
+	 * @return
+	 */
 	@RequestMapping(value = "/role/dimission", method = RequestMethod.POST)
 	public Result dimission(String aid ,String transferId) {
 		Result res = new Result();

+ 0 - 4
src/main/java/com/goafanti/permission/service/NewRoleService.java

@@ -35,9 +35,5 @@ public interface NewRoleService {
 	
 	int addResources(String rid, String resources);
 
-	int updateResources(String rid, String resources);
-
-	boolean checkRid(String rid);
-
 	int updatedimission(String aid, String transferId);
 }

+ 4 - 14
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.bo.Error;
-import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.dao.RoleMapper;
 import com.goafanti.common.dao.RolePermissionMapper;
 import com.goafanti.common.dao.RoleResourcesMapper;
@@ -149,6 +148,9 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 	public int addResources(String rid, String resources) {
 		List<String> list = Arrays.asList(resources.split(","));
 		RoleResources rr=new RoleResources();
+		if (roleResourcesMapper.checkRid(rid)>0) {
+			roleResourcesMapper.deleteResources(rid);
+		}
 		for (String s : list) {
 			rr.setId(UUID.randomUUID().toString());
 			rr.setRoleId(rid);
@@ -162,19 +164,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 		}
 		return 1;
 	}
-	@Override
-	public int updateResources(String rid, String resources) {
-		roleResourcesMapper.deleteResources(rid);
-		addResources(rid,resources);
-		return 1;
-	}
-	@Override
-	public boolean checkRid(String rid) {
-		if (roleResourcesMapper.checkRid(rid)>0) {
-			return true;
-		}
-		return false;
-	}
+	
 	@Override
 	public int updatedimission(String aid, String transferId) {
 		List<Integer> list=roleResourcesMapper.selectAdminRoleResources(aid);