Ver código fonte

add:人员档案管理

caozixuan 1 ano atrás
pai
commit
f39ade0fb7

+ 68 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/dto/AllocationDto.java

@@ -0,0 +1,68 @@
+package com.qmth.sop.business.bean.dto;
+
+import com.qmth.sop.business.entity.SysUser;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * @Description: 派单人员档案分配dto
+ * @Author: CaoZixuan
+ * @Date: 2023-08-16
+ */
+public class AllocationDto {
+    @ApiModelProperty("认证的角色id")
+    private Long roleId;
+
+    @ApiModelProperty("认证的角色名称")
+    private String roleName;
+
+    @ApiModelProperty("配额")
+    private Integer quotaCount;
+
+    @ApiModelProperty("实际分配的人数")
+    private Integer realityCount;
+
+    @ApiModelProperty("分配的用户")
+    private List<SysUser> sysUserList;
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Long roleId) {
+        this.roleId = roleId;
+    }
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+
+    public Integer getQuotaCount() {
+        return quotaCount;
+    }
+
+    public void setQuotaCount(Integer quotaCount) {
+        this.quotaCount = quotaCount;
+    }
+
+    public Integer getRealityCount() {
+        return realityCount;
+    }
+
+    public void setRealityCount(Integer realityCount) {
+        this.realityCount = realityCount;
+    }
+
+    public List<SysUser> getSysUserList() {
+        return sysUserList;
+    }
+
+    public void setSysUserList(List<SysUser> sysUserList) {
+        this.sysUserList = sysUserList;
+    }
+}

+ 43 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/AllocationParam.java

