Преглед на файлове

增加销售认领记录

cgp преди 6 дни
родител
ревизия
370ec95242

+ 3 - 1
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -135,7 +135,9 @@ public class FsCompanyCustomerController extends BaseController {
      */
     @PostMapping
     public AjaxResult add(@RequestBody FsCompanyCustomer fsCompanyCustomer) {
-        return AjaxResult.success(fsCompanyCustomerService.insertFsCompanyCustomer(fsCompanyCustomer));
+        // 获取当前登录销售
+        CompanyUser companyUser = SecurityUtils.getLoginUser().getUser();
+        return AjaxResult.success(fsCompanyCustomerService.insertFsCompanyCustomer(fsCompanyCustomer,companyUser));
     }
 
     /**

+ 110 - 0
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerLogController.java

@@ -0,0 +1,110 @@
+package com.fs.company.controller.qw;
+
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.qw.domain.FsCompanyCustomerLog;
+import com.fs.qw.service.IFsCompanyCustomerLogService;
+import com.github.pagehelper.PageHelper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 客户信息认领记录Controller
+ *
+ * @author ruoyi
+ * @date 2026-05-28
+ */
+@Slf4j
+@RestController
+@RequestMapping("/qw/customerlog")
+@Api(tags = "客户认领记录管理")
+public class FsCompanyCustomerLogController extends BaseController {
+
+    @Autowired
+    private IFsCompanyCustomerLogService fsCompanyCustomerLogService;
+
+    /**
+     * 查询客户认领记录列表(分页)
+     */
+    @ApiOperation("分页查询认领记录")
+    @GetMapping("/list")
+    public TableDataInfo list(FsCompanyCustomerLog fsCompanyCustomerLog) {
+        PageHelper.startPage(fsCompanyCustomerLog.getPageNum(), fsCompanyCustomerLog.getPageSize());
+        List<FsCompanyCustomerLog> list = fsCompanyCustomerLogService.selectFsCompanyCustomerLogList(fsCompanyCustomerLog);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出客户认领记录
+     */
+    @ApiOperation("导出认领记录")
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, FsCompanyCustomerLog fsCompanyCustomerLog) {
+        List<FsCompanyCustomerLog> list = fsCompanyCustomerLogService.selectFsCompanyCustomerLogList(fsCompanyCustomerLog);
+        ExcelUtil<FsCompanyCustomerLog> util = new ExcelUtil<>(FsCompanyCustomerLog.class);
+        try {
+            util.exportExcel(response, list, "客户认领记录数据");
+        } catch (Exception e) {
+            log.error("导出客户认领记录数据异常", e);
+            throw new CustomException("导出客户认领记录数据异常");
+        }
+    }
+
+    /**
+     * 获取客户认领记录详细信息
+     */
+    @ApiOperation("获取记录详情")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        FsCompanyCustomerLog fsCompanyCustomerLog = fsCompanyCustomerLogService.selectFsCompanyCustomerLogById(id);
+        return AjaxResult.success(fsCompanyCustomerLog);
+    }
+
+    /**
+     * 新增客户认领记录
+     */
+    @ApiOperation("新增认领记录")
+    @PostMapping
+    public AjaxResult add(@RequestBody FsCompanyCustomerLog fsCompanyCustomerLog) {
+        // 设置认领时间为当前时间
+        fsCompanyCustomerLog.setClaimTime(new Date());
+        try {
+            return toAjax(fsCompanyCustomerLogService.insertFsCompanyCustomerLog(fsCompanyCustomerLog));
+        } catch (DuplicateKeyException e) {
+            return AjaxResult.error("数据冲突,请稍后重试");
+        }
+    }
+
+    /**
+     * 修改客户认领记录
+     */
+    @ApiOperation("修改认领记录")
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsCompanyCustomerLog fsCompanyCustomerLog) {
+        try {
+            return toAjax(fsCompanyCustomerLogService.updateFsCompanyCustomerLog(fsCompanyCustomerLog));
+        } catch (DuplicateKeyException e) {
+            return AjaxResult.error("数据冲突,请稍后重试");
+        }
+    }
+
+    /**
+     * 删除客户认领记录
+     */
+    @ApiOperation("删除认领记录")
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return AjaxResult.success(fsCompanyCustomerLogService.deleteFsCompanyCustomerLogByIds(ids));
+    }
+}

+ 7 - 4
fs-service/src/main/java/com/fs/qw/domain/FsCompanyCustomer.java

