瀏覽代碼

研究生sop的创建

haogh 9 月之前
父節點
當前提交
c03538abaa

+ 47 - 0
sop-api/src/main/java/com/qmth/sop/server/api/ProjectMonitorController.java

@@ -0,0 +1,47 @@
+package com.qmth.sop.server.api;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.bean.result.ProjectMonitorResult;
+import com.qmth.sop.business.service.ProjectMonitorService;
+import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.enums.CrmProcessEnum;
+import com.qmth.sop.common.util.Result;
+import com.qmth.sop.common.util.ResultUtil;
+import io.swagger.annotations.*;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+/**
+ * @Description 项目监控
+ * @Author haoguanghui
+ * @date 2024/09/04
+ */
+@Api(tags = "项目监控Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_PROJECT_MONITOR)
+public class ProjectMonitorController {
+
+    @Resource
+    ProjectMonitorService projectMonitorService;
+
+    @ApiOperation(value = "项目监控分页")
+    @RequestMapping(value = "/page", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "项目监控分页", response = ProjectMonitorResult.class) })
+    public Result page(
+            @ApiParam(value = "服务单元ID", required = false) @RequestParam(required = false) Long serviceUnitId,
+            @ApiParam(value = "客户ID", required = false) @RequestParam(required = false) Long customerId,
+            @ApiParam(value = "项目进度", required = false) @RequestParam(required = false) CrmProcessEnum process,
+            @ApiParam(value = "分页页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+            @ApiParam(value = "分页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(projectMonitorService.pageProjectMonitor(new Page<>(pageNumber, pageSize), serviceUnitId, customerId, process));
+    }
+
+
+}

+ 62 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/dto/UserArchivesAllocationDto.java

@@ -0,0 +1,62 @@
+package com.qmth.sop.business.bean.dto;
+
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+public class UserArchivesAllocationDto {
+
+    @ApiModelProperty(value = "人员档案ID")
+    private Long userId;
+
+    @ApiModelProperty(value = "人员所属角色")
+    private SopRoleTypeEnum sopRoleType;
+
+    @ApiModelProperty(value = "人员档案姓名")
+    private String userName;
+
+    @ApiModelProperty(value = "人员档案电话")
+    private String mobileNumber;
+
+    @ApiModelProperty(value = "所属人力供应商")
+    private String supplierName;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public SopRoleTypeEnum getSopRoleType() {
+        return sopRoleType;
+    }
+
+    public void setSopRoleType(SopRoleTypeEnum sopRoleType) {
+        this.sopRoleType = sopRoleType;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getMobileNumber() {
+        return mobileNumber;
+    }
+
+    public void setMobileNumber(String mobileNumber) {
+        this.mobileNumber = mobileNumber;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+}

+ 138 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/ProjectMonitorResult.java

@@ -0,0 +1,138 @@
+package com.qmth.sop.business.bean.result;
+
+import com.qmth.sop.common.enums.CrmProcessEnum;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Description 项目监控
+ * @Author haoguanghui
+ * @date 2024/09/05
+ */
+public class ProjectMonitorResult implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "客户名称")
+    private String customName;
+
+    @ApiModelProperty(value = "项目名称")
+    private String crmName;
+
+    @ApiModelProperty(value = "科目名称")
+    private String courseName;
+
+    @ApiModelProperty(value = "当前进度")
+    private CrmProcessEnum process;
+
+    @ApiModelProperty(value = "审核所处阶段")
+    private String taskName;
+
+    @ApiModelProperty(value = "派单详情ID")
+    private Long crmDetailId;
+
+    @ApiModelProperty(value = "大区经理")
+    private String leadName;
+
+    @ApiModelProperty(value = "大区经理电话")
+    private String leadMobile;
+
+    @ApiModelProperty(value = "区域协调人")
+    private ProjectMonitorUserResult regionCoordinator;
+
+    @ApiModelProperty(value = "项目经理")
+    private ProjectMonitorUserResult projectManager;
+
+    @ApiModelProperty(value = "工程师")
+    private List<ProjectMonitorUserResult> engineerList;
+
+    public String getCustomName() {
+        return customName;
+    }
+
+    public void setCustomName(String customName) {
+        this.customName = customName;
+    }
+
+    public String getCrmName() {
+        return crmName;
+    }
+
+    public void setCrmName(String crmName) {
+        this.crmName = crmName;
+    }
+
+    public String getCourseName() {
+        return courseName;
+    }
+
+    public void setCourseName(String courseName) {
+        this.courseName = courseName;
+    }
+
+    public CrmProcessEnum getProcess() {
+        return process;
+    }
+
+    public void setProcess(CrmProcessEnum process) {
+        this.process = process;
+    }
+
+    public String getLeadName() {
+        return leadName;
+    }
+
+    public void setLeadName(String leadName) {
+        this.leadName = leadName;
+    }
+
+    public ProjectMonitorUserResult getRegionCoordinator() {
+        return regionCoordinator;
+    }
+
+    public void setRegionCoordinator(ProjectMonitorUserResult regionCoordinator) {
+        this.regionCoordinator = regionCoordinator;
+    }
+
+    public ProjectMonitorUserResult getProjectManager() {
+        return projectManager;
+    }
+
+    public void setProjectManager(ProjectMonitorUserResult projectManager) {
+        this.projectManager = projectManager;
+    }
+
+    public List<ProjectMonitorUserResult> getEngineerList() {
+        return engineerList;
+    }
+
+    public void setEngineerList(List<ProjectMonitorUserResult> engineerList) {
+        this.engineerList = engineerList;
+    }
+
+    public String getTaskName() {
+        return taskName;
+    }
+
+    public void setTaskName(String taskName) {
+        this.taskName = taskName;
+    }
+
+    public String getLeadMobile() {
+        return leadMobile;
+    }
+
+    public void setLeadMobile(String leadMobile) {
+        this.leadMobile = leadMobile;
+    }
+
+    public Long getCrmDetailId() {
+        return crmDetailId;
+    }
+
+    public void setCrmDetailId(Long crmDetailId) {
+        this.crmDetailId = crmDetailId;
+    }
+}