@@ -0,0 +1,43 @@
+package com.qmth.sop.business.bean.params;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description: 分配参数
+ * @Author: CaoZixuan
+ * @Date: 2023-08-16
+ */
+public class AllocationParam {
+    @ApiModelProperty("角色id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    @NotNull(message = "请提供调配的身份")
+    @Range(min = 1L, message = "请提供调配的身份")
+    private Long roleId;
+
+    @ApiModelProperty("用户集合")
+    @NotEmpty(message = "请提供调配的用户")
+    private List<Long> userIdList;
+
+    public Long getRoleId() {
+        return roleId;
+    }
+
+    public void setRoleId(Long roleId) {
+        this.roleId = roleId;
+    }
+
+    public List<Long> getUserIdList() {
+        return userIdList;
+    }
+
+    public void setUserIdList(List<Long> userIdList) {
+        this.userIdList = userIdList;
+    }
+}

+ 56 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/UserArchivesAllocationParam.java

@@ -0,0 +1,56 @@
+package com.qmth.sop.business.bean.params;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.Range;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+/**
+ * @Description: 人员派单档案分配参数
+ * @Author: CaoZixuan
+ * @Date: 2023-08-16
+ */
+public class UserArchivesAllocationParam {
+    @ApiModelProperty("分配参数")
+    @NotEmpty(message = "缺少分配参数")
+    private List<AllocationParam> allocationParams;
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty("服务单元id")
+    @NotNull(message = "请提供服务单元id")
+    @Range(min = 1L, message = "请提供服务单元id")
+    private Long serviceUnitId;
+
+    @ApiModelProperty("派单号")
+    @NotBlank(message = "缺少派单信息")
+    private String crmNo;
+
+    public List<AllocationParam> getAllocationParams() {
+        return allocationParams;
+    }
+
+    public void setAllocationParams(List<AllocationParam> allocationParams) {
+        this.allocationParams = allocationParams;
+    }
+
+    public Long getServiceUnitId() {
+        return serviceUnitId;
+    }
+
+    public void setServiceUnitId(Long serviceUnitId) {
+        this.serviceUnitId = serviceUnitId;
+    }
+
+    public String getCrmNo() {
+        return crmNo;
+    }
+
+    public void setCrmNo(String crmNo) {
+        this.crmNo = crmNo;
+    }
+}

+ 196 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/UserArchivesAllocationResult.java

@@ -0,0 +1,196 @@
+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.business.bean.dto.AllocationDto;
+import com.qmth.sop.common.enums.ProductTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * @Description: 人员档案分配查询结果
+ * @Author: CaoZixuan
+ * @Date: 2023-08-16
+ */
+public class UserArchivesAllocationResult {
+    @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("客户id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long customId;
+
+    @ApiModelProperty("客户名称")
+    private String customName;
+
+    @ApiModelProperty("客户类型")
+    private ProductTypeEnum customType;
+
+    @ApiModelProperty("省")
+    private String province;
+
+    @ApiModelProperty("市")
+    private String city;
+
+    @ApiModelProperty("县")
+    private String area;
+
+    @ApiModelProperty("档位等级")
+    private String level;
+
+    @ApiModelProperty("角色分配信息")
+    private String roleConfigInfo;
+
+    @ApiModelProperty("配额")
+    private Integer quota;
+
+    @ApiModelProperty("已分配")
+    private Integer distributed;
+
+    @ApiModelProperty("未分配")
+    private Integer unDistributed;
+
+    // --编辑页面用的附加信息
+    @ApiModelProperty("用户分配的数据")
+    private List<AllocationDto> allocationDtoList;
+
+    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 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 getCustomType() {
+        return customType;
+    }
+
+    public void setCustomType(ProductTypeEnum customType) {
+        this.customType = customType;
+    }
+
+    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 String getRoleConfigInfo() {
+        return roleConfigInfo;
+    }
+
+    public void setRoleConfigInfo(String roleConfigInfo) {
+        this.roleConfigInfo = roleConfigInfo;
+    }
+
+    public Integer getQuota() {
+        return quota;
+    }
+
+    public void setQuota(Integer quota) {
+        this.quota = quota;
+    }
+
+    public Integer getDistributed() {
+        return distributed;
+    }
+
+    public void setDistributed(Integer distributed) {
+        this.distributed = distributed;
+    }
+
+    public Integer getUnDistributed() {
+        return unDistributed;
+    }
+
+    public void setUnDistributed(Integer unDistributed) {
+        this.unDistributed = unDistributed;
+    }
+
+    public List<AllocationDto> getAllocationDtoList() {
+        return allocationDtoList;
+    }
+
+    public void setAllocationDtoList(List<AllocationDto> allocationDtoList) {
+        this.allocationDtoList = allocationDtoList;
+    }
+}

+ 94 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/UserArchivesAllocationSubTotalResult.java

@@ -0,0 +1,94 @@
+package com.qmth.sop.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 派单人员分配小计
+ * @Author: CaoZixuan
+ * @Date: 2023-08-16
+ */
+public class UserArchivesAllocationSubTotalResult {
+    @ApiModelProperty("已发布派单数")
+    private Integer publishedCrmCount;
+    @ApiModelProperty("派单总数")
+    private Integer totalCrmCount;
+
+    @ApiModelProperty("已匹配实施工程师数")
+    private Integer effectEngineerCount;
+    @ApiModelProperty("实施工程师配额")
+    private Integer effectEngineerQuota;
+
+    @ApiModelProperty("已匹配助理工程师数")
+    private Integer assistantEngineerCount;
+    @ApiModelProperty("助理工程师配额")
+    private Integer assistantEngineerQuota;
+
+    @ApiModelProperty("已匹配区域协调人数")
+    private Integer regionCoordinatorCount;
+    @ApiModelProperty("区域协调人配额")
+    private Integer regionCoordinatorQuota;
+
+    public Integer getPublishedCrmCount() {
+        return publishedCrmCount;
+    }
+
+    public void setPublishedCrmCount(Integer publishedCrmCount) {
+        this.publishedCrmCount = publishedCrmCount;
+    }
+
+    public Integer getTotalCrmCount() {
+        return totalCrmCount;
+    }
+
+    public void setTotalCrmCount(Integer totalCrmCount) {
+        this.totalCrmCount = totalCrmCount;
+    }
+
+    public Integer getEffectEngineerCount() {
+        return effectEngineerCount;
+    }
+
+    public void setEffectEngineerCount(Integer effectEngineerCount) {
+        this.effectEngineerCount = effectEngineerCount;
+    }
+
+    public Integer getEffectEngineerQuota() {
+        return effectEngineerQuota;
+    }
+
+    public void setEffectEngineerQuota(Integer effectEngineerQuota) {
+        this.effectEngineerQuota = effectEngineerQuota;
+    }
+
+    public Integer getAssistantEngineerCount() {
+        return assistantEngineerCount;
+    }
+
+    public void setAssistantEngineerCount(Integer assistantEngineerCount) {
+        this.assistantEngineerCount = assistantEngineerCount;
+    }
+
+    public Integer getAssistantEngineerQuota() {
+        return assistantEngineerQuota;
+    }
+
+    public void setAssistantEngineerQuota(Integer assistantEngineerQuota) {
+        this.assistantEngineerQuota = assistantEngineerQuota;
+    }
+
+    public Integer getRegionCoordinatorCount() {
+        return regionCoordinatorCount;
+    }
+
+    public void setRegionCoordinatorCount(Integer regionCoordinatorCount) {
+        this.regionCoordinatorCount = regionCoordinatorCount;
+    }
+
+    public Integer getRegionCoordinatorQuota() {
+        return regionCoordinatorQuota;
+    }
+
+    public void setRegionCoordinatorQuota(Integer regionCoordinatorQuota) {
+        this.regionCoordinatorQuota = regionCoordinatorQuota;
+    }
+}

+ 44 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBUserArchivesAllocationService.java

@@ -1,5 +1,8 @@
 package com.qmth.sop.business.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.result.UserArchivesAllocationResult;
+import com.qmth.sop.business.bean.result.UserArchivesAllocationSubTotalResult;
 import com.qmth.sop.business.entity.TBUserArchivesAllocation;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -13,4 +16,45 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TBUserArchivesAllocationService extends IService<TBUserArchivesAllocation> {
 
+    /**
+     * 查询派单分配列表
+     *
+     * @param serviceUnitId 服务单元id
+     * @param province      省份名称
+     * @param city          城市名称
+     * @param area          县区名称
+     * @param customName    客户名称
+     * @param gap           分配差额
+     * @param pageNumber    分页页数
+     * @param pageSize      分页容量
+     * @return 分页查询结果
+     */
+    IPage<UserArchivesAllocationResult> findCrmAllocationPage(Long serviceUnitId, String province, String city, String area, String customName, Integer gap, Integer pageNumber, Integer pageSize);
+
+    /**
+     * 查询派单小计
+     *
+     * @param serviceUnitId 服务单元id
+     * @param province      省份名称
+     * @param city          城市名称
+     * @param area          县区名称
+     * @param customName    客户名称
+     * @param gap           分配差额
+     * @return 小计结果
+     */
+    UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, String city, String area, String customName, Integer gap);
+
+    /**
+     * 分配派单
+     *
+     * @param obj 派单参数
+     */
+    void editCrmAllocation(Object obj);
+
+    /**
+     * 自动批量调配派单和人员
+     *
+     * @param serviceUnitId 服务单元id
+     */
+    void autoEditCrmAllocationBatch(Long serviceUnitId);
 }

+ 21 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBServiceRegionServiceImpl.java

@@ -14,6 +14,7 @@ import com.qmth.sop.business.entity.TBServiceRegion;
 import com.qmth.sop.business.entity.TBServiceRegionDetail;
 import com.qmth.sop.business.mapper.TBServiceRegionMapper;
 import com.qmth.sop.business.service.*;
+import com.qmth.sop.common.base.BaseEntity;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
 import com.qmth.sop.common.enums.RoleTypeEnum;
@@ -135,7 +136,6 @@ public class TBServiceRegionServiceImpl extends ServiceImpl<TBServiceRegionMappe
             throw ExceptionResultEnum.ERROR.exception("所选用户没有大区经理角色");
         }
 
