|
@@ -3,6 +3,7 @@ package com.jeeplus.test.workClientInfo.service;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
+import com.jeeplus.sys.utils.DictUtils;
|
|
|
import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
@@ -10,11 +11,13 @@ import com.jeeplus.test.oss.mapper.OssServiceMapper;
|
|
|
import com.jeeplus.test.oss.service.OssService;
|
|
|
import com.jeeplus.test.workClientInfo.domain.WorkClientBank;
|
|
|
import com.jeeplus.test.workClientInfo.domain.WorkClientInfo;
|
|
|
+import com.jeeplus.test.workClientInfo.domain.WorkClientJobTypeInfo;
|
|
|
import com.jeeplus.test.workClientInfo.domain.WorkClientLinkman;
|
|
|
import com.jeeplus.test.workClientInfo.domain.dto.PageInfoDto;
|
|
|
import com.jeeplus.test.workClientInfo.domain.dto.WorkClientInfosDto;
|
|
|
import com.jeeplus.test.workClientInfo.mapper.WorkClientBankMapper;
|
|
|
import com.jeeplus.test.workClientInfo.mapper.WorkClientInfoMapper;
|
|
|
+import com.jeeplus.test.workClientInfo.mapper.WorkClientJobTypeInfoMapper;
|
|
|
import com.jeeplus.test.workClientInfo.mapper.WorkClientLinkmanMapper;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.flowable.editor.language.json.converter.util.CollectionUtils;
|
|
@@ -22,6 +25,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.UUID;
|
|
@@ -43,6 +47,9 @@ public class WorkClientService {
|
|
|
private OssServiceMapper ossServiceMapper;
|
|
|
|
|
|
@Resource
|
|
|
+ private WorkClientJobTypeInfoMapper workClientJobTypeInfoMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
private OssService ossService;
|
|
|
|
|
|
/**
|
|
@@ -50,8 +57,7 @@ public class WorkClientService {
|
|
|
* @param pageInfoDto
|
|
|
* @return
|
|
|
*/
|
|
|
- public Page<WorkClientInfo> list(PageInfoDto pageInfoDto) {
|
|
|
- Page<WorkClientInfo> page = new Page<>(pageInfoDto.getPageNumber(), pageInfoDto.getPageSize());
|
|
|
+ public Page<WorkClientInfo> list(PageInfoDto pageInfoDto, Page page) {
|
|
|
LambdaQueryWrapper<WorkClientInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
if (StringUtils.isNotEmpty(pageInfoDto.getName())) {
|
|
|
lambdaQueryWrapper.eq(WorkClientInfo::getName, pageInfoDto.getName());
|
|
@@ -61,6 +67,27 @@ public class WorkClientService {
|
|
|
}
|
|
|
lambdaQueryWrapper.orderByDesc(WorkClientInfo::getUpdateDate);
|
|
|
Page<WorkClientInfo> infoPage = workClientInfoMapper.selectPage(page, lambdaQueryWrapper);
|
|
|
+ List<WorkClientInfo> records = infoPage.getRecords();
|
|
|
+ if (CollectionUtils.isNotEmpty(records)) {
|
|
|
+ records.stream().forEach(i -> {
|
|
|
+ UserDTO userDTO = UserUtils.get(i.getCreateBy());
|
|
|
+ i.setCreateBy(userDTO.getName());
|
|
|
+ //客户行业
|
|
|
+ LambdaQueryWrapper<WorkClientJobTypeInfo> wrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper3.eq(WorkClientJobTypeInfo::getWorkClientId, i.getId());
|
|
|
+ List<WorkClientJobTypeInfo> infos = workClientJobTypeInfoMapper.selectList(wrapper3);
|
|
|
+ if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
+ String s = new String();
|
|
|
+ for (WorkClientJobTypeInfo info : infos) {
|
|
|
+ String jobTypeId = info.getJobTypeId();
|
|
|
+ s = s + "," + jobTypeId;
|
|
|
+ }
|
|
|
+ s.substring(1, s.length()-1);
|
|
|
+ i.setDeputy(s);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ infoPage.setRecords(records);
|
|
|
+ }
|
|
|
return infoPage;
|
|
|
}
|
|
|
|
|
@@ -84,6 +111,17 @@ public class WorkClientService {
|
|
|
workClientInfo.setCompanyId(dto.getCompanyDTO().getId());
|
|
|
workClientInfo.setOfficeId(dto.getOfficeDTO().getId());
|
|
|
workClientInfoMapper.insert(workClientInfo);
|
|
|
+ //客户行业处理
|
|
|
+ String deputy = workClientInfo.getDeputy();
|
|
|
+ if (StringUtils.isNotEmpty(deputy)) {
|
|
|
+ List<String> list = Arrays.asList(deputy.split(","));
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+ WorkClientJobTypeInfo info = new WorkClientJobTypeInfo();
|
|
|
+ info.setWorkClientId(id);
|
|
|
+ info.setJobTypeId(i);
|
|
|
+ workClientJobTypeInfoMapper.insert(info);
|
|
|
+ });
|
|
|
+ }
|
|
|
//开户行信息处理
|
|
|
List<WorkClientBank> workClientBank = workClientInfosDto.getWorkClientBank();
|
|
|
if (CollectionUtils.isNotEmpty(workClientBank)) {
|
|
@@ -138,6 +176,10 @@ public class WorkClientService {
|
|
|
public String removeById (String id) {
|
|
|
//客户信息删除
|
|
|
workClientInfoMapper.deleteById(id);
|
|
|
+ //客户行业处理
|
|
|
+ LambdaQueryWrapper<WorkClientJobTypeInfo> wrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper3.eq(WorkClientJobTypeInfo::getWorkClientId, id);
|
|
|
+ workClientJobTypeInfoMapper.delete(wrapper3);
|
|
|
//客户关联开户行信息删除
|
|
|
LambdaQueryWrapper<WorkClientBank> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(WorkClientBank::getClientId, id);
|
|
@@ -160,8 +202,22 @@ public class WorkClientService {
|
|
|
*/
|
|
|
public WorkClientInfosDto findById (String id) {
|
|
|
WorkClientInfosDto dto = new WorkClientInfosDto();
|
|
|
+ WorkClientInfo workClientInfo = workClientInfoMapper.selectById(id);
|
|
|
+ //客户行业查询
|
|
|
+ LambdaQueryWrapper<WorkClientJobTypeInfo> wrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper3.eq(WorkClientJobTypeInfo::getWorkClientId, id);
|
|
|
+ List<WorkClientJobTypeInfo> infos = workClientJobTypeInfoMapper.selectList(wrapper3);
|
|
|
+ if (CollectionUtils.isNotEmpty(infos)) {
|
|
|
+ String s = new String();
|
|
|
+ for (WorkClientJobTypeInfo info : infos) {
|
|
|
+ String jobTypeId = info.getJobTypeId();
|
|
|
+ s = s + "," + jobTypeId;
|
|
|
+ }
|
|
|
+ s.substring(1, s.length()-1);
|
|
|
+ workClientInfo.setDeputy(s);
|
|
|
+ }
|
|
|
//客户信息查询
|
|
|
- dto.setWorkClientInfo(workClientInfoMapper.selectById(id));
|
|
|
+ dto.setWorkClientInfo(workClientInfo);
|
|
|
//客户关联开户行信息查询
|
|
|
LambdaQueryWrapper<WorkClientBank> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(WorkClientBank::getClientId, id);
|
|
@@ -191,6 +247,20 @@ public class WorkClientService {
|
|
|
UserDTO dto = UserUtils.getCurrentUserDTO();
|
|
|
//客户信息处理
|
|
|
WorkClientInfo workClientInfo = workClientInfosDto.getWorkClientInfo();
|
|
|
+ //客户行业处理
|
|
|
+ LambdaQueryWrapper<WorkClientJobTypeInfo> wrapper3 = new LambdaQueryWrapper<>();
|
|
|
+ wrapper3.eq(WorkClientJobTypeInfo::getWorkClientId, workClientInfo.getId());
|
|
|
+ workClientJobTypeInfoMapper.delete(wrapper3);
|
|
|
+ String deputy = workClientInfo.getDeputy();
|
|
|
+ if (StringUtils.isNotEmpty(deputy)) {
|
|
|
+ List<String> list = Arrays.asList(deputy.split(","));
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+ WorkClientJobTypeInfo info = new WorkClientJobTypeInfo();
|
|
|
+ info.setWorkClientId(workClientInfo.getId());
|
|
|
+ info.setJobTypeId(i);
|
|
|
+ workClientJobTypeInfoMapper.insert(info);
|
|
|
+ });
|
|
|
+ }
|
|
|
workClientInfo.setUpdateBy(dto.getId());
|
|
|
workClientInfo.setUpdateDate(new Date());
|
|
|
workClientInfo.setCompanyId(dto.getCompanyDTO().getId());
|
|
@@ -235,4 +305,10 @@ public class WorkClientService {
|
|
|
return "更新完成!";
|
|
|
}
|
|
|
|
|
|
+ public List<WorkClientInfo> findListByName(String name) {
|
|
|
+ LambdaQueryWrapper<WorkClientInfo> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.like(WorkClientInfo::getName, name);
|
|
|
+ List<WorkClientInfo> workClientInfos = workClientInfoMapper.selectList(wrapper);
|
|
|
+ return workClientInfos;
|
|
|
+ }
|
|
|
}
|