|
|
@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
@ -34,6 +35,7 @@ import com.epmet.entity.IcResiUserEntity; |
|
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
|
import com.epmet.redis.IcResiUserRedis; |
|
|
|
import com.epmet.service.IcResiUserService; |
|
|
|
import oracle.sql.NUMBER; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
@ -41,10 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户基础信息 |
|
|
@ -163,7 +162,52 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
* @Description 党建互联平台--修改居民信息 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void edit(IcResiUserFormDTO formDTO) { |
|
|
|
public void edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { |
|
|
|
//1.校验主表数据是否存在
|
|
|
|
String resiUserId = ""; |
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
for (IcResiUserFormDTO d : formDTO) { |
|
|
|
if ("ic_resi_user".equals(d.getTableName())) { |
|
|
|
map = d.getList().get(0); |
|
|
|
if (!map.containsKey("ID")) { |
|
|
|
throw new RenException(String.format("居民信息修改-居民信息表主键值为空")); |
|
|
|
} |
|
|
|
resiUserId = map.get("ID"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (null == map) { |
|
|
|
throw new RenException(String.format("居民信息修改,参数错误,未传入基础信息Id")); |
|
|
|
} |
|
|
|
IcResiUserEntity entity = baseDao.selectById(resiUserId); |
|
|
|
if (null == entity) { |
|
|
|
throw new RenException(String.format("居民信息修改,获取基础信息失败,基础信息Id->", resiUserId)); |
|
|
|
} |
|
|
|
//2.更新主表数据
|
|
|
|
if (map.size() > NumConstant.ONE) { |
|
|
|
map.put("updated_by", tokenDto.getUserId()); |
|
|
|
baseDao.upTable("ic_resi_user", resiUserId, map); |
|
|
|
} |
|
|
|
|
|
|
|
//3.循环更新或新增字表数据
|
|
|
|
String finalResiUserId = resiUserId; |
|
|
|
formDTO.forEach(d -> { |
|
|
|
if (!"ic_resi_user".equals(d.getTableName())) { |
|
|
|
d.getList().forEach(hash -> { |
|
|
|
hash.put("updated_by", tokenDto.getUserId()); |
|
|
|
if (!hash.containsKey("ID")) { |
|
|
|
hash.put("id", UUID.randomUUID().toString().replaceAll("-", "")); |
|
|
|
hash.put("ic_resi_user", finalResiUserId); |
|
|
|
hash.put("customer_id", tokenDto.getCustomerId()); |
|
|
|
hash.put("created_by", tokenDto.getUserId()); |
|
|
|
//字表新增数据
|
|
|
|
baseDao.add(d.getTableName(), hash); |
|
|
|
} else { |
|
|
|
//字表更新数据
|
|
|
|
baseDao.upTable(d.getTableName(), hash.get("ID"), hash); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|