Prechádzať zdrojové kódy

代码提交:
1.新增根据名称筛选接口;
2.接口添加客户类型处理;

sunruiqi 2 rokov pred
rodič
commit
c55ce07aaf

+ 12 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/controller/WorkClientController.java

@@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @Slf4j
 @Api(tags ="workClientInfo")
@@ -26,8 +27,8 @@ public class WorkClientController {
      */
     @ApiOperation(value = "客户信息列表")
     @PostMapping(value = "list")
-    public Page<WorkClientInfo> list(@RequestBody PageInfoDto pageInfoDto) {
-        return workClientService.list(pageInfoDto);
+    public Page<WorkClientInfo> list(@RequestBody PageInfoDto pageInfoDto, Page<WorkClientInfo> page) {
+        return workClientService.list(pageInfoDto, page);
     }
 
     /**
@@ -65,4 +66,13 @@ public class WorkClientController {
     public String update(@RequestBody WorkClientInfosDto workClientInfosDto) {
         return workClientService.update(workClientInfosDto);
     }
+
+    /**
+     * 客户信息查询
+     */
+    @ApiOperation(value = "客户信息更新")
+    @GetMapping(value = "findListByName")
+    public List<WorkClientInfo> findListByName(@RequestParam String name) {
+        return workClientService.findListByName(name);
+    }
 }

+ 9 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/WorkClientInfo.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.workClientInfo.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.jeeplus.core.domain.BaseEntity;
 import lombok.Data;
@@ -19,9 +20,9 @@ public class WorkClientInfo extends BaseEntity {
     private String name;
 
     /**
-     * 客户名称缩写
+     * 法人代表
      */
-    private String nameForShort;
+    private String lawerPresint;
 
     /**
      * 组织机构代码
@@ -127,4 +128,10 @@ public class WorkClientInfo extends BaseEntity {
      * 客户编号
      */
     private String number;
+
+    /**
+     * 代表方(以逗号分割)
+     */
+    @TableField(exist = false)
+    private String deputy;
 }

+ 14 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/WorkClientJobTypeInfo.java

@@ -0,0 +1,14 @@
+package com.jeeplus.test.workClientInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("work_client_job_type_info")
+public class WorkClientJobTypeInfo {
+
+    private String workClientId;
+
+    private String jobTypeId;
+
+}

+ 0 - 4
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/dto/PageInfoDto.java

@@ -5,10 +5,6 @@ import lombok.Data;
 @Data
 public class PageInfoDto {
 
-    private Integer pageSize;
-
-    private Integer pageNumber;
-
     private String name;
 
     private String areaId;

+ 7 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/mapper/WorkClientJobTypeInfoMapper.java

@@ -0,0 +1,7 @@
+package com.jeeplus.test.workClientInfo.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.workClientInfo.domain.WorkClientJobTypeInfo;
+
+public interface WorkClientJobTypeInfoMapper extends BaseMapper<WorkClientJobTypeInfo> {
+}

+ 79 - 3
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/service/WorkClientService.java

@@ -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;
+    }
 }