|
@@ -17,6 +17,7 @@ import com.jeeplus.modules.sys.service.AreaService;
|
|
|
import com.jeeplus.modules.sys.service.OfficeService;
|
|
|
import com.jeeplus.modules.sys.service.SystemService;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.shiro.authz.annotation.Logical;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -185,7 +186,7 @@ public class AreaStaffController extends BaseController {
|
|
|
areaStaffInfo.setOffice(officeList.get(0));
|
|
|
}
|
|
|
|
|
|
- List<User> userList = areaStaffService.getUserByParentId(areaStaffInfo);
|
|
|
+ List<User> userList = areaStaffService.getUserByParentIdAdd(areaStaffInfo);
|
|
|
model.addAttribute("userList", userList);
|
|
|
|
|
|
model.addAttribute("areaStaffInfo", areaStaffInfo);
|
|
@@ -217,7 +218,7 @@ public class AreaStaffController extends BaseController {
|
|
|
office = officeService.get(areaStaffInfo.getParent().getStandardDetail());
|
|
|
areaStaffInfo.setOffice(office);
|
|
|
|
|
|
- List<User> userList = areaStaffService.getUserByParentId(areaStaffInfo);
|
|
|
+ List<User> userList = areaStaffService.getUserByParentIdAdd(areaStaffInfo);
|
|
|
model.addAttribute("userList", userList);
|
|
|
break;
|
|
|
case "4":
|
|
@@ -425,7 +426,14 @@ public class AreaStaffController extends BaseController {
|
|
|
infos.add(s);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //获取该地区下所有用户
|
|
|
+ List<User> userList = areaStaffService.getUserByParentId(areaStaffInfo);
|
|
|
+ //先删除一次然后在进行新增
|
|
|
+ if (CollectionUtils.isNotEmpty(userList)){
|
|
|
+ for (User deleteUser : userList) {
|
|
|
+ areaStaffService.outUserById(deleteUser.getId(),deleteUser.getAuditUserId());
|
|
|
+ }
|
|
|
+ }
|
|
|
StringBuilder msg = new StringBuilder();
|
|
|
int newNum = 0;
|
|
|
if (infos.size()!=0){
|
|
@@ -451,11 +459,12 @@ public class AreaStaffController extends BaseController {
|
|
|
}
|
|
|
addMessage(redirectAttributes, "已成功分配 "+newNum+" 个用户"+msg);
|
|
|
}else {
|
|
|
- //获取该地区下所有用户,将他们删除
|
|
|
- List<User> userList = areaStaffService.getUserByParentId(areaStaffInfo);
|
|
|
- for (User user : userList) {
|
|
|
- areaStaffService.outUserById(user.getId(),user.getAuditUserId());
|
|
|
+ if (CollectionUtils.isNotEmpty(userList)){
|
|
|
+ for (User user : userList) {
|
|
|
+ areaStaffService.outUserById(user.getId(),user.getAuditUserId());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
return "redirect:" + adminPath + "/areaStaff/areaStaff/userForm?parent.id="+areaStaffInfo.getId();
|
|
|
}
|
|
@@ -494,18 +503,18 @@ public class AreaStaffController extends BaseController {
|
|
|
String[] split = ids.split(",");
|
|
|
for (String s : split) {
|
|
|
User user = UserUtils.get(s);
|
|
|
- AreaStaffUserInfo staffInfo=areaStaffService.getIsTemplateByUserId(s,areaId);
|
|
|
- if (staffInfo != null && StringUtils.isNotBlank(staffInfo.getIsTemplate())){
|
|
|
- user.setIsTemplate(staffInfo.getIsTemplate());
|
|
|
- }
|
|
|
+// AreaStaffUserInfo staffInfo=areaStaffService.getIsTemplateByUserId(s,areaId);
|
|
|
+// if (staffInfo != null && StringUtils.isNotBlank(staffInfo.getIsTemplate())){
|
|
|
+// user.setIsTemplate(staffInfo.getIsTemplate());
|
|
|
+// }
|
|
|
users.add(user);
|
|
|
}
|
|
|
}else {
|
|
|
User user = UserUtils.get(ids);
|
|
|
- AreaStaffUserInfo staffInfo=areaStaffService.getIsTemplateByUserId(ids,areaId);
|
|
|
- if (staffInfo != null && StringUtils.isNotBlank(staffInfo.getIsTemplate())){
|
|
|
- user.setIsTemplate(staffInfo.getIsTemplate());
|
|
|
- }
|
|
|
+// AreaStaffUserInfo staffInfo=areaStaffService.getIsTemplateByUserId(ids,areaId);
|
|
|
+// if (staffInfo != null && StringUtils.isNotBlank(staffInfo.getIsTemplate())){
|
|
|
+// user.setIsTemplate(staffInfo.getIsTemplate());
|
|
|
+// }
|
|
|
users.add(user);
|
|
|
}
|
|
|
|