Pārlūkot izejas kodu

代码提交:
1.客户管理代码提交

sunruiqi 2 gadi atpakaļ
vecāks
revīzija
d77b3ecffe

+ 68 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/controller/WorkClientController.java

@@ -0,0 +1,68 @@
+package com.jeeplus.test.workClientInfo.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jeeplus.test.workClientInfo.domain.WorkClientInfo;
+import com.jeeplus.test.workClientInfo.domain.dto.PageInfoDto;
+import com.jeeplus.test.workClientInfo.domain.dto.WorkClientInfosDto;
+import com.jeeplus.test.workClientInfo.service.WorkClientService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+@Slf4j
+@Api(tags ="workClientInfo")
+@RestController
+@RequestMapping(value = "/workClientInfo/workClientInfo")
+public class WorkClientController {
+
+    @Resource
+    private WorkClientService workClientService;
+
+    /**
+     * 客户信息列表
+     */
+    @ApiOperation(value = "客户信息列表")
+    @PostMapping(value = "list")
+    public Page<WorkClientInfo> list(@RequestBody PageInfoDto pageInfoDto) {
+        return workClientService.list(pageInfoDto);
+    }
+
+    /**
+     * 客户信息新增
+     */
+    @ApiOperation(value = "客户信息新增")
+    @PostMapping(value = "add")
+    public String add(@RequestBody WorkClientInfosDto workClientInfosDto) {
+        return workClientService.add(workClientInfosDto);
+    }
+
+    /**
+     * 客户信息删除
+     */
+    @ApiOperation(value = "客户信息删除")
+    @GetMapping(value = "remove")
+    public String remove(@RequestParam String id) {
+        return workClientService.removeById(id);
+    }
+
+    /**
+     * 客户信息查询
+     */
+    @ApiOperation(value = "客户信息查询")
+    @GetMapping(value = "findById")
+    public WorkClientInfosDto findById(@RequestParam String id) {
+        return workClientService.findById(id);
+    }
+
+    /**
+     * 客户信息更新
+     */
+    @ApiOperation(value = "客户信息更新")
+    @PostMapping(value = "update")
+    public String update(@RequestBody WorkClientInfosDto workClientInfosDto) {
+        return workClientService.update(workClientInfosDto);
+    }
+}

+ 31 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/WorkClientBank.java

@@ -0,0 +1,31 @@
+package com.jeeplus.test.workClientInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+@TableName("work_client_bank")
+public class WorkClientBank extends BaseEntity {
+
+    /**
+     * 开户银行
+     */
+    private String ourBank;
+
+    /**
+     * 开户账号
+     */
+    private String bankNumber;
+
+    /**
+     * 备注信息
+     */
+    private String remarks;
+
+    /**
+     * 外键关联客户信息表
+     */
+    private String clientId;
+
+}

+ 130 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/WorkClientInfo.java

@@ -0,0 +1,130 @@
+package com.jeeplus.test.workClientInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 客户管理Entity
+ * @author 丁旭
+ * @version 2017-03-20
+ */
+@Data
+@TableName("work_client_info")
+public class WorkClientInfo extends BaseEntity {
+
+    /**
+     * 客户名称
+     */
+    private String name;
+
+    /**
+     * 客户名称缩写
+     */
+    private String nameForShort;
+
+    /**
+     * 组织机构代码
+     */
+    private String orUnicode;
+
+    /**
+     * 客户性质
+     */
+    private String companyType;
+
+    /**
+     * 客户行业
+     */
+    private String companyIndustry;
+
+    /**
+     * 客户类型
+     */
+    private String clientType;
+
+    /**
+     * 信用等级
+     */
+    private String creditRank;
+
+    /**
+     * 地区Id
+     */
+    private String areaId;
+
+    /**
+     * 邮政编码
+     */
+    private String zipCode;
+
+    /**
+     * 传真
+     */
+    private String fax;
+
+    /**
+     * 税务号
+     */
+    private String taxId;
+
+    /**
+     * 电子邮箱
+     */
+    private String email;
+
+    /**
+     * 详细地址
+     */
+    private String address;
+
+    /**
+     * 注册地址
+     */
+    private String registerAddress;
+
+    /**
+     * 公司网址
+     */
+    private String companyUrl;
+
+    /**
+     * 单位简介
+     */
+    private String remarks;
+
+    /**
+     * 创建人所属公司id
+     */
+    private String companyId;
+
+    /**
+     * 创建人所属部门id
+     */
+    private String officeId;
+
+    /**
+     * 地区父节点
+     */
+    private String areaParentIds;
+
+    /**
+     * 公司电话
+     */
+    private String telephone;
+
+    /**
+     * 是否拥有统一社会信用代码  1:有,2无
+     */
+    private Integer hasUscc;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String uscCode;
+
+    /**
+     * 客户编号
+     */
+    private String number;
+}

