|
@@ -379,19 +379,32 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
|
|
List<DclBorderList> dclBorderList = JSONUtil.toList(groupDto.getDclBorderList(), DclBorderList.class);
|
|
List<DclBorderList> dclBorderList = JSONUtil.toList(groupDto.getDclBorderList(), DclBorderList.class);
|
|
|
|
|
|
TbTradeArea tbTradeArea = tbTradeAreaService.updateHandler(groupDto.getFieldCode(), "", "");
|
|
TbTradeArea tbTradeArea = tbTradeAreaService.updateHandler(groupDto.getFieldCode(), "", "");
|
|
- //根据编号进行事务处理
|
|
|
|
- TbGroup tbGroup = this.findByAreaCodeAndSeqCode(tbTradeArea.getId(), groupDto.getPlatSeqNo());
|
|
|
|
- if (tbGroup == null) {
|
|
|
|
- tbGroup = new TbGroup();
|
|
|
|
- BeanUtils.copyProperties(groupDto, tbGroup);
|
|
|
|
- //新增
|
|
|
|
- tbGroup.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
- tbGroup.setCreateTime(new Date())
|
|
|
|
- .setTradeAreaId(tbTradeArea.getId())
|
|
|
|
- .setTradeAreaName(tbTradeArea.getName());
|
|
|
|
- this.save(tbGroup);
|
|
|
|
|
|
+ //根据登记号进行事务处理
|
|
|
|
+ TbGroup tbGroup = this.findByAreaCodeAndSeqCode(tbTradeArea.getId(), groupDto.getShopsSccd());
|
|
|
|
+ if(tbGroup != null) {
|
|
|
|
+ //清空原互助组边民的组信息
|
|
|
|
+ LambdaQueryWrapper<TbPeople> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ wrapper.eq(TbPeople::getGroupId, tbGroup.getId());
|
|
|
|
+ List<TbPeople> peopleList = tbPeopleMapper.selectList(wrapper);
|
|
|
|
+
|
|
|
|
+ for (TbPeople people:peopleList) {
|
|
|
|
+ people.setGroupName(null).setGroupId(null).setUpdateTime(new Date());
|
|
|
|
+ }
|
|
|
|
+ tbPeopleService.updateBatchById(peopleList);
|
|
|
|
+ //删除原互助组
|
|
|
|
+ removeById(tbGroup.getId());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //新增
|
|
|
|
+ tbGroup = new TbGroup();
|
|
|
|
+ BeanUtils.copyProperties(groupDto, tbGroup);
|
|
|
|
+ tbGroup.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
|
|
|
|
+ tbGroup.setCreateTime(new Date())
|
|
|
|
+ .setTradeAreaId(tbTradeArea.getId())
|
|
|
|
+ .setTradeAreaName(tbTradeArea.getName());
|
|
|
|
+ this.save(tbGroup);
|
|
|
|
+
|
|
|
|
+
|
|
for (BorderDTO borderDTO : borderDTOList) {
|
|
for (BorderDTO borderDTO : borderDTOList) {
|
|
TbPeople tbPeople = tbPeopleService.findByIdCarNo(borderDTO.getIdCardNo());
|
|
TbPeople tbPeople = tbPeopleService.findByIdCarNo(borderDTO.getIdCardNo());
|
|
if (tbPeople == null) {
|
|
if (tbPeople == null) {
|
|
@@ -404,15 +417,11 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
|
|
} else {
|
|
} else {
|
|
tbPeople.setRole(1);//普通边民
|
|
tbPeople.setRole(1);//普通边民
|
|
}
|
|
}
|
|
-
|
|
|
|
- tbPeople.setGroupName(tbGroup.getOrgName()).setGroupId(tbGroup.getId()).setTradeAreaId(tbTradeArea.getId())
|
|
|
|
- .setTradeAreaName(tbTradeArea.getName()).setUpdateTime(new Date());
|
|
|
|
|
|
+ tbPeople.setGroupName(tbGroup.getOrgName()).setGroupId(tbGroup.getId())
|
|
|
|
+ .setTradeAreaId(tbTradeArea.getId()).setTradeAreaName(tbTradeArea.getName()).setUpdateTime(new Date());
|
|
tbPeopleService.saveOrUpdate(tbPeople);
|
|
tbPeopleService.saveOrUpdate(tbPeople);
|
|
- if (dclBorderList1.size() > 0) {
|
|
|
|
- tbGroup.setLeaderId(tbPeople.getId())
|
|
|
|
- .setLeaderName(tbPeople.getName())
|
|
|
|
- .setLeaderPhone(tbPeople.getPhone());
|
|
|
|
|
|
|
|
|
|
+ if (dclBorderList1.size() > 0) {
|
|
AppUserDto appUser = adminInterface.getByFkId(tbPeople.getId());
|
|
AppUserDto appUser = adminInterface.getByFkId(tbPeople.getId());
|
|
if (appUser != null) {
|
|
if (appUser != null) {
|
|
appUser.setUserType(2);
|
|
appUser.setUserType(2);
|
|
@@ -420,16 +429,22 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //修改
|
|
|
|
- BeanUtils.copyProperties(groupDto, tbGroup);
|
|
|
|
- tbGroup.setUpdateTime(new Date());
|
|
|
|
|
|
+
|
|
|
|
+ for (DclBorderList dclBorder : dclBorderList) {
|
|
|
|
+ TbPeople p = tbPeopleService.findByIdCarNo(dclBorder.getIdCardNo());
|
|
|
|
+ if(p != null) {
|
|
|
|
+ tbGroup.setLeaderId(p.getId()).setLeaderName(p.getName()).setLeaderPhone(p.getPhone());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
super.saveOrUpdate(tbGroup);
|
|
super.saveOrUpdate(tbGroup);
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- public TbGroup findByAreaCodeAndSeqCode(Long tradeId, String platSeqNo) {
|
|
|
|
|
|
+ public TbGroup findByAreaCodeAndSeqCode(Long tradeId, String shopsSccd) {
|
|
QueryWrapper<TbGroup> ew = new QueryWrapper<>();
|
|
QueryWrapper<TbGroup> ew = new QueryWrapper<>();
|
|
- ew.lambda().eq(TbGroup::getPlatSeqNo, platSeqNo).eq(TbGroup::getTradeAreaId, tradeId);
|
|
|
|
|
|
+ ew.lambda().eq(TbGroup::getShopsSccd, shopsSccd).eq(TbGroup::getTradeAreaId, tradeId).orderByDesc(TbGroup::getCreateTime);
|
|
List<TbGroup> list = list(ew);
|
|
List<TbGroup> list = list(ew);
|
|
return list.isEmpty() ? null : list.get(0);
|
|
return list.isEmpty() ? null : list.get(0);
|
|
}
|
|
}
|