+ 50 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/ProjectMonitorUserResult.java

@@ -0,0 +1,50 @@
+package com.qmth.sop.business.bean.result;
+
+import io.swagger.annotations.ApiModelProperty;
+
+public class ProjectMonitorUserResult {
+
+    @ApiModelProperty(value = "用户Id")
+    private Long userId;
+
+    @ApiModelProperty(value = "用户名称")
+    private String userName;
+
+    @ApiModelProperty(value = "所属人力商")
+    private String supplierName;
+
+    @ApiModelProperty(value = "用户电话")
+    private String mobileNumber;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getSupplierName() {
+        return supplierName;
+    }
+
+    public void setSupplierName(String supplierName) {
+        this.supplierName = supplierName;
+    }
+
+    public String getMobileNumber() {
+        return mobileNumber;
+    }
+
+    public void setMobileNumber(String mobileNumber) {
+        this.mobileNumber = mobileNumber;
+    }
+}

+ 10 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/TBSopInfoMapper.java

@@ -2,10 +2,13 @@ package com.qmth.sop.business.mapper;
 
 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.dto.DataPermissionDto;
+import com.qmth.sop.business.bean.result.ProjectMonitorResult;
 import com.qmth.sop.business.bean.result.SopInfoResult;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.entity.TBSopInfo;
+import com.qmth.sop.common.enums.CrmProcessEnum;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -131,4 +134,11 @@ public interface TBSopInfoMapper extends BaseMapper<TBSopInfo> {
      * @return
      */
     List<SysUser> userList(@Param("id") Long id);
+
+    /**
+     *  项目监控
+     */
+    IPage<ProjectMonitorResult> pageProjectMonitor(Page<ProjectMonitorResult> projectMonitorResultPage,
+            @Param("serviceUnitId") Long serviceUnitId, @Param("customerId") Long customerId,
+            @Param("process") CrmProcessEnum process, @Param("prList") List<String> processList, @Param("dpr") DataPermissionDto dpr);
 }

+ 8 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBUserArchivesAllocationMapper.java

@@ -3,8 +3,8 @@ package com.qmth.sop.business.mapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.sop.business.bean.dto.DataPermissionDto;
+import com.qmth.sop.business.bean.dto.UserArchivesAllocationDto;
 import com.qmth.sop.business.bean.result.CrmArchivesAllocationResult;
-import com.qmth.sop.business.bean.result.SysLogResult;
 import com.qmth.sop.business.bean.result.UserArchivesAllocationResult;
 import com.qmth.sop.business.entity.TBUserArchivesAllocation;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -73,4 +73,11 @@ public interface TBUserArchivesAllocationMapper extends BaseMapper<TBUserArchive
                                                                  @Param("dpr") DataPermissionDto dpr);
 
     List<CrmArchivesAllocationResult> findAllocationByCrmNo(@Param("crmNo") String crmNo);