+ 57 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/WorkClientLinkman.java

@@ -0,0 +1,57 @@
+package com.jeeplus.test.workClientInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import liquibase.pro.packaged.S;
+import lombok.Data;
+
+@Data
+@TableName("work_client_linkman")
+public class WorkClientLinkman extends BaseEntity {
+
+    /**
+     * 联系人姓名
+     */
+    private String name;
+
+    /**
+     * 部门
+     */
+    private String office;
+
+    /**
+     * 职务
+     */
+    private String position;
+
+    /**
+     * QQ
+     */
+    private String qq;
+
+    /**
+     * 联系人电话
+     */
+    private String linkPhone;
+
+    /**
+     * 联系人手机
+     */
+    private String linkMobile;
+
+    /**
+     * E-mail
+     */
+    private String email;
+
+    /**
+     * 是否默认联系人
+     */
+    private String isDefault;
+
+    /**
+     * 外键关联客户信息表
+     */
+    private String clientId;
+
+}

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

@@ -0,0 +1,16 @@
+package com.jeeplus.test.workClientInfo.domain.dto;
+
+import lombok.Data;
+
+@Data
+public class PageInfoDto {
+
+    private Integer pageSize;
+
+    private Integer pageNumber;
+
+    private String name;
+
+    private String areaId;
+
+}

+ 22 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/domain/dto/WorkClientInfosDto.java

@@ -0,0 +1,22 @@
+package com.jeeplus.test.workClientInfo.domain.dto;
+
+import com.jeeplus.test.oss.domain.WorkAttachment;
+import com.jeeplus.test.workClientInfo.domain.WorkClientBank;
+import com.jeeplus.test.workClientInfo.domain.WorkClientInfo;
+import com.jeeplus.test.workClientInfo.domain.WorkClientLinkman;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class WorkClientInfosDto {
+
+    private WorkClientInfo workClientInfo;
+
+    private List<WorkClientBank> workClientBank;
+
+    private List<WorkClientLinkman> workClientLinkman;
+
+    private List<WorkAttachment> workAttachments;
+
+}

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

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

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

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

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

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

+ 238 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/workClientInfo/service/WorkClientService.java

