|
|
@@ -7,15 +7,19 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.client.corps.excel.CorpsExcel;
|
|
|
import org.springblade.client.corps.mapper.CorpsDescMapper;
|
|
|
import org.springblade.client.corps.mapper.CorpsTypeDescMapper;
|
|
|
import org.springblade.client.corps.mapper.CorpsTypeMapper;
|
|
|
import org.springblade.client.corps.service.ICorpsDescService;
|
|
|
import org.springblade.client.entity.*;
|
|
|
import org.springblade.client.vo.CorpsDescVO;
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
+import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.system.entity.Dept;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
@@ -43,6 +47,8 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
private CorpsTypeDescServiceImpl corpsTypeDescService;//客户与客户类别对应表
|
|
|
private CorpsTypeDescMapper corpsTypeDescMapper;
|
|
|
private CorpsTypeServiceImpl corpsTypeService;
|
|
|
+ @Autowired
|
|
|
+ private CorpsTypeDescMapper middleMapper;
|
|
|
|
|
|
@Override
|
|
|
public IPage<CorpsDescVO> selectCorpsDescPage(IPage<CorpsDescVO> page, CorpsDescVO corpsDesc) {
|
|
|
@@ -157,6 +163,57 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
return baseMapper.selectCorpsDescCname(cname,tenantId);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void importUser(List<CorpsExcel> data, Boolean isCovered)
|
|
|
+ {
|
|
|
+ if(org.springframework.util.CollectionUtils.isEmpty(data))
|
|
|
+ {
|
|
|
+ throw new SecurityException("导入数据不能为空");
|
|
|
+ }
|
|
|
+ data.forEach(e->{
|
|
|
+ CorpsDesc corpsDesc=new CorpsDesc();
|
|
|
+ corpsDesc.setCode(e.getCode());
|
|
|
+ corpsDesc.setCname(e.getCname());
|
|
|
+ corpsDesc.setAttn(e.getAttn());
|
|
|
+ corpsDesc.setAttn(e.getAttn());
|
|
|
+ corpsDesc.setTel(e.getTel());
|
|
|
+ corpsDesc.setAddr(e.getAddr());
|
|
|
+ corpsDesc.setAccountBank(e.getAccountBank());
|
|
|
+ corpsDesc.setAccountName(e.getAccountName());
|
|
|
+ corpsDesc.setAccountNo(e.getAccountNo());
|
|
|
+ corpsDesc.setAccountBankFcy(e.getAccountBankFcy());
|
|
|
+ corpsDesc.setAccountNameFcy(e.getAccountNameFcy());
|
|
|
+ corpsDesc.setTenantId(AuthUtil.getTenantId());
|
|
|
+ corpsDesc.setAccountNoFcy(e.getAccountNoFcy());
|
|
|
+ QueryWrapper<CorpsDesc> queryWrapper = Condition.getQueryWrapper(corpsDesc);
|
|
|
+ CorpsDesc selectOne = baseMapper.selectOne(queryWrapper);
|
|
|
+ if(selectOne==null)
|
|
|
+ {
|
|
|
+ corpsDesc.setCreateTime(new Date());
|
|
|
+ corpsDesc.setCreateUser(AuthUtil.getUserId());
|
|
|
+ corpsDesc.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
+ baseMapper.insert(corpsDesc);
|
|
|
+
|
|
|
+ CorpsTypeDesc middle=new CorpsTypeDesc();
|
|
|
+ middle.setCorpId(corpsDesc.getId());
|
|
|
+ middle.setCorpTypeId(Long.valueOf(e.getTypeId()));
|
|
|
+ middle.setCreateTime(new Date());
|
|
|
+ middle.setCreateUser(AuthUtil.getUserId());
|
|
|
+ middle.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
|
|
|
+ middleMapper.insert(middle);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ selectOne.setUpdateTime(new Date());
|
|
|
+ selectOne.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ baseMapper.updateById(selectOne);
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 保护客户联系人信息
|
|
|
*
|
|
|
@@ -333,4 +390,6 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
}
|