+
+    /**
+     *  根据派单ID查找所有的
+     * @param crmDetailId
+     * @return
+     */
+    List<UserArchivesAllocationDto> listUserArchivesAllocation(@Param("crmDetailId") Long crmDetailId);
 }

+ 18 - 0
sop-business/src/main/java/com/qmth/sop/business/service/ProjectMonitorService.java

@@ -0,0 +1,18 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.ProjectMonitorResult;
+import com.qmth.sop.business.entity.TBSopInfo;
+import com.qmth.sop.common.enums.CrmProcessEnum;
+
+/**
+ * @Description  项目监控
+ * @Author haoguanghui
+ * @date 2024/09/04
+ */
+public interface ProjectMonitorService extends IService<TBSopInfo> {
+
+    IPage<ProjectMonitorResult> pageProjectMonitor(Page<ProjectMonitorResult> page, Long serviceUnitId, Long customerId, CrmProcessEnum process);
+}

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

@@ -2,6 +2,7 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.dto.UserArchivesAllocationDto;
 import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.bean.params.AutoAllocationParam;
 import com.qmth.sop.business.bean.params.UserArchivesAllocationParam;
@@ -135,4 +136,11 @@ public interface TBUserArchivesAllocationService extends IService<TBUserArchives
      * @return 分配信息
      */
     CrmDetailAllocationResult findCrmDetailAllocationInfo(Long crmDetailId);
+
+    /**
+     *  派单明细ID查找所有相关人员
+     * @param crmDetailId 派单明细id
+     * @return 人员信息
+     */
+    List<UserArchivesAllocationDto> listUserArchivesAllocation(Long crmDetailId);
 }

+ 84 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/ProjectMonitorServiceImpl.java

@@ -0,0 +1,84 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.bean.dto.DataPermissionDto;
+import com.qmth.sop.business.bean.dto.UserArchivesAllocationDto;
+import com.qmth.sop.business.bean.result.ProjectMonitorResult;
+import com.qmth.sop.business.bean.result.ProjectMonitorUserResult;
+import com.qmth.sop.business.entity.SysUser;
+import com.qmth.sop.business.entity.TBSopInfo;
+import com.qmth.sop.business.mapper.TBSopInfoMapper;
+import com.qmth.sop.business.service.ProjectMonitorService;
+import com.qmth.sop.business.service.SysUserService;
+import com.qmth.sop.business.service.TBUserArchivesAllocationService;
+import com.qmth.sop.common.enums.CrmProcessEnum;
+import com.qmth.sop.common.enums.SopRoleTypeEnum;
+import com.qmth.sop.common.util.ServletUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class ProjectMonitorServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo> implements ProjectMonitorService {
+
+    @Resource
+    private SysUserService sysUserService;
+
+    @Resource
+    private TBUserArchivesAllocationService tbUserArchivesAllocationService;
+
+    @Override
+    public IPage<ProjectMonitorResult> pageProjectMonitor(Page<ProjectMonitorResult> page, Long serviceUnitId, Long customerId, CrmProcessEnum process) {
+        SysUser user = (SysUser) ServletUtil.getRequestUser();
+        DataPermissionDto dpr = sysUserService.buildUserDataPermission(user.getId());
+        List<String> processList = new ArrayList<>();
+        if (process != null) {
+            processList = getProcessList(process);
+        }
+
+        IPage<ProjectMonitorResult> pageProjectMonitor = baseMapper.pageProjectMonitor(new Page<>(page.getCurrent(), page.getSize()),
+                serviceUnitId, customerId, process, processList, dpr);
+        List<ProjectMonitorResult> monitorResultList = pageProjectMonitor.getRecords();
+        for (ProjectMonitorResult monitorResult : monitorResultList) {
+            monitorResult.setProcess(CrmProcessEnum.findCrmProcessByDesc(monitorResult.getTaskName()));
+            List<UserArchivesAllocationDto> allocationDtoList = tbUserArchivesAllocationService.listUserArchivesAllocation(
+                    monitorResult.getCrmDetailId());
+            List<ProjectMonitorUserResult> coordinatorList = filterUserArchivesAllocation(allocationDtoList, SopRoleTypeEnum.REGION_COORDINATOR);
+            monitorResult.setRegionCoordinator(!coordinatorList.isEmpty() ? coordinatorList.get(0) : null);
+            List<ProjectMonitorUserResult> managerList = filterUserArchivesAllocation(allocationDtoList, SopRoleTypeEnum.PROJECT_MANAGER);
+            monitorResult.setProjectManager(!managerList.isEmpty() ? managerList.get(0) : null);
+            monitorResult.setEngineerList(filterUserArchivesAllocation(allocationDtoList, SopRoleTypeEnum.ENGINEER));
+        }
+
+        return pageProjectMonitor;
+    }
+
+    private List<ProjectMonitorUserResult> filterUserArchivesAllocation(List<UserArchivesAllocationDto> allocationDtoList, SopRoleTypeEnum roleType) {
+        List<ProjectMonitorUserResult> monitorResultList = new ArrayList<>();
+        List<UserArchivesAllocationDto> filterUserList = allocationDtoList.stream().filter(user -> user.getSopRoleType().equals(roleType)).collect(
+                Collectors.toList());
+        for (UserArchivesAllocationDto dto : filterUserList) {
+            ProjectMonitorUserResult userResult = new ProjectMonitorUserResult();
+            BeanUtils.copyProperties(dto, userResult);
+            monitorResultList.add(userResult);
+        }
+        return monitorResultList;
+    }
+
+    private List<String> getProcessList(CrmProcessEnum process) {
+        List<String> processList = new ArrayList<>();
+        if (process == CrmProcessEnum.FINISH) {
+            return processList;
+        }
+        String[] descArr = process.getDesc().split(",");
+        return Arrays.asList(descArr);
+    }
+
+}

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

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
 import com.qmth.sop.business.bean.dto.AllocationDetailDto;
 import com.qmth.sop.business.bean.dto.DataPermissionDto;
+import com.qmth.sop.business.bean.dto.UserArchivesAllocationDto;
 import com.qmth.sop.business.bean.dto.UserArchivesDto;
 import com.qmth.sop.business.bean.params.*;
 import com.qmth.sop.business.bean.result.*;
@@ -692,6 +693,11 @@ public class TBUserArchivesAllocationServiceImpl
         return result;
     }
 
+    @Override
+    public List<UserArchivesAllocationDto> listUserArchivesAllocation(Long crmDetailId) {
+        return baseMapper.listUserArchivesAllocation(crmDetailId);
+    }
+
     /**
      * 处理临时新增的分配名单
      *

+ 14 - 0
sop-business/src/main/resources/db/log/haoguanghui_update_log.sql

@@ -14,6 +14,7 @@ CREATE TABLE sys_custom_receiver  (
     PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '客户收件人信息表' ROW_FORMAT = Dynamic;
 
+-- 收件信息
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (400, '收件信息', 'receiver', 'MENU', 2, 6, NULL, NULL, 1, 0, 1);
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (401, '新增', 'Add', 'BUTTON', 400, 1, 'AUTH', '407', 1, 0, 1);
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (402, '查询', 'Select', 'BUTTON', 400, 2, 'AUTH', '411,412', 1, 0, 1);
@@ -27,3 +28,16 @@ INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`,
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (410, '收件信息导出', '/api/sys/custom/receiver/export', 'URL', 400, 4, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (411, '收件信息列表', '/api/sys/custom/receiver/page', 'URL', 400, 5, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (412, '客户列表', '/api/sys/custom/receiver/list', 'URL', 400, 6, 'AUTH', NULL, 1, 1, 0);
+
+-- 2024-09-05
+-- 项目监控
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (420, '项目监控', 'ProjectMonitor', 'MENU', 40, 3, NULL, NULL, 1, 0, 1);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (421, '查询条件', 'Condition', 'CONDITION', 420, 1, 'AUTH', '425', 1, 0, 1);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (422, '查询', 'Select', 'BUTTON', 420, 2, 'AUTH', '425', 1, 0, 1);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (423, '列表', 'List', 'LIST', 420, 3, 'AUTH', '425', 1, 0, 1);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (424, '工作证', 'Card', 'LINK', 420, 4, 'AUTH', '426', 1, 0, 1);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (425, '项目监控列表', '/api/admin/project/monitor/page', 'URL', 420, 1, 'AUTH', NULL, 1, 1, 0);
+INSERT INTO sys_privilege(`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (426, '工作证详情', '/api/admin/project/monitor/user/detail', 'URL', 420, 2, 'AUTH', NULL, 1, 1, 0);
+update sys_privilege set sequence=4 where id=43;
+update sys_privilege set sequence=5 where id=44;
+

+ 109 - 0
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -304,4 +304,113 @@
                 where tbsi.id = #{id} and tbuaa.sop_role_type in ('REGION_COORDINATOR','ENGINEER','PROJECT_MANAGER')
             )
     </select>
+
+    <select id="pageProjectMonitor" resultType="com.qmth.sop.business.bean.result.ProjectMonitorResult">
+        SELECT DISTINCT
+            sc.NAME AS customName,
+            tbc.NAME AS crmName,
+            tbcd.course_name AS courseName,
+            IFNULL( art.NAME_, '已完成' ) AS taskName,
+            su3.real_name AS leadName,
+            su3.mobile_number leadMobile,
+            tbsi.sop_no AS sopNo,
+            tbcd.id AS crmDetailId,
+            IF ( sc.type = 'OFFICE', '教务处', '研究生' ) AS customManagerTypeStr,
+            cast( tfcfe.flow_id AS CHAR ) AS flowId,
+            tbsi.update_time AS updateTime
+        FROM
+            t_b_sop_info tbsi
+                LEFT JOIN t_b_crm tbc ON tbc.crm_no = tbsi.crm_no
+                LEFT JOIN t_b_service tbs ON tbs.id = tbsi.service_id
+                LEFT JOIN sys_custom sc ON sc.id = tbsi.custom_id
+                LEFT JOIN sys_user su1 ON su1.id = tbc.crm_user_id
+                LEFT JOIN t_f_custom_flow_entity tfcfe ON tfcfe.CODE = tbsi.sop_no
+                LEFT JOIN t_f_flow_approve tffa ON tffa.flow_id = tfcfe.flow_id
+                LEFT JOIN ACT_RU_TASK art ON art.PROC_INST_ID_ = tffa.flow_id
+                LEFT JOIN t_f_custom_flow tfcf ON tfcf.id = tfcfe.t_f_custom_flow_id
+                LEFT JOIN t_b_crm_detail tbcd ON tbcd.sop_no = tbsi.sop_no
+                LEFT JOIN sys_user su3 ON su3.id = tbc.lead_id
+        <where>
+            <if test="serviceUnitId != null">
+                AND tbsi.service_id=#{serviceUnitId}
+            </if>
+            <if test="customerId != null">
+                AND tbsi.custom_id=#{customerId}
+            </if>
+
+            <if test="process != null">
+                <choose>
+                    <!--非已完成状态-->
+                    <when test="prList != null and prList.size > 0">
+                        AND art.NAME_ in
+                        <foreach collection="prList" item="item" index="index" open="(" separator="," close=")">
+                            #{item}
+                        </foreach>
+                    </when>
+                    <!-- 已完成状态-->
+                    <otherwise>
+                        AND art.NAME_ is null
+                    </otherwise>
+                </choose>
+            </if>
+
+            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo and !dpr.hasQA">
+                <choose>
+                    <when test="dpr.hasThirdPmo">
+                        AND EXISTS (
+                        SELECT
+                        1
+                        FROM
+                        t_b_user_archives_allocation tbuaa
+                        LEFT JOIN t_b_user_archives_supplier tbuas ON tbuaa.archives_id = tbuas.user_archives_id
+                        WHERE
+                        tbuas.supplier_id = #{dpr.supplierId} AND tbuaa.crm_no = tbsi.crm_no)
+                    </when>
+                    <otherwise>
+                        <choose>
+                            <when test="dpr.hasBusiness">
+                                AND tbs.service_lead_id = #{dpr.requestUserId}
+                            </when>
+                            <otherwise>
+                                <choose>
+                                    <when test="dpr.hasRegionManager">
+                                        AND tbc.lead_id = #{dpr.requestUserId}
+                                    </when>
+                                    <otherwise>
+                                        <choose>
+                                            <when test="dpr.hasProjectManager">
+                                                AND EXISTS(SELECT 1 FROM t_b_user_archives_allocation tbuaa WHERE tbuaa.crm_detail_id = tbcd.id AND tbuaa.user_id = #{dpr.requestUserId} and tbuaa.sop_role_type = 'PROJECT_MANAGER')
+                                            </when>
+                                            <otherwise>
+                                                <choose>
+                                                    <when test="dpr.hasRegionCoordinator">
+                                                        AND EXISTS(SELECT 1 FROM t_b_user_archives_allocation tbuaa WHERE tbuaa.crm_detail_id = tbcd.id AND tbuaa.user_id = #{dpr.requestUserId} and tbuaa.sop_role_type = 'REGION_COORDINATOR')
+                                                    </when>
+                                                    <otherwise>
+                                                        <choose>
+                                                            <when test="!dpr.hasAccountManager and (dpr.hasEffectEngineer or dpr.hasAssistantEngineer)">
+                                                                AND EXISTS(SELECT 1 FROM t_b_user_archives_allocation tbuaa WHERE tbuaa.crm_detail_id = tbcd.id AND tbuaa.user_id = #{dpr.requestUserId} and tbuaa.sop_role_type = 'ENGINEER')
+                                                            </when>
+                                                        </choose>
+                                                        <choose>
+                                                            <when test="dpr.hasAccountManager">
+                                                                AND tbc.crm_user_id = #{dpr.requestUserId}
+                                                            </when>
+                                                        </choose>
+                                                    </otherwise>
+                                                </choose>
+                                            </otherwise>
+                                        </choose>
+                                    </otherwise>
+                                </choose>
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
+
+            and IF(tbs.`status` = 'PUBLISH', tffa.status in ('START', 'DRAFT', 'AUDITING', 'REJECT', 'CANCEL', 'FINISH'), 1 <![CDATA[ <> ]]> 1)
+        </where>
+        ORDER BY tbsi.update_time DESC,tbsi.sop_no DESC
+    </select>
 </mapper>

+ 15 - 0
sop-business/src/main/resources/mapper/TBUserArchivesAllocationMapper.xml

@@ -268,4 +268,19 @@
         </where>
         ORDER BY sr.type
     </select>
+    <select id="listUserArchivesAllocation" resultType="com.qmth.sop.business.bean.dto.UserArchivesAllocationDto" parameterType="java.lang.Long">
+        SELECT
+            tbua.id userId,
+            tbuaa.sop_role_type sopRoleType,
+            tbua.NAME userName,
+            mobile_number mobileNumber,
+            s.NAME supplierName
+        FROM
+            t_b_user_archives_allocation tbuaa
+                LEFT JOIN t_b_user_archives tbua ON tbuaa.archives_id = tbua.id
+                LEFT JOIN t_b_user_archives_supplier tbas ON tbas.user_archives_id = tbua.id
+                LEFT JOIN sys_supplier s ON s.id = tbas.supplier_id
+        WHERE
+            tbuaa.crm_detail_id = #{crmDetailId}
+    </select>
 </mapper>

+ 1 - 0
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -438,6 +438,7 @@ public class SystemConstant {
     public static final String PREFIX_URL_DEVICE_DELIVERY = "/admin/device/delivery";
 
     public static final String PREFIX_URL_DEVICE_MANAGE = "/admin/device/manage";
+    public static final String PREFIX_URL_PROJECT_MONITOR = "/admin/project/monitor";
 
     /**
      * 缓存配置

+ 48 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/CrmProcessEnum.java

@@ -0,0 +1,48 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description 项目进度
+ * 教务处:准备(项目确认),扫描(扫描准备、扫描收尾),评卷(阅卷参数检查),收尾(阅卷收尾检查),完成(阅卷收尾检查提交后)
+ * 研究生:准备(项目初审、项目关键信息、内审),扫描(现场环境测试、扫描准备、校验收尾),评卷(评卷准备、成绩复核),收尾(评卷收尾、设备入库登记),完成(设备入库登记提交后就是完成)
+ */
+public enum CrmProcessEnum {
+
+    PREPARE("准备", "项目确认,项目初审,项目关键信息,内审"),
+
+    SCAN("扫描", "扫描准备,扫描收尾,现场环境测试,扫描准备,校验收尾"),
+
+    MARK("评卷", "阅卷参数检查,评卷准备,成绩复核"),
+
+    FINAL("收尾", "阅卷收尾检查,评卷收尾,设备入库登记"),
+
+    FINISH("已完成", "已完成");
+
+    CrmProcessEnum(String title, String desc) {
+        this.title = title;
+        this.desc = desc;
+    }
+
+    private String title;
+
+    private String desc;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public static CrmProcessEnum findCrmProcessByDesc(String desc) {
+        for (CrmProcessEnum crmProcessEnum : CrmProcessEnum.values()) {
+            String[] descArr = crmProcessEnum.getDesc().split(",");
+            for (String str : descArr) {
+                if (str.equals(desc))
+                    return crmProcessEnum;
+            }
+        }
+        return null;
+    }
+
+}