|
|
@@ -18,12 +18,13 @@ package org.springblade.client.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
|
|
+import io.minio.messages.Item;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springblade.client.entity.CorpsDesc;
|
|
|
-import org.springblade.client.entity.CorpsFiles;
|
|
|
-import org.springblade.client.entity.CorpsTypeDesc;
|
|
|
+import org.springblade.client.entity.*;
|
|
|
import org.springblade.client.mapper.CorpsAttnMapper;
|
|
|
+import org.springblade.client.mapper.CorpsTypeDescMapper;
|
|
|
import org.springblade.client.vo.CorpsDescVO;
|
|
|
import org.springblade.client.mapper.CorpsDescMapper;
|
|
|
import org.springblade.client.service.ICorpsDescService;
|
|
|
@@ -37,6 +38,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -55,6 +58,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
private CorpsFilesServiceImpl corpsFilesService;//客户文件
|
|
|
private CorpsItemServiceImpl corpsItemService;//客户优势项目
|
|
|
private CorpsTypeDescServiceImpl corpsTypeDescService;//客户与客户类别对应表
|
|
|
+ private CorpsTypeDescMapper corpsTypeDescMapper;
|
|
|
@Override
|
|
|
public IPage<CorpsDescVO> selectCorpsDescPage(IPage<CorpsDescVO> page, CorpsDescVO corpsDesc) {
|
|
|
return page.setRecords(baseMapper.selectCorpsDescPage(page, corpsDesc));
|
|
|
@@ -62,7 +66,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public boolean submit(CorpsDesc corpsDesc) {
|
|
|
+ public CorpsDesc submit(CorpsDesc corpsDesc) {
|
|
|
boolean flag = false;
|
|
|
Integer i ;
|
|
|
if (StringUtil.isBlank(corpsDesc.getTenantId())) {
|
|
|
@@ -91,12 +95,30 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
//保存客户与类别对应关系
|
|
|
flag = this.saveOrUpdateTypeDesc(corpsDesc,userId,pId,date);
|
|
|
if (i != null && i>0){
|
|
|
- flag = true;
|
|
|
+ return corpsDesc;
|
|
|
}else {
|
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ return null;
|
|
|
}
|
|
|
- return flag;
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public CorpsDesc getMessageByID(CorpsDesc corpsDesc) {
|
|
|
+ CorpsDesc desc = baseMapper.selectById(corpsDesc.getId());
|
|
|
+ if (desc!= null){
|
|
|
+ //获取客户联系人
|
|
|
+ desc.setCorpsAttnList(corpsAttnService.list(new QueryWrapper<CorpsAttn>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0).eq("status", 0)));
|
|
|
+ //获取客户银行
|
|
|
+ desc.setCorpsBankList(corpsBankService.list(new QueryWrapper<CorpsBank>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0).eq("status", 0)));
|
|
|
+ //获取客户文件
|
|
|
+ desc.setCorpsFiles(corpsFilesService.list(new QueryWrapper<CorpsFiles>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0).eq("status", 0)));
|
|
|
+ //获取客户优势项目
|
|
|
+ desc.setCorpsItems(corpsItemService.list(new QueryWrapper<CorpsItem>().eq("pid", corpsDesc.getId()).eq("is_deleted", 0).eq("status", 0)));
|
|
|
+ //获取客户类别
|
|
|
+ List<String> longs = corpsTypeDescMapper.selectTypeId(corpsDesc.getId());
|
|
|
+ desc.setCorpsTypeId(String.join(",",longs));
|
|
|
+ }
|
|
|
+ return desc;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -216,22 +238,30 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, CorpsDesc
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean saveOrUpdateTypeDesc(CorpsDesc corpsDesc,Long userId,Long pId,Date date){
|
|
|
- if (corpsDesc.getCorpsTypeId() != null){
|
|
|
- CorpsTypeDesc typeDesc = corpsTypeDescService.getOne(new QueryWrapper<CorpsTypeDesc>().eq("corp_id", pId));
|
|
|
- if (typeDesc != null){
|
|
|
- typeDesc.setCorpTypeId(corpsDesc.getCorpsTypeId());
|
|
|
- typeDesc.setUpdateTime(DateUtil.fromDate(date));
|
|
|
- typeDesc.setUpdateUser(userId);
|
|
|
- corpsTypeDescService.updateById(typeDesc);
|
|
|
- }else {
|
|
|
- CorpsTypeDesc corpsTypeDesc = new CorpsTypeDesc();
|
|
|
- corpsTypeDesc.setCorpTypeId(corpsDesc.getCorpsTypeId());
|
|
|
- corpsTypeDesc.setCreateUser(userId);
|
|
|
- corpsTypeDesc.setCreateTime(DateUtil.fromDate(date));
|
|
|
- corpsTypeDescService.save(corpsTypeDesc);
|
|
|
- }
|
|
|
+ corpsTypeDescService.remove(new QueryWrapper<CorpsTypeDesc>().eq("corp_id",corpsDesc.getId()));
|
|
|
+ if (StringUtils.isNotBlank(corpsDesc.getCorpsTypeId())){
|
|
|
+ List<String> list = Arrays.asList(corpsDesc.getCorpsTypeId().split(","));
|
|
|
+ list.stream().forEach(item ->{
|
|
|
+ CorpsTypeDesc typeDesc = corpsTypeDescService.getOne(new QueryWrapper<CorpsTypeDesc>().eq("corp_id", pId)
|
|
|
+ .eq("corp_type_id",item));
|
|
|
+ if (typeDesc != null){
|
|
|
+ typeDesc.setCorpTypeId(Long.valueOf(item));
|
|
|
+ typeDesc.setCorpId(corpsDesc.getId());
|
|
|
+ typeDesc.setUpdateTime(DateUtil.fromDate(date));
|
|
|
+ typeDesc.setUpdateUser(userId);
|
|
|
+ corpsTypeDescService.updateById(typeDesc);
|
|
|
+ }else {
|
|
|
+ CorpsTypeDesc corpsTypeDesc = new CorpsTypeDesc();
|
|
|
+ corpsTypeDesc.setCorpId(corpsDesc.getId());
|
|
|
+ corpsTypeDesc.setCorpTypeId(Long.valueOf(item));
|
|
|
+ corpsTypeDesc.setCreateUser(userId);
|
|
|
+ corpsTypeDesc.setCreateTime(DateUtil.fromDate(date));
|
|
|
+ corpsTypeDescService.save(corpsTypeDesc);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|