@@ -87,19 +87,22 @@ public class FsCompanyCustomer extends BaseEntity {
     private Long buyCount;
 
     //认领状态0:未认领,1:已认领
-    private int claimStatus;
+    private Integer claimStatus;
 
-    //完善状态0:未认领,1:已认领
-    private int completeStatus;
+    //完善状态0:未完善,1:已完善
+    private Integer completeStatus;
 
     //归属部门id
-    private int deptId;
+    private Integer deptId;
 
     //归属部门名称
     private String deptName;
 
     //以下字段(非数据库字段,用于接收查询参数)
 
+    /*** 认领号码*/
+    private String claimPhone;
+
     /** 创建时间开始 */
     private String beginCreateTime;
 

+ 57 - 0
fs-service/src/main/java/com/fs/qw/domain/FsCompanyCustomerLog.java

@@ -0,0 +1,57 @@
+package com.fs.qw.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 客户信息认领记录表实体类
+ * 
+ * @author ruoyi
+ * @date 2026-05-28
+ */
+@Data
+@ApiModel("客户认领记录")
+public class FsCompanyCustomerLog extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("主键ID")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("客户信息表主键id")
+    private Long companyCustomerId;
+
+    @ApiModelProperty("认领销售id")
+    private Long companyUserId;
+
+    @ApiModelProperty("认领销售名称")
+    private String companyUserName;
+
+    @ApiModelProperty("认领部门id")
+    private Long deptId;
+
+    @ApiModelProperty("认领部门")
+    private String deptName;
+
+    @ApiModelProperty("认领时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date claimTime;
+
+    /** 认领时间范围*/
+    private Date beginClaimTime;
+    private Date endClaimTime;
+
+    // 分页相关
+    private Integer pageNum;
+    private Integer pageSize;
+}

+ 44 - 0
fs-service/src/main/java/com/fs/qw/mapper/FsCompanyCustomerLogMapper.java

@@ -0,0 +1,44 @@
+package com.fs.qw.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.qw.domain.FsCompanyCustomerLog;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+public interface FsCompanyCustomerLogMapper extends BaseMapper<FsCompanyCustomerLog> {
+
+    /**
+     * 查询记录列表
+     */
+    List<FsCompanyCustomerLog> selectFsCompanyCustomerLogList(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 根据主键查询
+     */
+    FsCompanyCustomerLog selectFsCompanyCustomerLogById(Long id);
+
+    /**
+     * 根据客户信息表主键查询
+     */
+    List<FsCompanyCustomerLog> selectFsCompanyCustomerLogByCustomerId(Long companyCustomerId);
+
+    /**
+     * 新增记录
+     */
+    int insertFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 修改记录
+     */
+    int updateFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 根据主键删除
+     */
+    int deleteFsCompanyCustomerLogById(Long id);
+
+    /**
+     * 批量删除
+     */
+    int deleteFsCompanyCustomerLogByIds(Long[] ids);
+}

+ 69 - 0
fs-service/src/main/java/com/fs/qw/service/IFsCompanyCustomerLogService.java

@@ -0,0 +1,69 @@
+package com.fs.qw.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.qw.domain.FsCompanyCustomerLog;
+
+import java.util.List;
+
+/**
+ * 客户信息认领记录Service接口
+ * 
+ * @author ruoyi
+ */
+public interface IFsCompanyCustomerLogService extends IService<FsCompanyCustomerLog> {
+
+    /**
+     * 查询客户信息认领记录
+     * 
+     * @param id 主键
+     * @return 记录
+     */
+    public FsCompanyCustomerLog selectFsCompanyCustomerLogById(Long id);
+
+    /**
+     * 查询客户信息认领记录列表
+     * 
+     * @param fsCompanyCustomerLog 查询条件
+     * @return 记录集合
+     */
+    public List<FsCompanyCustomerLog> selectFsCompanyCustomerLogList(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 根据客户信息表主键查询
+     * @param companyCustomerId 客户信息表主键
+     * @return  返回该客户信息表下的所有认领记录
+     */
+    List<FsCompanyCustomerLog> selectFsCompanyCustomerLogByCustomerId(Long companyCustomerId);
+
+    /**
+     * 新增客户信息认领记录
+     * 
+     * @param fsCompanyCustomerLog 记录
+     * @return 结果
+     */
+    public int insertFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 修改客户信息认领记录
+     * 
+     * @param fsCompanyCustomerLog 记录
+     * @return 结果
+     */
+    public int updateFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog);
+
+    /**
+     * 批量删除客户信息认领记录
+     * 
+     * @param ids 需要删除的主键集合
+     * @return 结果
+     */
+    public int deleteFsCompanyCustomerLogByIds(Long[] ids);
+
+    /**
+     * 删除客户信息认领记录信息
+     * 
+     * @param id 主键
+     * @return 结果
+     */
+    public int deleteFsCompanyCustomerLogById(Long id);
+}

+ 1 - 1
fs-service/src/main/java/com/fs/qw/service/IFsCompanyCustomerService.java

@@ -17,7 +17,7 @@ public interface IFsCompanyCustomerService {
 
     List<FsCompanyCustomer> selectFsCompanyCustomerList(FsCompanyCustomer fsCompanyCustomer);
 
-    int insertFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
+    int insertFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer,CompanyUser companyUser);
 
     int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer);
 

+ 62 - 0
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerLogServiceImpl.java

@@ -0,0 +1,62 @@
+package com.fs.qw.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.qw.domain.FsCompanyCustomerLog;
+import com.fs.qw.mapper.FsCompanyCustomerLogMapper;
+import com.fs.qw.service.IFsCompanyCustomerLogService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 客户信息认领记录Service业务层处理
+ *
+ * @author ruoyi
+ */
+@Service
+public class FsCompanyCustomerLogServiceImpl extends ServiceImpl<FsCompanyCustomerLogMapper, FsCompanyCustomerLog>
+        implements IFsCompanyCustomerLogService {
+
+    @Autowired
+    private FsCompanyCustomerLogMapper fsCompanyCustomerLogMapper;
+
+    @Override
+    public FsCompanyCustomerLog selectFsCompanyCustomerLogById(Long id) {
+        return fsCompanyCustomerLogMapper.selectFsCompanyCustomerLogById(id);
+    }
+
+    @Override
+    public List<FsCompanyCustomerLog> selectFsCompanyCustomerLogByCustomerId(Long companyCustomerId) {
+        return fsCompanyCustomerLogMapper.selectFsCompanyCustomerLogByCustomerId(companyCustomerId);
+    }
+
+    @Override
+    public List<FsCompanyCustomerLog> selectFsCompanyCustomerLogList(FsCompanyCustomerLog fsCompanyCustomerLog) {
+        return fsCompanyCustomerLogMapper.selectFsCompanyCustomerLogList(fsCompanyCustomerLog);
+    }
+
+    @Override
+    public int insertFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog) {
+        if (fsCompanyCustomerLog.getClaimTime() == null) {
+            fsCompanyCustomerLog.setClaimTime(new Date());
+        }
+        return fsCompanyCustomerLogMapper.insertFsCompanyCustomerLog(fsCompanyCustomerLog);
+    }
+
+    @Override
+    public int updateFsCompanyCustomerLog(FsCompanyCustomerLog fsCompanyCustomerLog) {
+        return fsCompanyCustomerLogMapper.updateFsCompanyCustomerLog(fsCompanyCustomerLog);
+    }
+
+    @Override
+    public int deleteFsCompanyCustomerLogByIds(Long[] ids) {
+        return fsCompanyCustomerLogMapper.deleteFsCompanyCustomerLogByIds(ids);
+    }
+
+    @Override
+    public int deleteFsCompanyCustomerLogById(Long id) {
+        return fsCompanyCustomerLogMapper.deleteFsCompanyCustomerLogById(id);
+    }
+}

