首页>代码>spring+Struts2+mybatis+bootstrap整合开发元亨地产员工提成结算管理系统>/yuanheng1/YuanHeng3/src/com/yuanheng/action/ConcernAction.java
package com.yuanheng.action;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.opensymphony.xwork2.ActionSupport;
import com.yuanheng.pojo.Concern;
import com.yuanheng.pojo.Shop;
import com.yuanheng.pojo.Staff;
import com.yuanheng.service.ConcernService;
import com.yuanheng.service.ShopService;
import com.yuanheng.service.StaffService;
import com.yuanheng.util.Constants;
public class ConcernAction extends ActionSupport implements SessionAware, ServletResponseAware {
private javax.servlet.http.HttpServletResponse response;
private Map<String, Object> session = new HashMap<String, Object>();
private StaffService staffService;
private Staff staff;
private List<Staff> staffList;
private List<Shop> shopLisst;
private ShopService shopService;
private ConcernService concernService;
private Concern concern;
private int zhuanzou;
public javax.servlet.http.HttpServletResponse getResponse() {
return response;
}
public void setResponse(javax.servlet.http.HttpServletResponse response) {
this.response = response;
}
public StaffService getStaffService() {
return staffService;
}
public void setStaffService(StaffService staffService) {
this.staffService = staffService;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public ConcernService getConcernService() {
return concernService;
}
public void setConcernService(ConcernService concernService) {
this.concernService = concernService;
}
public Concern getConcern() {
return concern;
}
public void setConcern(Concern concern) {
this.concern = concern;
}
public Map<String, Object> getSession() {
return session;
}
public List<Staff> getStaffList() {
return staffList;
}
public void setStaffList(List<Staff> staffList) {
this.staffList = staffList;
}
public int getZhuanzou() {
return zhuanzou;
}
public void setZhuanzou(int zhuanzou) {
this.zhuanzou = zhuanzou;
}
public List<Shop> getShopLisst() {
return shopLisst;
}
public void setShopLisst(List<Shop> shopLisst) {
this.shopLisst = shopLisst;
}
public ShopService getShopService() {
return shopService;
}
public void setShopService(ShopService shopService) {
this.shopService = shopService;
}
private static final long serialVersionUID = 1L;
@Override
public void setSession(Map<String, Object> session) {
// TODO Auto-generated method stub
this.session = session;
}
@Override
public void setServletResponse(HttpServletResponse response) {
// TODO Auto-generated method stub
this.response = response;
}
// 员工关系管理
// 添加员工所属关系
public String concernAdd() throws IOException {
Staff staffId = new Staff();
staffId = this.staffService.fatherSelectOne(concern.getStaffId());
Staff fatherStaffId = new Staff();
fatherStaffId = this.staffService.fatherSelectOne(concern.getFatherStaffId());
this.response.setContentType("text/html;charset=utf-8");
if (staffId == null) {
this.response.getWriter().print("<script>alert('员工不存在!');location.href='concernAdd.jsp';</script>");
return null;
}
if (fatherStaffId == null) {
this.response.getWriter().print("<script>alert('父节点不存在!');location.href='concernAdd.jsp';</script>");
return null;
}
if (concern.getFatherStaffId() == concern.getStaffId()) {
this.response.getWriter().print("<script>alert('员工与父节点不能是一个人!');location.href='concernAdd.jsp';</script>");
return null;
}
if (concernService.fatherAndStafffSelectOne(concern) != null) {
this.response.getWriter()
.print("<script>alert('父节点与员工实线关系已存在存在!');location.href='concernAdd.jsp';</script>");
return null;
}
if (concernService.fatherselectOne(concern.getStaffId()) != null) {
this.response.getWriter().print("<script>alert('员工已有实线父节点!');location.href='concernAdd.jsp';</script>");
return null;
}
List<Concern> concerns = concernService.fatherdeFather(concern.getFatherStaffId());
for (int i = 0; i < concerns.size(); i++) {
if (concerns.get(i).getFatherStaffId() == concern.getStaffId()) {
this.response.getWriter()
.print("<script>alert('员工是父节点的父节点!');location.href='concernAdd.jsp';</script>");
return null;
}
}
staff = staffService.fatherSelectOne(concern.getFatherStaffId());
int rankId = staff.getRank().getRankId();
if (rankId == 3) {
this.concern.setRelation(1);
this.concern.setRelationType(1);
concernService.insertOne(concern);
} else {
this.concern.setRelation(3);
this.concern.setRelationType(1);
concernService.insertOne(concern);
Concern newconcern = new Concern();
newconcern = concernService.fatherselectOne(concern.getFatherStaffId());
this.concern.setRelation(1);
this.concern.setStaffId(concern.getStaffId());
this.concern.setFatherStaffId(newconcern.getFatherStaffId());
this.concern.setRelationType(3);
concernService.insertOne(concern);
}
return "success";
}
// 查询客户经理下的所有手下
public String concernAlteration() throws IOException {
this.response.setContentType("text/html;charset=utf-8");
// 通过员工Id判断有没有此员工
Staff selectStaff = staffService.selectOne(staff.getStaffId());
if (selectStaff == null) {
this.response.getWriter().print("<script>alert('员工不存在!');location.href='staffTransfer.jsp';</script>");
return null;
// 判断员工是不是客户经理
} else if (selectStaff.getRank().getRankId() == 3) {
// 只 查询一层关系的实线员工
// this.staffList =
// staffService.fatherSelectList(staff.getStaffId());
// 通过Id遍历所有实线子节点员工
this.staffList = staffService.selectce(staff.getStaffId());
// 查出所有门店
this.shopLisst = shopService.selectList();
this.session.put(Constants.STAFFS_SESSION_NAME, staffList);
this.session.put(Constants.STAFF_SESSION_NAME, staff);
this.session.put(Constants.SHOP_SESSION_NAME, this.shopLisst);
return SUCCESS;
} else {
// 不是客户经理不能单独转店
this.response.getWriter()
.print("<script>alert('非客户经理不能单独转店!');location.href='staffTransfer.jsp';</script>");
return null;
}
}
// 人员关系变更
public String concernAlterationaSave() throws IOException {
this.response.setContentType("text/html;charset=utf-8");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
System.out.println("员工点击调动按钮了");
// 看是自己走还是整租走
String boxStr= request.getParameter("FollowSatffId");
int zhuanzou = Integer.parseInt(boxStr);
//修改客户经理的门店信息
staffService.staffIdUpdateShop(this.staff);
// 获取页面转走客户经理Id
long pageManagerId = this.staff.getStaffId();
// 获取转走以后的客户经理信息
Staff ManagerInformation = staffService.selectOne(pageManagerId);
System.out.println("转走客户经理信息:" + ManagerInformation );
if (zhuanzou == 1) {
System.out.println("自己单独转走了");
// 查询转走客户经理的所有关系的父节点
List<Concern> ManagerFatherIds = this.concernService.fatherdeFather(pageManagerId);
for (Concern concernF : ManagerFatherIds) {
// 获取转走客户经理父节点信息
Staff ManagerFatherId = this.staffService.selectOne(concernF.getFatherStaffId());
System.out.println("获取父节点的信息:" + ManagerFatherId);
}
// 转走客户经理与子节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 查到第一层转客户经理与子节点的关系
List<Concern> ManagerSonIds = this.concernService.selectFather(pageManagerId);
System.out.println("转走客户经理的子节点们:" + ManagerSonIds);
for (Concern concernX : ManagerSonIds) {
// 获取转走客户经理子节点信息
Staff ManagerSonId = this.staffService.selectOne(concernX.getStaffId());
System.out.println("获取子节点的信息:" + ManagerSonId);
}
} else if (zhuanzou == 2) {
System.out.println("整租一起转走");
}
/*
// 查询是否有实线父节点
Concern fatherId = this.concernService.fatherselectOne(this.staff.getStaffId());
if (fatherId != null) {
// 有实线父节点
// 父节点信息
Staff fatherInformation = staffService.selectOne(fatherId.getFatherStaffId());
// 转走员工信息
Staff staffInformation = staffService.selectOne(fatherId.getStaffId());
// 通过判断门店信息来确定所属关系
if (fatherInformation.getShop().getShopId() == staffInformation.getShop().getShopId()) {
System.out.println("门店一样,父节点门店ID:" + fatherInformation.getShop().getShopId() + ",子节点ID:"
+ staffInformation.getShop().getShopId());
fatherId.setRelation(1);
} else if (fatherInformation.getShop().getShopId() != staffInformation.getShop().getShopId()) {
fatherId.setRelation(2);
}
// 更改与父类的关系为虚线关系
concernService.updateConcern(fatherId);
// 以上是转转走员工与他的父节点关系的变化
// --------------------------------------------------------------------------------------------------------------
// 更改与不转走子类的关系
// 查到第一层子类Id
List<Concern> zistaffIds = this.concernService.selectFather(this.staff.getStaffId());
for (int i = 0; i < zistaffIds.size(); i++) {
System.out.println("有父节点的子节点工号:" + zistaffIds.get(i).getStaffId());
// 循环查出相关子类信息
Staff staffInformations = staffService.selectOne(zistaffIds.get(i).getStaffId());
Concern concernsU = new Concern();
concernsU.setFatherStaffId(this.staff.getStaffId());
concernsU.setStaffId(zistaffIds.get(i).getStaffId());
// 通过判断门店信息来确定所属关系并添加关系 转走客户经理与手下第一层员工是否是一个店
if (staffInformations.getShop().getShopId() == staffInformation.getShop().getShopId()) {
concernsU.setRelation(1);
} else if (staffInformations.getShop().getShopId() != staffInformation.getShop().getShopId()) {
concernsU.setRelation(2);
// 添加转走客户经理的子节点与转走客户经路父节点的关系
// 通过判断门店信息来确定所属关系并添加关系
if (staffInformations.getShop().getShopId() == fatherInformation.getShop().getShopId()) {
Concern concernX = new Concern();
concernX.setFatherStaffId(fatherId.getFatherStaffId());
concernX.setStaffId(zistaffIds.get(i).getStaffId());
concernX.setRelation(1);
if (concernService.fatherAndStafffSelectOne(concernX) == null) {
concernService.insertOne(concernX);
}
} else if (staffInformations.getShop().getShopId() != staffInformation.getShop().getShopId()) {
System.out.println("转走客户经理的子节点与转走客户经路父节点的关系不是一个门店不用添加关系");
}
}
concernService.updateConcern(concernsU);
}
} else {
// 找到虚线父节点
Concern xxfatherId = this.concernService.xxfatherselectOne(this.staff.getStaffId());
System.out.println("这里是没有实线父类情况");
// 有实线父节点
// 父节点信息
Staff fatherInformation = staffService.selectOne(xxfatherId.getFatherStaffId());
// 子节点信息
Staff staffInformation = staffService.selectOne(xxfatherId.getStaffId());
// 通过判断门店信息来确定所属关系
if (fatherInformation.getShop().getShopId() == staffInformation.getShop().getShopId()) {
System.out.println("门店一样,父节点门店ID:" + fatherInformation.getShop().getShopId() + ",子节点ID:"
+ staffInformation.getShop().getShopId());
xxfatherId.setRelation(1);
} else if (fatherInformation.getShop().getShopId() != staffInformation.getShop().getShopId()) {
xxfatherId.setRelation(2);
}
// 更改与父类的关系为虚线关系
concernService.updateConcern(xxfatherId);
// 更改与不转走子类的关系
// 查到第一层子类Id
List<Concern> zistaffIds = this.concernService.selectFather(this.staff.getStaffId());
for (int i = 0; i < zistaffIds.size(); i++) {
System.out.println("有父节点的子节点工号:" + zistaffIds.get(i).getStaffId());
// 循环查出相关子类信息
Staff staffInformations = staffService.selectOne(zistaffIds.get(i).getStaffId());
Concern concernsU = new Concern();
concernsU.setFatherStaffId(this.staff.getStaffId());
concernsU.setStaffId(zistaffIds.get(i).getStaffId());
// 通过判断门店信息来确定所属关系并添加关系 转走客户经理与手下第一层员工是否是一个店
if (staffInformations.getShop().getShopId() == staffInformation.getShop().getShopId()) {
concernsU.setRelation(1);
} else if (staffInformations.getShop().getShopId() != staffInformation.getShop().getShopId()) {
concernsU.setRelation(2);
}
concernService.updateConcern(concernsU);
}
}
} else {
// 有员工一起转走
Shop shopId = new Shop();
// 获取页面要转到的门店id
shopId.setShopId(this.staff.getShop().getShopId());
// 获取变动的客户经理信息
this.staff.setStaffId(concern.getStaffId());
// 修改员工门店Id
staffService.staffIdUpdateShop(this.staff);
// 循环选中员工Id
Staff staffIdUpdateShop = new Staff();
staffIdUpdateShop.setShop(shopId);
// 更新所选员工门店Id
staffService.staffIdUpdateShop(staffIdUpdateShop);
}
// 以上修改转走员工的门店信息
// --------------------------------------------------------------------------------------------------------
// 以下修改走员工与父节点和子节点之间关系
*/
return SUCCESS;
}
// 人员关系变动最新版本
public String concernAlterationSave() throws IOException {
this.response.setContentType("text/html;charset=utf-8");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
System.out.println("员工点击调动按钮了");
// 获取页面上被选择的员工Id,这里的员工是跟随一起变动的员工
String[] boxStr= request.getParameterValues("FollowSatffId");
System.out.println("自己走是1整租走是2看看后面的数是几" );
// 获取页面转走客户经理Id
long pageManagerId = this.staff.getStaffId();
// 客户经理自己转走
this.staff.setStaffId(pageManagerId);
// 修改转走客户经理的门店信息
staffService.staffIdUpdateShop(this.staff);
// 获取转走客户经理信息
Staff ManagerInformation = staffService.selectOne(pageManagerId);
System.out.println("转走客户经理信息:" + ManagerInformation );
// 只有客户经理自己转走
if (boxStr == null) {
// 转走客户经理与父节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 查询转走客户经理的所有关系的父节点
List<Concern> ManagerFatherIds = this.concernService.fatherdeFather(pageManagerId);
System.out.println("转走客户经理的父节点们 :" + ManagerFatherIds);
// 这里最多能有三个父节点
for (Concern concernF : ManagerFatherIds) {
// 获取转走客户经理父节点信息
Staff ManagerFatherId = this.staffService.selectOne(concernF.getFatherStaffId());
System.out.println("获取父节点的信息:" + ManagerFatherId);
}
// 转走客户经理与子节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 查到第一层转客户经理与子节点的关系
List<Concern> ManagerSonIds = this.concernService.selectFather(pageManagerId);
System.out.println("转走客户经理的子节点们:" + ManagerSonIds);
for (Concern concernX : ManagerSonIds) {
// 获取转走客户经理子节点信息
Staff ManagerSonId = this.staffService.selectOne(concernX.getStaffId());
System.out.println("获取子节点的信息:" + ManagerSonId);
}
// 子节点与父节点的关系
// --------------------------------------------------------------------------------------------------------------------------
// 一下是员工和客户经理一起变动情况
} else if (boxStr != null) {
System.out.println("这里有员工和客户经理一起走");
//新建一个门店信息
Shop shopId = new Shop();
//获取页面上的门店Id
shopId.setShopId(this.staff.getShop().getShopId());
for (int i = 0; i < boxStr.length; i++) {
Long[] followStaffId = new Long[boxStr.length];
for (int j = 0; j < boxStr.length; j++) {
followStaffId[j] = Long.valueOf(boxStr[i]);
}
System.out.println("看看这个是啥:" + followStaffId[i]);
Staff followStaffS = new Staff();
followStaffS.setShop(shopId);
followStaffS.setStaffId(followStaffId[i]);
staffService.staffIdUpdateShop(followStaffS);
Staff followStaffInformation = new Staff();
followStaffInformation = staffService.selectOne(followStaffS.getStaffId());
System.out.println("跟随人员名单:"+followStaffInformation);
}
}
return SUCCESS;
}
// 人员关系变更
public String concernAlterationSave1() throws IOException {
this.response.setContentType("text/html;charset=utf-8");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
// 获取页面上被选择的员工Id,这里的员工是跟随一起变动的员工
String boxStr[] = request.getParameterValues("FollowSatffId");
// 获取页面转走客户经理Id
long pageManagerId = this.concern.getStaffId();
// 客户经理自己转走
this.staff.setStaffId(pageManagerId);
// 修改转走客户经理的门店信息
staffService.staffIdUpdateShop(this.staff);
// 获取转走客户经理信息
Staff ManagerInformation = staffService.selectOne(pageManagerId);
// 只有客户经理自己转走
if (boxStr == null) {
// 转走客户经理与父节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 查询转走客户经理的所有关系的父节点
List<Concern> ManagerFatherIds = this.concernService.fatherdeFather(pageManagerId);
System.out.println("转走客户经理的父节点们 :" + ManagerFatherIds);
// 这里最多能有三个父节点
for (Concern concern : ManagerFatherIds) {
System.out.println(concern);
}
// 转走客户经理与子节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 子节点与父节点的关系
// ----------------------------------------------------------------------------------------------------------------------------
// 转走客户经理有两个父节点
if (ManagerFatherIds.size() == 2) {
System.out.println("转走客户经理有两个父节点");
// 循环父节点
for (int a = 0; a < ManagerFatherIds.size(); a++) {
// 查出单个父节点信息
Staff ManagerFatherId = staffService.selectOne(ManagerFatherIds.get(a).getFatherStaffId());
// 创建新的关系类
Concern concernF = new Concern();
// 为新的关系类中的子节点复制 子节点就是转走客户经理
concernF.setStaffId(pageManagerId);
// 添加新的父节点到关系类中
concernF.setFatherStaffId(ManagerFatherId.getStaffId());
// 判断转走客户经理父节点与客户经理在一个店
if (ManagerFatherId.getShop().getShopId() == ManagerInformation.getShop().getShopId()) {
System.out.println("转走客户经理父节点与客户经理是在一个店");
// 和查到的父类是是实线关系
if (ManagerFatherIds.get(a).getRelation() == 1) {
System.out.println("这里是有一个实线父类关系的");
System.out.println("删除成功:" + concernF);
// concernService.tgFIdSIddeletesx(concernF);
// 和查到的父类是虚线关系
} else if (ManagerFatherIds.get(a).getRelation() == 2) {
System.out.println("这里是有一个虚线 父类关系的");
// 更改为实线父节点
concernF.setRelation(1);
System.out.println("修改成功为实线关系:" + concernF);
concernService.updateConcern(concernF);
}
// 判断转走客户经理父节点与客户经理不在一个店
} else if (ManagerFatherId.getShop().getShopId() != ManagerInformation.getShop().getShopId()) {
System.out.println("转走客户经理父节点与客户经理不在一个店");
// 和查到的父类是是实线关系
if (ManagerFatherIds.get(a).getRelation() == 1) {
System.out.println("这里是有一个实线父类关系的");
System.out.println("删除成功:" + concernF);
concernService.tgFIdSIddeletesx(concernF);
// 和查到的父类是虚线关系
} else if (ManagerFatherIds.get(a).getRelation() == 2) {
System.out.println("这里是有一个虚线 父类关系的");
// 更改为实线父节点
concernF.setRelation(2);
System.out.println("修改成功为虚线线关系:" + concernF);
concernService.updateConcern(concernF);
}
}
}
// 转走客户经理只有一个父节点
} else if (ManagerFatherIds.size() == 1) {
// 循环查到到的父节点
for (int b = 0; b < ManagerFatherIds.size(); b++) {
// 查出单个父节点信息
Staff ManagerFatherId = staffService.selectOne(ManagerFatherIds.get(b).getFatherStaffId());
System.out.println("转走员工第" + b + "个父节点信息为:" + ManagerFatherId);
// 创建新的与父节点的关系
Concern concernF = new Concern();
// 为新的关系类中的子节点复制 子节点就是转走客户经理
concernF.setStaffId(pageManagerId);
// 添加新的父节点到关系类中
concernF.setFatherStaffId(ManagerFatherId.getStaffId());
// 判断转走客户经理父节点与客户经理在一个店
if (ManagerFatherId.getShop().getShopId() == ManagerInformation.getShop().getShopId()) {
// 修改为实线关系
concernF.setRelation(1);
System.out.println("修改成功为实线关系:" + concernF);
// 判断转走客户经理父节点与客户经理不在一个店
} else if (ManagerFatherId.getShop().getShopId() != ManagerInformation.getShop().getShopId()) {
// 修改为虚线关系
concernF.setRelation(2);
System.out.println("修改成功为虚线关系:" + concernF);
}
// 修改与父类的关系
concernService.updateConcern(concernF);
}
// 员工没有父节点
} else if (ManagerFatherIds.size() == 0) {
System.out.println("转走员工没有父节点");
}
// 转走客户经理与子节点关系
// --------------------------------------------------------------------------------------------------------------------------
// 查到第一层转走员工与子节点的关系
List<Concern> ManagerSonIds = this.concernService.selectFather(pageManagerId);
// 循环查出来的子节点信息
for (int c = 0; c < ManagerSonIds.size(); c++) {
// 循环查出相关子类信息
Staff ManagerSonId = staffService.selectOne(ManagerSonIds.get(c).getStaffId());
System.out.println("转走员工第" + c + 1 + "个子节点信息" + ManagerSonId);
// 查到子节点的父类们
List<Concern> SonManagerFatherIds = concernService.fatherdeFather(ManagerSonIds.get(c).getStaffId());
// 创建与子节点的关系类
Concern concernZ = new Concern();
// 添加新关系的子节点
concernZ.setStaffId(ManagerSonId.getStaffId());
// 转走员工与子节点在一个门店
if (ManagerSonId.getShop().getShopId() == ManagerInformation.getShop().getShopId()) {
System.out.println("转走员工与转走员工子节点在同一个店");
// 如果转走员工的子节点有两个父节点
if (SonManagerFatherIds.size() == 2) {
}
// 转走员工与子节点不在一个门店
} else if (ManagerSonId.getShop().getShopId() != ManagerInformation.getShop().getShopId()) {
System.out.println("转走员工与转走员工子节点不在同一个店");
}
}
// 现在不忙么 感觉怎么样啊
System.out.println("走到这里下面的就不用看了");
// 下面是之前写的东西
// 查到第一层子类Id
List<Concern> zistaffIds = this.concernService.selectFather(pageManagerId);
// 循环子节点的相关信息
for (int i = 0; i < zistaffIds.size(); i++) {
// 循环查出相关子类信息
Staff ManagerInformations = staffService.selectOne(zistaffIds.get(i).getStaffId());
System.out.println("转走员工第" + i + 1 + "个子节点信息" + ManagerInformation);
// 查到子节点有几个父类
List<Concern> staffManagerFatherIds = concernService.fatherdeFather(zistaffIds.get(i).getStaffId());
// 创建新的关系
Concern concernZ = new Concern();
// 添加新关系的子节点
concernZ.setStaffId(ManagerInformations.getStaffId());
// 转走员工与子节点在一个门店
if (ManagerInformations.getShop().getShopId() == ManagerInformation.getShop().getShopId()) {
System.out.println("转走员工与转走员工子节点在同一个店");
// 如果转走员工的子节点有两个父节点
if (staffManagerFatherIds.size() == 2) {
System.out.println("转走员工子节点有两个父类");
for (int j = 0; j < staffManagerFatherIds.size(); j++) {
// 与父节点为实线关系
if (staffManagerFatherIds.get(i).getRelation() == 1) {
// 添加新关系的父节点
concernZ.setFatherStaffId(staffManagerFatherIds.get(i).getFatherStaffId());
// 删除该转走员工子节点与转走员工父节点的实线关系
System.out.println("删除该转走员工子节点与转走员工父节点的实线关系" + concernZ);
concernService.tgFIdSIddeletesx(concernZ);
// 与父节点为虚线关系
} else if (staffManagerFatherIds.get(i).getRelation() == 2) {
// 添加新关系的父节点
concernZ.setFatherStaffId(staffManagerFatherIds.get(i).getFatherStaffId());
concernZ.setRelation(1);
System.out.println("修改该转走员工子节点与转走员为实线关系" + concernZ);
// 修改该转走员工子节点与转走员为实线关系
concernService.updateConcern(concernZ);
}
}
// 转走员工子节点有一个父节点
} else if (staffManagerFatherIds.size() == 1) {
System.out.println("转走员工子节点有一个父节点");
// 添加新关系的父节点
concernZ.setFatherStaffId(pageManagerId);
concernZ.setRelation(1);
// 更新 为实线父节点
System.out.println("修改该转走员工子节点与转走员为实线关系" + concernZ);
concernService.updateConcern(concernZ);
}
// 转走员工与子节点不在一个门店
} else if (ManagerInformations.getShop().getShopId() != ManagerInformation.getShop().getShopId()) {
System.out.println("转走员工与子节点不在一个门店");
// 有两个父节点
if (staffManagerFatherIds.size() == 2) {
System.out.println("转走员工子节点有两个父节点");
for (int j = 0; j < staffManagerFatherIds.size(); j++) {
// 转走员工子节点与父节点为实线关系
if (staffManagerFatherIds.get(i).getRelation() == 1) {
// 添加新关系的父节点
concernZ.setFatherStaffId(staffManagerFatherIds.get(i).getFatherStaffId());
// 删除该转走员工子节点与转走员工父节点的实线关系
System.out.println("删除该转走员工子节点与转走员工父节点的实线关系" + concernZ);
concernService.tgFIdSIddeletesx(concernZ);
} else if (staffManagerFatherIds.get(i).getRelation() == 2) {
// 添加新关系的父节点
concernZ.setFatherStaffId(pageManagerId);
concernZ.setRelation(2);
// 更新 为实线父节点
System.out.println("修改该转走员工子节点与转走员为虚线线关系" + concernZ);
concernService.updateConcern(concernZ);
}
}
} else if (staffManagerFatherIds.size() == 1) {
System.out.println("转走员工子节点只有一个父节点");
// 添加新关系的父节点
concernZ.setFatherStaffId(pageManagerId);
concernZ.setRelation(2);
// 更新转走员工与转走员工子节点为虚线关系
System.out.println("修改该转走员工子节点与转走员为虚线线关系" + concernZ);
concernService.updateConcern(concernZ);
for (int j = 0; j < staffManagerFatherIds.size(); j++) {
// 查询转走员工子节点信息
Staff zStaffId = staffService.selectOne(staffManagerFatherIds.get(j).getStaffId());
// 查询转走员工的实线父节点
List<Concern> gxManagerFatherIds = concernService.fatherdeFather(pageManagerId);
for (int k = 0; k < gxManagerFatherIds.size(); k++) {
// 查询转走员工父节点的信息
Staff fStaffId = staffService.selectOne(gxManagerFatherIds.get(i).getFatherStaffId());
Concern concernX = new Concern();
concernX.setFatherStaffId(fStaffId.getStaffId());
concernX.setStaffId(zStaffId.getStaffId());
System.out.println("查询转走员工的实线父节点" + gxManagerFatherIds.get(k));
System.out.println("转走员工与父节点为实线");
if (zStaffId.getShop().getShopId() == fStaffId.getShop().getShopId()) {
concernX.setRelation(1);
// 添加转走员工子节点与转走 员工父节点的实线关系
System.out.println("添加转走员工子节点与转走 员工父节点的实线关系" + concernX);
concernService.insertOne(concernX);
}
}
}
}
}
}
// --------------------------------------------------------------------------------------------------------------------------
// 一下是有人和转正客户经理一起走
} else if (boxStr != null) {
// 有员工和客户经理一起转走
System.out.println("有人和转走员工一起走");
}
return SUCCESS;
}
}

最近下载
最近浏览