@@ -0,0 +1,238 @@
+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.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.oss.domain.WorkAttachment;
+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.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.WorkClientLinkmanMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.flowable.editor.language.json.converter.util.CollectionUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+@Slf4j
+@Service
+public class WorkClientService {
+
+    @Resource
+    private WorkClientInfoMapper workClientInfoMapper;
+
+    @Resource
+    private WorkClientBankMapper workClientBankMapper;
+
+    @Resource
+    private WorkClientLinkmanMapper workClientLinkmanMapper;
+
+    @Resource
+    private OssServiceMapper ossServiceMapper;
+
+    @Resource
+    private OssService ossService;
+
+    /**
+     * 客户信息列表
+     * @param pageInfoDto
+     * @return
+     */
+    public Page<WorkClientInfo> list(PageInfoDto pageInfoDto) {
+        Page<WorkClientInfo> page = new Page<>(pageInfoDto.getPageNumber(), pageInfoDto.getPageSize());
+        LambdaQueryWrapper<WorkClientInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        if (StringUtils.isNotEmpty(pageInfoDto.getName())) {
+            lambdaQueryWrapper.eq(WorkClientInfo::getName, pageInfoDto.getName());
+        }
+        if (StringUtils.isNotEmpty(pageInfoDto.getAreaId())) {
+            lambdaQueryWrapper.eq(WorkClientInfo::getAreaId, pageInfoDto.getAreaId());
+        }
+        lambdaQueryWrapper.orderByDesc(WorkClientInfo::getUpdateDate);
+        Page<WorkClientInfo> infoPage = workClientInfoMapper.selectPage(page, lambdaQueryWrapper);
+        return infoPage;
+    }
+
+    /**
+     * 客户信息保存
+     * @param workClientInfosDto
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String add(WorkClientInfosDto workClientInfosDto) {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        //客户信息处理
+        String id = UUID.randomUUID().toString().replace("-", "");
+        WorkClientInfo workClientInfo = workClientInfosDto.getWorkClientInfo();
+        workClientInfo.setId(id);
+        workClientInfo.setCreateBy(dto.getId());
+        workClientInfo.setCreateDate(new Date());
+        workClientInfo.setUpdateBy(dto.getId());
+        workClientInfo.setUpdateDate(new Date());
+        workClientInfo.setCompanyId(dto.getCompanyDTO().getId());
+        workClientInfo.setOfficeId(dto.getOfficeDTO().getId());
+        workClientInfoMapper.insert(workClientInfo);
+        //开户行信息处理
+        List<WorkClientBank> workClientBank = workClientInfosDto.getWorkClientBank();
+        if (CollectionUtils.isNotEmpty(workClientBank)) {
+            workClientBank.stream().forEach(i -> {
+                i.setId(UUID.randomUUID().toString().replace("-", ""));
+                i.setCreateBy(dto.getId());
+                i.setCreateDate(new Date());
+                i.setUpdateBy(dto.getId());
+                i.setUpdateDate(new Date());
+                i.setClientId(id);
+                workClientBankMapper.insert(i);
+            });
+        }
+        //联系人信息处理
+        List<WorkClientLinkman> workClientLinkman = workClientInfosDto.getWorkClientLinkman();
+        if (CollectionUtils.isNotEmpty(workClientLinkman)) {
+            workClientLinkman.stream().forEach(i -> {
+                i.setId(UUID.randomUUID().toString().replace("-", ""));
+                i.setCreateBy(dto.getId());
+                i.setCreateDate(new Date());
+                i.setUpdateBy(dto.getId());
+                i.setUpdateDate(new Date());
+                i.setClientId(id);
+                workClientLinkmanMapper.insert(i);
+            });
+        }
+        //附件信息处理
+        List<WorkAttachment> workAttachments = workClientInfosDto.getWorkAttachments();
+        if (CollectionUtils.isNotEmpty(workAttachments)) {
+            int j = 1;
+            for (WorkAttachment i : workAttachments) {
+                i.setId(UUID.randomUUID().toString().replace("-", ""));
+                i.setCreateBy(dto.getId());
+                i.setCreateDate(new Date());
+                i.setUpdateBy(dto.getId());
+                i.setUpdateDate(new Date());
+                i.setAttachmentId(id);
+                i.setSort(j);
+                ossServiceMapper.insert(i);
+                j++;
+            }
+        }
+        return "添加完成!";
+    }
+
+    /**
+     * 客户信息删除
+     * @param id
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String removeById (String id) {
+        //客户信息删除
+        workClientInfoMapper.deleteById(id);
+        //客户关联开户行信息删除
+        LambdaQueryWrapper<WorkClientBank> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(WorkClientBank::getClientId, id);
+        workClientBankMapper.delete(wrapper);
+        //客户关联紧急联系人信息删除
+        LambdaQueryWrapper<WorkClientLinkman> wrapper1 = new LambdaQueryWrapper<>();
+        wrapper1.eq(WorkClientLinkman::getClientId, id);
+        workClientLinkmanMapper.delete(wrapper1);
+        //客户关联附件信息删除
+        LambdaQueryWrapper<WorkAttachment> wrapper2 = new LambdaQueryWrapper<>();
+        wrapper2.eq(WorkAttachment::getAttachmentId, id);
+        ossServiceMapper.delete(wrapper2);
+        return "删除完成!";
+    }
+
+    /**
+     * 客户信息查询
+     * @param id
+     * @return
+     */
+    public WorkClientInfosDto findById (String id) {
+        WorkClientInfosDto dto = new WorkClientInfosDto();
+        //客户信息查询
+        dto.setWorkClientInfo(workClientInfoMapper.selectById(id));
+        //客户关联开户行信息查询
+        LambdaQueryWrapper<WorkClientBank> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(WorkClientBank::getClientId, id);
+        wrapper.orderByDesc(WorkClientBank::getUpdateDate);
+        dto.setWorkClientBank(workClientBankMapper.selectList(wrapper));
+        //客户关联紧急联系人信息查询
+        LambdaQueryWrapper<WorkClientLinkman> wrapper1 = new LambdaQueryWrapper<>();
+        wrapper1.eq(WorkClientLinkman::getClientId, id);
+        wrapper1.orderByDesc(WorkClientLinkman::getUpdateDate);
+        dto.setWorkClientLinkman(workClientLinkmanMapper.selectList(wrapper1));
+        //客户关联附件信息查询
+        LambdaQueryWrapper<WorkAttachment> wrapper2 = new LambdaQueryWrapper<>();
+        wrapper2.eq(WorkAttachment::getAttachmentId, id);
+        wrapper2.orderByAsc(WorkAttachment::getSort);
+        dto.setWorkAttachments(ossServiceMapper.selectList(wrapper2));
+        return dto;
+    }
+
+    /**
+     * 客户信息更新
+     * @param workClientInfosDto
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String update(WorkClientInfosDto workClientInfosDto) {
+        //获取当前登录人信息
+        UserDTO dto = UserUtils.getCurrentUserDTO();
+        //客户信息处理
+        WorkClientInfo workClientInfo = workClientInfosDto.getWorkClientInfo();
+        workClientInfo.setUpdateBy(dto.getId());
+        workClientInfo.setUpdateDate(new Date());
+        workClientInfo.setCompanyId(dto.getCompanyDTO().getId());
+        workClientInfo.setOfficeId(dto.getOfficeDTO().getId());
+        workClientInfoMapper.updateById(workClientInfo);
+        //开户行信息处理(先删除原有数据,再进行数据添加)
+        List<WorkClientBank> workClientBank = workClientInfosDto.getWorkClientBank();
+        if (CollectionUtils.isNotEmpty(workClientBank)) {
+            LambdaQueryWrapper<WorkClientBank> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(WorkClientBank::getClientId, workClientInfo.getId());
+            workClientBankMapper.delete(wrapper);
+            workClientBank.stream().forEach(i -> {
+                i.setCreateBy(dto.getId());
+                i.setCreateDate(new Date());
+                i.setUpdateBy(dto.getId());
+                i.setUpdateDate(new Date());
+                i.setClientId(workClientInfo.getId());
+                workClientBankMapper.insert(i);
+            });
+        }
+        //联系人信息处理
+        List<WorkClientLinkman> workClientLinkman = workClientInfosDto.getWorkClientLinkman();
+        if (CollectionUtils.isNotEmpty(workClientLinkman)) {
+            LambdaQueryWrapper<WorkClientLinkman> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(WorkClientLinkman::getClientId, workClientInfo.getId());
+            workClientLinkmanMapper.delete(wrapper);
+            workClientLinkman.stream().forEach(i -> {
+                i.setCreateBy(dto.getId());
+                i.setCreateDate(new Date());
+                i.setUpdateBy(dto.getId());
+                i.setUpdateDate(new Date());
+                i.setClientId(workClientInfo.getId());
+                workClientLinkmanMapper.insert(i);
+            });
+        }
+        //附件信息处理
+        List<WorkAttachment> workAttachments = workClientInfosDto.getWorkAttachments();
+        if (CollectionUtils.isNotEmpty(workAttachments)) {
+            workAttachments.stream().forEach(i -> i.setAttachmentId(workClientInfo.getId()));
+            ossService.saveMsg(workAttachments);
+        }
+        return "更新完成!";
+    }
+
+}