-
         TBServiceRegion tbServiceRegion = new TBServiceRegion();
         tbServiceRegion.setServiceId(serviceUnitId);
         tbServiceRegion.setLeadId(leadId);
@@ -151,6 +151,26 @@ public class TBServiceRegionServiceImpl extends ServiceImpl<TBServiceRegionMappe
             this.updateById(tbServiceRegion);
         }
 
+        // 同一个服务单元
+        List<Long> regionIdList = this.list(new QueryWrapper<TBServiceRegion>()
+                        .lambda()
+                        .eq(TBServiceRegion::getServiceId, serviceUnitId))
+                .stream()
+                .map(BaseEntity::getId)
+                .collect(Collectors.toList());
+        regionIdList.remove(serviceRegionId);
+        if (CollectionUtils.isNotEmpty(regionIdList)) {
+            List<TBServiceRegionDetail> detailList = tbServiceRegionDetailService.list(new QueryWrapper<TBServiceRegionDetail>()
+                    .lambda()
+                    .in(TBServiceRegionDetail::getServiceRegionId, regionIdList));
+            for (AreaDto areaDto : areaDtoList) {
+                if (detailList.stream().anyMatch(e -> e.getCity().equals(areaDto.getCity()) && e.getProvince().equals(areaDto.getProvince()))) {
+                    throw ExceptionResultEnum.ERROR.exception(String.format("服务单元[%s]已经存在[%s]省,[%s]市的区域规划", tbServiceUnit.getName(), areaDto.getProvince(), areaDto.getCity()));
+                }
+            }
+
+        }
+
         // 更新详细信息
         tbServiceRegionDetailService.bindServiceRegionAreas(serviceRegionId, areaDtoList);
         return serviceRegionId;

