Commit b2c54c4e authored by wujipeng's avatar wujipeng
Browse files

用户新增,用户添加关系优化

parent 6d6063cd
......@@ -2,6 +2,7 @@ package com.platform.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
......@@ -25,6 +26,7 @@ import com.platform.service.UserRelationService;
import com.platform.service.UserService;
import com.platform.utils.DozerUtils;
import com.platform.utils.IdCardUtils;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -196,23 +198,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
public Boolean add(UserDTO userDTO) {
//解析身份证号
Map<String, String> idCardInfo = IdCardUtils.parseIdCardInfo(userDTO.getIdCard());
ExcelDataEntity excelDataEntity = new ExcelDataEntity();
if (MapUtil.isNotEmpty(idCardInfo)) {
userDTO.setAge(Integer.parseInt(idCardInfo.get("age")));
userDTO.setSex(idCardInfo.get("sex"));
userDTO.setIdCard(idCardInfo.get("idCard"));
userDTO.setUserName(userDTO.getUserName() + idCardInfo.get("idCard"));
userDTO.setIdType("身份证");
excelDataEntity.setPayUserName(userDTO.getUserName());
excelDataEntity.setPayeeName(userDTO.getUserName());
} else {
excelDataEntity.setPayUserName(userDTO.getUserName());
excelDataEntity.setPayeeName(userDTO.getUserName());
}
excelDataEntity.setCaseId(userDTO.getCaseId());
excelDataEntity.setUseFlag(true);
//添加节点数据
excelDataService.save(excelDataEntity);
userDTO.setType("1");
return save(userDTO);
}
......@@ -296,7 +288,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity> impleme
}
@Override
@Transactional
public Boolean relationSaveOrUpdate(List<UserRelationEntity> userRelationList) {
//添加连线
List<ExcelDataEntity> excelDataList = Lists.newArrayList();
for (UserRelationEntity userRelation : userRelationList) {
ExcelDataEntity excelDataEntity = new ExcelDataEntity();
excelDataEntity.setPayUserName(userRelation.getUserName());
excelDataEntity.setPayeeName(userRelation.getOtherName());
excelDataEntity.setCaseId(Integer.parseInt(userRelation.getCaseId()));
excelDataEntity.setUseFlag(true);
excelDataEntity.setUserFlag(true);
excelDataList.add(excelDataEntity);
}
excelDataService.saveBatch(excelDataList);
return userRelationService.saveOrUpdateBatch(userRelationList);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment