瀏覽代碼

add:服务区域规划

caozixuan 1 年之前
父節點
當前提交
f351e519ac

+ 250 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/CrmServiceResult.java

@@ -0,0 +1,250 @@
+package com.qmth.sop.business.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 派单服务单元(关联)结果
+ * @Author: CaoZixuan
+ * @Date: 2023-08-10
+ */
+public class CrmServiceResult {
+    @ApiModelProperty("服务单元id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long serviceUnitId;
+
+    @ApiModelProperty("服务单元名称")
+    private String serviceUnitName;
+
+    @ApiModelProperty("派单id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long crmId;
+
+    @ApiModelProperty("派单号")
+    private String crmNo;
+
+    @ApiModelProperty("派单开始时间")
+    private Long beginTime;
+
+    @ApiModelProperty("派单人id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long crmUserId;
+
+    @ApiModelProperty("派单人名称")
+    private String crmUserName;
+
+    @ApiModelProperty("客户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long customId;
+
+    @ApiModelProperty("客户名称")
+    private String customName;
+
+    @ApiModelProperty("业务类型")
+    private ProductTypeEnum productType;
+
+    @ApiModelProperty("产品id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long productId;
+
+    @ApiModelProperty("产品名称")
+    private String productName;
+
+    @ApiModelProperty("考试开始时间")
+    private Long examStartTime;
+
+    @ApiModelProperty("考试结束时间")
+    private Long examEndTime;
+
+    @ApiModelProperty("省")
+    private String province;
+
+    @ApiModelProperty("市")
+    private String city;
+
+    @ApiModelProperty("区")
+    private String area;
+
+    @ApiModelProperty("服务档位")
+    private String level;
+
+    @ApiModelProperty("创建人id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long creatorId;
+
+    @ApiModelProperty("创建时间")
+    private Long createTime;
+
+    @ApiModelProperty("创建人名称")
+    private String creatorName;
+
+    public Long getServiceUnitId() {
+        return serviceUnitId;
+    }
+
+    public void setServiceUnitId(Long serviceUnitId) {
+        this.serviceUnitId = serviceUnitId;
+    }
+
+    public String getServiceUnitName() {
+        return serviceUnitName;
+    }
+
+    public void setServiceUnitName(String serviceUnitName) {
+        this.serviceUnitName = serviceUnitName;
+    }
+
+    public Long getCrmId() {
+        return crmId;
+    }
+
+    public void setCrmId(Long crmId) {
+        this.crmId = crmId;
+    }
+
+    public String getCrmNo() {
+        return crmNo;
+    }
+
+    public void setCrmNo(String crmNo) {
+        this.crmNo = crmNo;
+    }
+
+    public Long getBeginTime() {
+        return beginTime;
+    }
+
+    public void setBeginTime(Long beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    public Long getCrmUserId() {
+        return crmUserId;
+    }
+
+    public void setCrmUserId(Long crmUserId) {
+        this.crmUserId = crmUserId;
+    }
+
+    public String getCrmUserName() {
+        return crmUserName;
+    }
+
+    public void setCrmUserName(String crmUserName) {
+        this.crmUserName = crmUserName;
+    }
+
+    public Long getCustomId() {
+        return customId;
+    }
+
+    public void setCustomId(Long customId) {
+        this.customId = customId;
+    }
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public ProductTypeEnum getProductType() {
+        return productType;
+    }
+
+    public void setProductType(ProductTypeEnum productType) {
+        this.productType = productType;
+    }
+
+    public Long getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Long productId) {
+        this.productId = productId;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
+
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public Long getExamStartTime() {
+        return examStartTime;
+    }
+
+    public void setExamStartTime(Long examStartTime) {
+        this.examStartTime = examStartTime;
+    }
+
+    public Long getExamEndTime() {
+        return examEndTime;
+    }
+
+    public void setExamEndTime(Long examEndTime) {
+        this.examEndTime = examEndTime;
+    }
+
+    public String getProvince() {
+        return province;
+    }
+
+    public void setProvince(String province) {
+        this.province = province;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getArea() {
+        return area;
+    }
+
+    public void setArea(String area) {
+        this.area = area;
+    }
+
+    public String getLevel() {
+        return level;
+    }
+
+    public void setLevel(String level) {
+        this.level = level;
+    }
+
+    public Long getCreatorId() {
+        return creatorId;
+    }
+
+    public void setCreatorId(Long creatorId) {
+        this.creatorId = creatorId;
+    }
+
+    public Long getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getCreatorName() {
+        return creatorName;
+    }
+
+    public void setCreatorName(String creatorName) {
+        this.creatorName = creatorName;
+    }
+}

+ 46 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBCrmMapper.java

@@ -1,7 +1,13 @@
 package com.qmth.sop.business.mapper;
 
-import com.qmth.sop.business.entity.TBCrm;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.sop.business.bean.result.CrmServiceResult;
+import com.qmth.sop.business.bean.result.SysLogResult;
+import com.qmth.sop.business.entity.TBCrm;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -12,5 +18,44 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2023-08-01
  */
 public interface TBCrmMapper extends BaseMapper<TBCrm> {
+    /**
+     * 服务范围管理派单分页查询
+     *
+     * @param iPage         分页参数
+     * @param serviceUnitId 服务单元id
+     * @param city          城市
+     * @param productType   业务类型
+     * @param customName    客户名称
+     * @param bindStatus    派单是否绑定服务单元
+     * @return 分页查询结果
+     */
+    IPage<CrmServiceResult> findServiceScopePage(@Param("iPage") Page<SysLogResult> iPage,
+                                                 @Param("serviceUnitId") Long serviceUnitId,
+                                                 @Param("city") String city,
+                                                 @Param("productType") ProductTypeEnum productType,
+                                                 @Param("customName") String customName,
+                                                 @Param("bindStatus") Boolean bindStatus);
+
+
+    /**
+     * 服务范围管理-未绑定派单分页查询
+     *
+     * @param iPage       分页参数
+     * @param crmUserId   派单人id
+     * @param productType 业务类型
+     * @param customName  客户名称
+     * @param crmNo       项目单号
+     * @param startTime   派单时间 - 起始
+     * @param endTime     派单时间 - 截止
+     * @return 分页查询结果
+     */
+    IPage<CrmServiceResult> findUnbindOrderPage(@Param("iPage") Page<SysLogResult> iPage,
+                                                @Param("crmUserId") Long crmUserId,
+                                                @Param("productType") ProductTypeEnum productType,
+                                                @Param("customName") String customName,
+                                                @Param("crmNo") String crmNo,
+                                                @Param("startTime") Long startTime,
+                                                @Param("endTime") Long endTime);
 
+    // TODO: 2023/8/10  根据服务单元id查询 
 }

+ 43 - 2
sop-business/src/main/java/com/qmth/sop/business/service/TBCrmService.java

@@ -1,7 +1,12 @@
 package com.qmth.sop.business.service;
 
-import com.qmth.sop.business.entity.TBCrm;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.CrmServiceResult;
+import com.qmth.sop.business.entity.TBCrm;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +18,40 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TBCrmService extends IService<TBCrm> {
 
-}
+    /**
+     * 服务范围管理 - 派单分页查询
+     *
+     * @param serviceUnitId 服务单元id
+     * @param city          城市
+     * @param productType   客户类型
+     * @param customName    客户名称
+     * @param bindStatus    绑定状态
+     * @param pageNumber    分页页数
+     * @param pageSize      分页容量
+     * @return 派单分页查询结果
+     */
+    IPage<CrmServiceResult> findServiceScopePage(Long serviceUnitId, String city, ProductTypeEnum productType, String customName, Boolean bindStatus, Integer pageNumber, Integer pageSize);
+
+    /**
+     * 服务范围管理 - 待分配派单分页查询
+     *
+     * @param crmUserId   派单人id
+     * @param productType 业务类型
+     * @param customName  客户名称
+     * @param crmNo       项目单号
+     * @param startTime   派单开始时间
+     * @param endTime     派单截止时间
+     * @param pageNumber  分页页数
+     * @param pageSize    分页容量
+     * @return 未分配派单分页查询结果
+     */
+    IPage<CrmServiceResult> findUnbindOrderPage(Long crmUserId, ProductTypeEnum productType, String customName, String crmNo, Long startTime, Long endTime, Integer pageNumber, Integer pageSize);
+
+    /**
+     * 根据服务单元id查询派单部分信息
+     *
+     * @param serviceIdList 服务单元id集合
+     * @return 派单部分信息
+     */
+    List<CrmServiceResult> findCrmOrderByServiceIdList(List<Long> serviceIdList);
+}

+ 34 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBCrmServiceImpl.java

@@ -1,11 +1,18 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.sop.business.bean.result.CrmServiceResult;
 import com.qmth.sop.business.entity.TBCrm;
 import com.qmth.sop.business.mapper.TBCrmMapper;
 import com.qmth.sop.business.service.TBCrmService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.ProductTypeEnum;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 派单信息表 服务实现类
@@ -17,4 +24,31 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBCrmServiceImpl extends ServiceImpl<TBCrmMapper, TBCrm> implements TBCrmService {
 
+    @Override
+    public IPage<CrmServiceResult> findServiceScopePage(Long serviceUnitId, String city, ProductTypeEnum productType, String customName, Boolean bindStatus, Integer pageNumber, Integer pageSize) {
+        if (city != null && city.length() > 0) {
+            city = SystemConstant.translateSpecificSign(city);
+        }
+        if (customName != null && customName.length() > 0) {
+            customName = SystemConstant.translateSpecificSign(customName);
+        }
+        return this.baseMapper.findServiceScopePage(new Page<>(pageNumber, pageSize), serviceUnitId, city, productType, customName, bindStatus);
+    }
+
+    @Override
+    public IPage<CrmServiceResult> findUnbindOrderPage(Long crmUserId, ProductTypeEnum productType, String customName, String crmNo, Long startTime, Long endTime, Integer pageNumber, Integer pageSize) {
+        if (customName != null && customName.length() > 0) {
+            customName = SystemConstant.translateSpecificSign(customName);
+        }
+        if (crmNo != null && crmNo.length() > 0) {
+            crmNo = SystemConstant.translateSpecificSign(crmNo);
+        }
+        return this.baseMapper.findUnbindOrderPage(new Page<>(pageNumber, pageSize), crmUserId, productType, customName, crmNo, startTime, endTime);
+    }
+
+    @Override
+    public List<CrmServiceResult> findCrmOrderByServiceIdList(List<Long> serviceIdList) {
+
+        return null;
+    }
 }

+ 98 - 0
sop-business/src/main/resources/mapper/TBCrmMapper.xml

@@ -2,4 +2,102 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.TBCrmMapper">
 
+    <select id="findServiceScopePage" resultType="com.qmth.sop.business.bean.result.CrmServiceResult">
+        SELECT
+            tbc.service_id AS serviceUnitId,
+            IFNULL(tbs.name, '--') AS serviceUnitName,
+            tbc.id AS crmId,
+            tbc.name AS crmNo,
+            tbc.custom_id AS customId,
+            sc.name AS customName,
+            sc.type AS productType,
+            sc.province,
+            sc.city,
+            sc.area,
+            sl.level
+        FROM
+            t_b_crm tbc
+                LEFT JOIN
+            t_b_service tbs ON tbc.service_id = tbs.id AND tbs.enable AND tbs.status != '已作废'
+                LEFT JOIN
+            sys_custom sc ON tbc.custom_id = sc.id
+                LEFT JOIN
+            sys_level sl ON sc.level_id = sl.id
+        <where>
+            <if test="serviceUnitId != null">
+                AND tbc.service_id = #{serviceUnitId}
+            </if>
+            <if test="city != null and city != ''">
+                AND sc.city LIKE CONCAT('%',#{city},'%')
+            </if>
+            <if test="productType != null">
+                AND sc.type = #{productType}
+            </if>
+            <if test="customName != null and customName != ''">
+                AND sc.name LIKE CONCAT('%',#{customName},'%')
+            </if>
+            <if test="bindStatus != null">
+                <choose>
+                    <when test="bindStatus">
+                        AND tbc.service_id IS NOT NULL
+                    </when>
+                    <otherwise>
+                        AND tbc.service_id IS NULL
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        ORDER BY serviceUnitName,tbc.create_time DESC
+    </select>
+
+    <select id="findUnbindOrderPage" resultType="com.qmth.sop.business.bean.result.CrmServiceResult">
+        SELECT
+            tbc.id AS crmId,
+            tbc.name AS crmNo,
+            tbc.begin_time AS beginTime,
+            tbc.crm_user_id AS crmUserId,
+            crmuser.real_name AS crmUserName,
+            tbc.custom_id AS customId,
+            sc.type AS productType,
+            sc.name AS customName,
+            tbc.product_id AS productId,
+            tbp.name AS productName,
+            tbc.exam_start_time AS examStartTime,
+            tbc.exam_end_time AS examEndTime,
+            tbc.create_id AS creatorId,
+            tbc.create_time AS createTime,
+            creator.real_name AS creatorName
+        FROM
+            t_b_crm tbc
+                LEFT JOIN
+            sys_user crmuser ON tbc.crm_user_id = crmuser.id
+                LEFT JOIN
+            sys_custom sc ON tbc.custom_id = sc.id
+                LEFT JOIN
+            t_b_product tbp ON tbc.product_id = tbp.id
+                LEFT JOIN
+            sys_user creator ON tbc.create_id = creator.id
+        <where>
+            AND tbc.service_id IS NULL
+            <if test="crmUserId != null">
+                AND tbc.custom_id = #{crmUserId}
+            </if>
+            <if test="productType != null">
+                AND sc.type = #{productType}
+            </if>
+            <if test="customName != null and customName != ''">
+                AND sc.name LIKE CONCAT('%',#{customName},'%')
+            </if>
+            <if test="crmNo != null and crmNo != ''">
+                AND tbc.crm_no LIKE CONCAT('%',#{crmNo},'%')
+            </if>
+            <if test="startTime != null">
+                AND tbc.begin_time >= #{startTime}
+            </if>
+            <if test="endTime != null">
+                AND #{endTime} >= tbc.begin_time
+            </if>
+        </where>
+        ORDER BY tbc.create_time DESC
+    </select>
 </mapper>