|
@ -116,6 +116,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
* @Description 党建互联平台--保存居民信息 |
|
|
* @Description 党建互联平台--保存居民信息 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
public void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
//循环自动拼接sql语句,往多个表新增数据
|
|
|
//循环自动拼接sql语句,往多个表新增数据
|
|
|
//1.先往主表新增数据
|
|
|
//1.先往主表新增数据
|
|
@ -123,7 +124,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
String resiUserId = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
String resiUserId = UUID.randomUUID().toString().replaceAll("-", ""); |
|
|
formDTO.forEach(d -> { |
|
|
formDTO.forEach(d -> { |
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
Map<String, String> map = d.getList().get(0); |
|
|
LinkedHashMap<String, String> map = d.getList().get(0); |
|
|
map.put("id", resiUserId); |
|
|
map.put("id", resiUserId); |
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
|
map.put("created_by", tokenDto.getUserId()); |
|
|
map.put("created_by", tokenDto.getUserId()); |
|
@ -143,7 +144,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
//2.循环字表新增数据
|
|
|
//2.循环字表新增数据
|
|
|
formDTO.forEach(d -> { |
|
|
formDTO.forEach(d -> { |
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
d.getList().forEach(map -> { |
|
|
for (LinkedHashMap<String, String> map : d.getList()) { |
|
|
map.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
map.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
map.put("ic_resi_user", resiUserId); |
|
|
map.put("ic_resi_user", resiUserId); |
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
|
map.put("customer_id", tokenDto.getCustomerId()); |
|
@ -151,7 +152,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
map.put("updated_by", tokenDto.getUserId()); |
|
|
map.put("updated_by", tokenDto.getUserId()); |
|
|
//字表新增数据
|
|
|
//字表新增数据
|
|
|
baseDao.add(d.getTableName(), map); |
|
|
baseDao.add(d.getTableName(), map); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -162,10 +163,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
* @Description 党建互联平台--修改居民信息 |
|
|
* @Description 党建互联平台--修改居民信息 |
|
|
**/ |
|
|
**/ |
|
|
@Override |
|
|
@Override |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
public void edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
//1.校验主表数据是否存在
|
|
|
//1.校验主表数据是否存在
|
|
|
String resiUserId = ""; |
|
|
String resiUserId = ""; |
|
|
Map<String, String> map = new HashMap<>(); |
|
|
LinkedHashMap<String, String> map = new LinkedHashMap<>(); |
|
|
for (IcResiUserFormDTO d : formDTO) { |
|
|
for (IcResiUserFormDTO d : formDTO) { |
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
map = d.getList().get(0); |
|
|
map = d.getList().get(0); |
|
@ -192,7 +194,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
String finalResiUserId = resiUserId; |
|
|
String finalResiUserId = resiUserId; |
|
|
formDTO.forEach(d -> { |
|
|
formDTO.forEach(d -> { |
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
d.getList().forEach(hash -> { |
|
|
for (LinkedHashMap<String, String> hash : d.getList()) { |
|
|
hash.put("updated_by", tokenDto.getUserId()); |
|
|
hash.put("updated_by", tokenDto.getUserId()); |
|
|
if (!hash.containsKey("ID")) { |
|
|
if (!hash.containsKey("ID")) { |
|
|
hash.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
hash.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
@ -205,7 +207,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
//字表更新数据
|
|
|
//字表更新数据
|
|
|
baseDao.upTable(d.getTableName(), hash.get("ID"), hash); |
|
|
baseDao.upTable(d.getTableName(), hash.get("ID"), hash); |
|
|
} |
|
|
} |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|