+ 68 - 19
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -1,10 +1,14 @@
 package com.fs.qw.service.impl;
 
 import com.fs.common.exception.CustomException;
+import com.fs.company.domain.CompanyDept;
 import com.fs.company.domain.CompanyUser;
+import com.fs.company.mapper.CompanyDeptMapper;
 import com.fs.his.domain.FsImportMember;
 import com.fs.his.mapper.FsImportMemberMapper;
 import com.fs.qw.domain.FsCompanyCustomer;
+import com.fs.qw.domain.FsCompanyCustomerLog;
+import com.fs.qw.mapper.FsCompanyCustomerLogMapper;
 import com.fs.qw.mapper.FsCompanyCustomerMapper;
 import com.fs.qw.param.TransferCustomerParam;
 import com.fs.qw.service.IFsCompanyCustomerService;
@@ -16,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -30,9 +35,15 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     @Autowired
     private FsCompanyCustomerMapper fsCompanyCustomerMapper;
 
+    @Autowired
+    private FsCompanyCustomerLogMapper companyCustomerLogMapper;
+
     @Autowired
     private FsImportMemberMapper importMemberMapper;
 
+    @Autowired
+    private CompanyDeptMapper companyDeptMapper;
+
     @Override
     public FsCompanyCustomer selectFsCompanyCustomerById(Long id) {
         return fsCompanyCustomerMapper.selectFsCompanyCustomerById(id);
@@ -44,22 +55,38 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     }
 
     @Override