+ 22 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBUserArchivesAllocationServiceImpl.java

@@ -1,5 +1,8 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.result.UserArchivesAllocationResult;
+import com.qmth.sop.business.bean.result.UserArchivesAllocationSubTotalResult;
 import com.qmth.sop.business.entity.TBUserArchivesAllocation;
 import com.qmth.sop.business.mapper.TBUserArchivesAllocationMapper;
 import com.qmth.sop.business.service.TBUserArchivesAllocationService;
@@ -17,4 +20,23 @@ import org.springframework.stereotype.Service;
 @Service
 public class TBUserArchivesAllocationServiceImpl extends ServiceImpl<TBUserArchivesAllocationMapper, TBUserArchivesAllocation> implements TBUserArchivesAllocationService {
 
+    @Override
+    public IPage<UserArchivesAllocationResult> findCrmAllocationPage(Long serviceUnitId, String province, String city, String area, String customName, Integer gap, Integer pageNumber, Integer pageSize) {
+        return null;
+    }
+
+    @Override
+    public UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, String city, String area, String customName, Integer gap) {
+        return null;
+    }
+
+    @Override
+    public void editCrmAllocation(Object obj) {
+
+    }
+
+    @Override
+    public void autoEditCrmAllocationBatch(Long serviceUnitId) {
+
+    }
 }

+ 4 - 0
sop-business/src/main/resources/db/log/caozixuan_update_log.sql

@@ -65,3 +65,7 @@ INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, e
 UPDATE sys_privilege SET related = '2014' WHERE (id = '108');
 UPDATE sys_privilege SET related = '2014' WHERE (id = '109');
 UPDATE sys_privilege SET related = '2014' WHERE (id = '110');
+
+-- 2023/08/16
+ALTER TABLE `t_b_user_archives_allocation`
+    CHANGE COLUMN `crm_no` `crm_no` VARCHAR(100) NOT NULL COMMENT 'crm单号' ;

+ 3 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/RoleTypeEnum.java

@@ -15,10 +15,13 @@ public enum RoleTypeEnum {
 
     REGION_MANAGER("大区经理", "系统角色"),
 
+    //regionCoordinator
     REGION_COORDINATOR("区域协调人", "外包角色"),
 
+    //effectEngineer
     EFFECT_ENGINEER("实施工程师", "外包角色"),
 
+    //assistantEngineer
     ASSISTANT_ENGINEER("助理工程师", "外包角色"),
 
     QA("QA", "系统角色"),