|
|
|
@ -69,6 +69,33 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
|
|
|
|
|
public int insertBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
|
baseTeamT.setCreateDate(DateUtils.getNowDate());
|
|
|
|
|
baseTeamT.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
//删掉当前关联重新建
|
|
|
|
|
baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId());
|
|
|
|
|
for(int i = 0;i<baseTeamT.getRightData().size();i++){
|
|
|
|
|
BaseTeamUser baseTeamUser = new BaseTeamUser();
|
|
|
|
|
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
baseTeamUser.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
baseTeamUser.setTeamId(baseTeamT.getTeamId());
|
|
|
|
|
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
|
|
|
|
|
baseTeamUser.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
list = baseTeamT.getRightData();
|
|
|
|
|
String userId = list.get(i);
|
|
|
|
|
baseTeamUser.setUserId(userId);
|
|
|
|
|
String userName = baseTeamUserMapper.selectUserName(baseTeamUser);
|
|
|
|
|
//判断班组人员有没有变动 挨个遍历
|
|
|
|
|
baseTeamUser.setUserName(userName);
|
|
|
|
|
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
|
|
|
|
|
// BaseTeamUser baseTeamUser1 = new BaseTeamUser();
|
|
|
|
|
// List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
|
|
|
|
|
// boolean bool = members.contains(userId);
|
|
|
|
|
//倒查id
|
|
|
|
|
// String id = baseTeamUserMapper.selectId(baseTeamUser);
|
|
|
|
|
// baseTeamUser.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
// baseTeamUser.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
// baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
|
|
|
|
|
//如果过来的班组成员ID不存在于表中,直接新增
|
|
|
|
|
}
|
|
|
|
|
return baseTeamTMapper.insertBaseTeamT(baseTeamT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -83,29 +110,32 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
|
|
|
|
|
public int updateBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
|
baseTeamT.setLastUpdateDate(DateUtils.getNowDate());
|
|
|
|
|
baseTeamT.setLastUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
//删掉当前关联重新建
|
|
|
|
|
baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId());
|
|
|
|
|
for(int i = 0;i<baseTeamT.getRightData().size();i++){
|
|
|
|
|
BaseTeamUser baseTeamUser = new BaseTeamUser();
|
|
|
|
|
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
baseTeamUser.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
baseTeamUser.setTeamId(baseTeamT.getTeamId());
|
|
|
|
|
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
|
|
|
|
|
baseTeamUser.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
|
list = baseTeamT.getRightData();
|
|
|
|
|
String userId = list.get(i);
|
|
|
|
|
baseTeamUser.setUserId(userId);
|
|
|
|
|
BaseTeamUser baseTeamUser1 = new BaseTeamUser();
|
|
|
|
|
List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
|
|
|
|
|
boolean bool = members.contains(userId);
|
|
|
|
|
if(bool == true){
|
|
|
|
|
//倒查id
|
|
|
|
|
String id = baseTeamUserMapper.selectId(baseTeamUser);
|
|
|
|
|
baseTeamUser.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
baseTeamUser.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
|
|
|
|
|
}else{
|
|
|
|
|
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
baseTeamUser.setCreateTime(DateUtils.getNowDate());
|
|
|
|
|
baseTeamUser.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
|
|
|
|
|
}
|
|
|
|
|
String userName = baseTeamUserMapper.selectUserName(baseTeamUser);
|
|
|
|
|
//判断班组人员有没有变动 挨个遍历
|
|
|
|
|
baseTeamUser.setUserName(userName);
|
|
|
|
|
baseTeamUserMapper.insertBaseTeamUser(baseTeamUser);
|
|
|
|
|
// BaseTeamUser baseTeamUser1 = new BaseTeamUser();
|
|
|
|
|
// List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
|
|
|
|
|
// boolean bool = members.contains(userId);
|
|
|
|
|
//倒查id
|
|
|
|
|
// String id = baseTeamUserMapper.selectId(baseTeamUser);
|
|
|
|
|
// baseTeamUser.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
|
// baseTeamUser.setUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
// baseTeamUserMapper.updateBaseTeamUser(baseTeamUser);
|
|
|
|
|
//如果过来的班组成员ID不存在于表中,直接新增
|
|
|
|
|
}
|
|
|
|
|
return baseTeamTMapper.updateBaseTeamT(baseTeamT);
|
|
|
|
|
}
|
|
|
|
|