-    public int insertFsCompanyCustomer(FsCompanyCustomer customer) {
+    @Transactional(rollbackFor = Exception.class)
+    public int insertFsCompanyCustomer(FsCompanyCustomer customer,CompanyUser companyUser) {
         try {
             customer.setClaimStatus(BigDecimal.ONE.intValue());
-            return fsCompanyCustomerMapper.insertFsCompanyCustomer(customer);
+            setCompleteStatus(customer);
+            int result=fsCompanyCustomerMapper.insertFsCompanyCustomer(customer);
+            //单独新增也需要增加认领日志
+            FsCompanyCustomerLog claimLog = new FsCompanyCustomerLog();
+            claimLog.setCompanyCustomerId(customer.getId());
+            claimLog.setCompanyUserId(companyUser.getUserId());
+            claimLog.setCompanyUserName(companyUser.getNickName());
+            claimLog.setDeptId(companyUser.getDeptId());
+            CompanyDept companyDept = companyDeptMapper.selectCompanyDeptById(companyUser.getDeptId());
+            if (companyDept!=null&&companyDept.getDeptName()!=null){
+                claimLog.setDeptName(companyDept.getDeptName());
+            }
+            //增加认领记录
+            companyCustomerLogMapper.insertFsCompanyCustomerLog(claimLog);
+            return result;
         } catch (Exception e) {
             // 判断是否为唯一键冲突(电话号码重复)
             if (isDuplicatePhoneException(e)) {
                 throw new CustomException("电话号码已存在");
             }
             // 其他异常统一提示
+            log.error("添加客户失败", e);
             throw new CustomException("添加失败,请联系管理员");
         }
     }
 
     /**
-     * 判断异常是否为“电话号码重复”导致的唯一键冲突
+     * 根据异常判断是否为“电话号码重复”导致的唯一键冲突
      */
     private boolean isDuplicatePhoneException(Exception e) {
         Throwable cause = e;
@@ -76,17 +103,34 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
         return false;
     }
 
+    /**
+     * 根据填写内容设置客户信息表的完善状态
+     */
+    private void setCompleteStatus(FsCompanyCustomer customer) {
+        // 获取用户填写内容
+        String allergyHistory = customer.getAllergyHistory();
+        String presentIllness = customer.getPresentIllness();
+        String currentMedication = customer.getCurrentMedication();
+        Date appointmentTime = customer.getAppointmentTime();
+        //只要有一个为空或空字符串,就设置completeStatus为0
+        if (allergyHistory == null || allergyHistory.isEmpty()
+                || presentIllness == null || presentIllness.isEmpty()
+                || currentMedication == null || currentMedication.isEmpty()
+                || appointmentTime == null
+        ) {
+            customer.setCompleteStatus(BigDecimal.ZERO.intValue());//完善状态,0:未完善
+            return;
+        }
+        customer.setCompleteStatus(BigDecimal.ONE.intValue());//完善状态,1:完善
+    }
+
     @Override
     public int updateFsCompanyCustomer(FsCompanyCustomer fsCompanyCustomer) {
         if (fsCompanyCustomer.getPhone()!=null&&fsCompanyCustomer.getPhone().contains("*")){
             //若提交的号码是脱敏的号码,则不需要更新号码
             fsCompanyCustomer.setPhone(null);
         }
-        //更新之前查询一下
-        FsCompanyCustomer oldCustomer = selectFsCompanyCustomerById(fsCompanyCustomer.getId());
-        if(oldCustomer.getCompanyUserId()!=null&&oldCustomer.getCompanyUserId()!=fsCompanyCustomer.getCompanyUserId()){
-            throw new CustomException("网络繁忙!请稍后再试");
-        }
+        setCompleteStatus(fsCompanyCustomer);
         return fsCompanyCustomerMapper.updateFsCompanyCustomer(fsCompanyCustomer);
     }
 
@@ -119,19 +163,12 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int claimCustomer(FsCompanyCustomer fsCompanyCustomer, CompanyUser companyUser) {
-        if (fsCompanyCustomer.getPhone()!=null&&fsCompanyCustomer.getPhone().contains("*")){
-            //若提交的号码是脱敏的号码,则不需要更新号码
-            fsCompanyCustomer.setPhone(null);
-        }
         // 使用行锁查询客户信息(阻塞直到获得锁)
         FsCompanyCustomer oldCustomer = fsCompanyCustomerMapper.selectByIdForUpdate(fsCompanyCustomer.getId());
-        if(oldCustomer.getCompanyUserId()!=null){
-            throw new CustomException("客户已被其它销售认领!请刷新后重试");
-        }
-
-        if (oldCustomer.getImportMemberId()==null){
-            log.error("销售认领客户数据异常,客户信息id:{}",oldCustomer.getId());
-            throw new CustomException("网络繁忙!请稍后再试");
+        //校验认领号码与客户号码是否一致
+        if (!fsCompanyCustomer.getClaimPhone().equals(oldCustomer.getPhone())){
+            log.error("认领号码:{},客户号码:{}",fsCompanyCustomer.getClaimPhone(),oldCustomer.getPhone());
+            throw new CustomException("认领号码与客户号码不一致,请重试");
         }
         FsImportMember fsImportMember=new FsImportMember();
         fsImportMember.setId(oldCustomer.getImportMemberId());
@@ -139,6 +176,18 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
         fsImportMember.setCompanyUserId(companyUser.getUserId());
         //更新关联的导入会员表信息
         importMemberMapper.updateFsImportMember(fsImportMember);
+
+        FsCompanyCustomerLog claimLog = new FsCompanyCustomerLog();
+        claimLog.setCompanyCustomerId(fsCompanyCustomer.getId());
+        claimLog.setCompanyUserId(companyUser.getUserId());
+        claimLog.setCompanyUserName(companyUser.getNickName());
+        claimLog.setDeptId(companyUser.getDeptId());
+        CompanyDept companyDept = companyDeptMapper.selectCompanyDeptById(companyUser.getDeptId());
+        if (companyDept!=null&&companyDept.getDeptName()!=null){
+            claimLog.setDeptName(companyDept.getDeptName());
+        }
+        //增加认领记录
+        companyCustomerLogMapper.insertFsCompanyCustomerLog(claimLog);
         fsCompanyCustomer.setClaimStatus(BigDecimal.ONE.intValue());//已认领
         return fsCompanyCustomerMapper.updateFsCompanyCustomer(fsCompanyCustomer);
     }

+ 111 - 0
fs-service/src/main/resources/mapper/qw/FsCompanyCustomerLogMapper.xml

@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.qw.mapper.FsCompanyCustomerLogMapper">
+
+    <!-- 通用结果映射 -->
+    <resultMap id="BaseResultMap" type="com.fs.qw.domain.FsCompanyCustomerLog">
+        <id property="id" column="id" />
+        <result property="companyCustomerId" column="company_customer_id" />
+        <result property="companyUserId" column="company_user_id" />
+        <result property="companyUserName" column="company_user_name" />
+        <result property="deptId" column="dept_id" />
+        <result property="deptName" column="dept_name" />
+        <result property="claimTime" column="claim_time" />
+    </resultMap>
+
+    <!-- 通用字段列表 -->
+    <sql id="BaseColumnList">
+        select id, company_customer_id, company_user_id, company_user_name,
+        dept_id, dept_name, claim_time FROM fs_company_customer_log
+    </sql>
+
+    <!-- 根据主键查询 -->
+    <select id="selectFsCompanyCustomerLogById" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        <include refid="BaseColumnList" />
+        WHERE id = #{id}
+    </select>
+
+    <!-- 根据客户信息表主键查询-->
+    <select id="selectFsCompanyCustomerLogByCustomerId" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        <include refid="BaseColumnList" />
+        WHERE company_user_id = #{companyCustomerId}
+    </select>
+
+    <!-- 条件查询列表-->
+    <select id="selectFsCompanyCustomerLogList" parameterType="com.fs.qw.domain.FsCompanyCustomerLog" resultMap="BaseResultMap">
+        <include refid="BaseColumnList" />
+        <where>
+            <if test="companyCustomerId != null">
+                AND company_customer_id = #{companyCustomerId}
+            </if>
+            <if test="companyUserId != null">
+                AND company_user_id = #{companyUserId}
+            </if>
+            <if test="companyUserName != null and companyUserName != ''">
+                AND company_user_name LIKE CONCAT('%', #{companyUserName}, '%')
+            </if>
+            <if test="deptId != null">
+                AND dept_id = #{deptId}
+            </if>
+            <if test="deptName != null and deptName != ''">
+                AND dept_name LIKE CONCAT('%', #{deptName}, '%')
+            </if>
+            <if test="beginClaimTime != null and beginClaimTime != ''">
+                AND claim_time &gt;= #{params.beginClaimTime}
+            </if>
+            <if test="endClaimTime != null and endClaimTime != ''">
+                AND claim_time &lt;= #{params.endClaimTime}
+            </if>
+        </where>
+        ORDER BY claim_time DESC
+    </select>
+
+    <!-- 插入数据(返回自动生成的主键) -->
+    <insert id="insertFsCompanyCustomerLog" parameterType="com.fs.qw.domain.FsCompanyCustomerLog" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO fs_company_customer_log (
+            company_customer_id,
+            company_user_id,
+            company_user_name,
+            dept_id,
+            dept_name,
+            claim_time
+        ) VALUES (
+                     #{companyCustomerId},
+                     #{companyUserId},
+                     #{companyUserName},
+                     #{deptId},
+                     #{deptName},
+                     #{claimTime}
+                 )
+    </insert>
+
+    <!-- 更新数据 -->
+    <update id="updateFsCompanyCustomerLog" parameterType="com.fs.qw.domain.FsCompanyCustomerLog">
+        UPDATE fs_company_customer_log
+        <set>
+            <if test="companyCustomerId != null">company_customer_id = #{companyCustomerId},</if>
+            <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
+            <if test="companyUserName != null">company_user_name = #{companyUserName},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
+            <if test="claimTime != null">claim_time = #{claimTime},</if>
+        </set>
+        WHERE id = #{id}
+    </update>
+
+    <!-- 根据主键删除 -->
+    <delete id="deleteFsCompanyCustomerLogById" parameterType="java.lang.Long">
+        DELETE FROM fs_company_customer_log WHERE id = #{id}
+    </delete>
+
+    <!-- 批量删除 -->
+    <delete id="deleteFsCompanyCustomerLogByIds" parameterType="java.lang.String">
+        DELETE FROM fs_company_customer_log WHERE id IN
+        <foreach collection="array" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 21 - 5
fs-service/src/main/resources/mapper/qw/FsCompanyCustomerMapper.xml

@@ -176,12 +176,28 @@
         </trim>
     </insert>
 
-    <!-- 批量插入-->
-    <insert id="insertBatchFsCompanyCustomer">
-        INSERT IGNORE INTO fs_company_customer (customer_name, address, phone, create_time, import_member_id, claim_status)
-        VALUES
+    <!-- 批量新增-->
+    <insert id="insertBatchFsCompanyCustomer" parameterType="list">
+        INSERT IGNORE INTO fs_company_customer (
+        customer_name, sex, age, address, phone, filing_time,
+        company_user_id, company_user_name, appointment_time,
+        doctor_id, doctor_name, present_illness,
+        current_medication, allergy_history, create_by, remark,
+        import_member_id, buy_count, claim_status,
+        complete_status, dept_id, dept_name,
+        create_time
+        ) VALUES
         <foreach collection="companyCustomers" item="item" separator=",">
-            (#{item.customerName}, #{item.address}, #{item.phone}, #{item.createTime}, #{item.importMemberId}, #{item.claimStatus})
+            (
+            #{item.customerName}, #{item.sex}, #{item.age}, #{item.address},
+            #{item.phone}, #{item.filingTime}, #{item.companyUserId},
+            #{item.companyUserName}, #{item.appointmentTime}, #{item.doctorId},
+            #{item.doctorName}, #{item.presentIllness}, #{item.currentMedication},
+            #{item.allergyHistory}, #{item.createBy}, #{item.remark},
+            #{item.importMemberId}, #{item.buyCount}, #{item.claimStatus},
+            #{item.completeStatus}, #{item.deptId}, #{item.deptName},
+            #{item.createTime}
+            )
         </foreach>
     </insert>