shudonghui 1 yıl önce
ebeveyn
işleme
89c0a85a32
19 değiştirilmiş dosya ile 104 ekleme ve 83 silme
  1. 3 3
      sop-api/src/main/java/com/qmth/sop/server/api/CrmAnalyseController.java
  2. 2 2
      sop-api/src/main/java/com/qmth/sop/server/api/QualityAnalyseController.java
  3. 5 4
      sop-api/src/main/java/com/qmth/sop/server/api/ServiceAnalyseController.java
  4. 2 2
      sop-api/src/main/java/com/qmth/sop/server/api/SopScheduleController.java
  5. 1 1
      sop-business/src/main/java/com/qmth/sop/business/mapper/QualityAnalyseMapper.java
  6. 1 1
      sop-business/src/main/java/com/qmth/sop/business/mapper/ServiceAnalyseMapper.java
  7. 1 1
      sop-business/src/main/java/com/qmth/sop/business/mapper/SopScheduleMapper.java
  8. 1 1
      sop-business/src/main/java/com/qmth/sop/business/service/QualityAnalyseService.java
  9. 2 2
      sop-business/src/main/java/com/qmth/sop/business/service/ServiceAnalyseService.java
  10. 1 1
      sop-business/src/main/java/com/qmth/sop/business/service/SopScheduleService.java
  11. 4 4
      sop-business/src/main/java/com/qmth/sop/business/service/impl/QualityAnalyseServiceImpl.java
  12. 7 8
      sop-business/src/main/java/com/qmth/sop/business/service/impl/ServiceAnalyseServiceImpl.java
  13. 5 5
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SopAnalyseServiceImpl.java
  14. 3 3
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SopScheduleServiceImpl.java
  15. 5 6
      sop-business/src/main/resources/mapper/CrmAnalyseMapper.xml
  16. 17 11
      sop-business/src/main/resources/mapper/QualityAnalyseMapper.xml
  17. 29 18
      sop-business/src/main/resources/mapper/ServiceAnalyseMapper.xml
  18. 8 6
      sop-business/src/main/resources/mapper/SopAnalyseMapper.xml
  19. 7 4
      sop-business/src/main/resources/mapper/SopScheduleMapper.xml

+ 3 - 3
sop-api/src/main/java/com/qmth/sop/server/api/CrmAnalyseController.java

@@ -108,7 +108,7 @@ public class CrmAnalyseController {
     }
 
 
-   
+    
     @ApiOperation(value = "供应商派单分布下钻接口")
     @RequestMapping(value = "/supplier/detail", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "供应商派单分布下钻", response = TBCrmResult.class)})
@@ -123,7 +123,7 @@ public class CrmAnalyseController {
     }
     //大区在执行派单排名
 
-   
+    
     @ApiOperation(value = "大区在执行派单排名接口")
     @RequestMapping(value = "/region", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "大区在执行派单排名", response = CrmAnalyseResult.class)})
@@ -137,7 +137,7 @@ public class CrmAnalyseController {
 
     //大区在执行派单排名
 
-   
+    
     @ApiOperation(value = "大区在执行派单排名下钻接口")
     @RequestMapping(value = "/region/detail", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "大区在执行派单排名下钻", response = CrmAnalyseResult.class)})

+ 2 - 2
sop-api/src/main/java/com/qmth/sop/server/api/QualityAnalyseController.java

@@ -132,12 +132,12 @@ public class QualityAnalyseController {
     @ApiResponses({@ApiResponse(code = 200, message = "影响度/归因明细", response = TBQualityProblemApplyResult.class)})
     public Result influence(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
                             @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId,
-                            @ApiParam(value = "大区") @RequestParam(required = false) String province,
+                            @ApiParam(value = "大区") @RequestParam(required = false) Long region_id,
                             @ApiParam(value = "影响度") @RequestParam(required = false) InfluenceDegreeEnum Influence_degree,
                             @ApiParam(value = "问题原因类型") @RequestParam(required = false) QualityProblemReasonEnum reason,
                             @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) {
-        IPage<TBQualityProblemApplyResult> resultIPage = qualityAnalyseService.influence(new Page<>(pageNumber, pageSize), serviceUnitId, supplierId,province,Influence_degree,reason);
+        IPage<TBQualityProblemApplyResult> resultIPage = qualityAnalyseService.influence(new Page<>(pageNumber, pageSize), serviceUnitId, supplierId,region_id,Influence_degree,reason);
 
         return ResultUtil.ok(resultIPage);
     }

+ 5 - 4
sop-api/src/main/java/com/qmth/sop/server/api/ServiceAnalyseController.java

@@ -46,6 +46,7 @@ public class ServiceAnalyseController {
 
 
     //服务单元列表
+    
     @ApiOperation(value = "服务单元列表接口")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "服务单元列表", response = TBService.class)})
@@ -149,10 +150,10 @@ public class ServiceAnalyseController {
     @ApiResponses({@ApiResponse(code = 200, message = "人力供应商覆盖大区", response = Map.class)})
     public Result regionDetail(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceUnitId,
                                @ApiParam(value = "供应商", required = true) @RequestParam Long supplierId,
-                               @ApiParam(value = "大区", required = true) @RequestParam String province) {
+                               @ApiParam(value = "大区", required = true) @RequestParam Long regionId) {
         Map<String,Object> map=new HashMap<>();
-        map.put("projectRoleQuota", serviceAnalyseService.findCrmAllocationSubTotal(serviceUnitId,province,supplierId));
-        List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, province, supplierId);
+        map.put("projectRoleQuota", serviceAnalyseService.findCrmAllocationSubTotal(serviceUnitId,regionId,supplierId));
+        List<UserArchivesAllocationResult> crmAllocation = serviceAnalyseService.findCrmAllocation(serviceUnitId, regionId, supplierId);
         map.put("projectWait", crmAllocation.stream().filter(e->e.getDistributed()<e.getQuota()).count());
         map.put("regionCities", crmAllocation.stream().collect(Collectors.groupingBy(UserArchivesAllocationResult::getCity)).size());
         return ResultUtil.ok(map);
@@ -161,7 +162,7 @@ public class ServiceAnalyseController {
     /**
      * 7.项目调配完成进度=(差额为0的派单总数÷派单总数)×100%;不提供【数据下钻】
      */
-    
+
     @ApiOperation(value = "项目调配完成进度")
     @RequestMapping(value = "/project/allocation", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "项目调配完成进度", response = Long.class) })

+ 2 - 2
sop-api/src/main/java/com/qmth/sop/server/api/SopScheduleController.java

@@ -72,11 +72,11 @@ public class SopScheduleController {
     @RequestMapping(value = "/detail", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "SOP明细", response = Map.class)})
     public Result detail(@ApiParam(value = "服务单元", required = true) @RequestParam Long serviceId,
-                         @ApiParam(value = "大区") @RequestParam(required = false) String provence,
+                         @ApiParam(value = "大区") @RequestParam(required = false) Long regionId,
                          @ApiParam(value = "供应商") @RequestParam(required = false) Long supplierId,
                          @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) {
-        IPage<Map<String,Object>> resultIPage = sopScheduleService.detail(new Page<>(pageNumber, pageSize),serviceId, provence, supplierId);
+        IPage<Map<String,Object>> resultIPage = sopScheduleService.detail(new Page<>(pageNumber, pageSize),serviceId, regionId, supplierId);
         return ResultUtil.ok(resultIPage);
     }
 

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

@@ -35,5 +35,5 @@ public interface QualityAnalyseMapper extends BaseMapper<TBQualityProblemApply>
 
     Map<String, Object> pie(@Param("serviceUnitId")Long serviceUnitId,@Param("supplierId") Long supplierId);
 
-    IPage<TBQualityProblemApplyResult> influenceDetail(Page<Object> tPage,@Param("serviceUnitId") Long serviceUnitId,@Param("supplierId") Long supplierId,@Param("province") String province,@Param("influenceDegree") InfluenceDegreeEnum influenceDegree,@Param("reason") QualityProblemReasonEnum reason);
+    IPage<TBQualityProblemApplyResult> influenceDetail(Page<Object> tPage,@Param("serviceUnitId") Long serviceUnitId,@Param("supplierId") Long supplierId,@Param("region_id") Long region_id,@Param("influenceDegree") InfluenceDegreeEnum influenceDegree,@Param("reason") QualityProblemReasonEnum reason);
 }

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

@@ -44,5 +44,5 @@ public interface ServiceAnalyseMapper extends BaseMapper<TBService> {
 
     List<Map<String, Object>> personnel(@Param("serviceUnitId")Long serviceUnitId);
 
-    List<UserArchivesAllocationResult> findCrmAllocation(@Param("serviceUnitId")Long serviceUnitId,@Param("province") String province,@Param("supplierId") Long supplierId);
+    List<UserArchivesAllocationResult> findCrmAllocation(@Param("serviceUnitId")Long serviceUnitId,@Param("regionId") Long regionId,@Param("supplierId") Long supplierId);
 }

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

@@ -21,5 +21,5 @@ public interface SopScheduleMapper extends BaseMapper<TBSopInfo> {
 
     List<Map<String, Object>> progress(@Param("serviceId") Long serviceId);
 
-    <T> IPage<Map<String,Object>> detail(Page<T> tPage, @Param("serviceId")Long serviceId, @Param("provence") String provence, @Param("supplierId") Long supplierId);
+    <T> IPage<Map<String,Object>> detail(Page<T> tPage, @Param("serviceId")Long serviceId, @Param("regionId") Long regionId, @Param("supplierId") Long supplierId);
 }

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/QualityAnalyseService.java

@@ -27,5 +27,5 @@ public interface QualityAnalyseService extends IService<TBQualityProblemApply> {
 
     IPage<TBQualityProblemApplyResult> detail(Page<Object> objectPage, Long serviceUnitId, Long supplierId);
 
-    IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, String province, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason);
+    IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, Long region_id, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason);
 }

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

@@ -28,7 +28,7 @@ public interface ServiceAnalyseService extends IService<TBService> {
 
     List<Map<String, Object>> personnel(Long serviceUnitId);
 
-    UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, Long supplierId);
+    UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, Long regionId, Long supplierId);
 
-    List<UserArchivesAllocationResult> findCrmAllocation(Long serviceUnitId, String province, Long supplierId);
+    List<UserArchivesAllocationResult> findCrmAllocation(Long serviceUnitId, Long regionId, Long supplierId);
 }

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/service/SopScheduleService.java

@@ -13,5 +13,5 @@ public interface SopScheduleService extends IService<TBSopInfo> {
 
     Map<String, Map<String, Object>> progress(Long serviceId, SopAnalyseGroupEnum group);
 
-    <T> IPage<Map<String,Object>> detail(Page<T> tPage, Long serviceId, String provence, Long supplierId);
+    <T> IPage<Map<String,Object>> detail(Page<T> tPage, Long serviceId, Long regionId, Long supplierId);
 }

+ 4 - 4
sop-business/src/main/java/com/qmth/sop/business/service/impl/QualityAnalyseServiceImpl.java

@@ -38,7 +38,7 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
         List<Map<String, Object>> influence = this.baseMapper.influence(serviceUnitId);
         Map<String, Map<String, Object>> result = new HashMap<>();
         if (group.equals(QualityAnalyseGroupEnum.INFLUENCE_REGION)) {
-            influence.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
                 Map<String, Object> map = new HashMap<>();
                 v.stream().collect(Collectors.groupingBy(map1 -> map1.get("Influence_degree"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
                 result.put(k.toString(), map);
@@ -50,7 +50,7 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
                 result.put(k.toString(), map);
             });
         } else if (group.equals(QualityAnalyseGroupEnum.REASON_REGION)) {
-            influence.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+            influence.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
                 Map<String, Object> map = new HashMap<>();
                 v.stream().collect(Collectors.groupingBy(map1 -> map1.get("reason"))).forEach((k1, v1) -> map.put(k1.toString(), v1.size()));
                 result.put(k.toString(), map);
@@ -82,7 +82,7 @@ public class QualityAnalyseServiceImpl extends ServiceImpl<QualityAnalyseMapper,
     }
 
     @Override
-    public IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, String province, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason) {
-        return this.baseMapper.influenceDetail(tPage, serviceUnitId, supplierId,province, influenceDegree, reason);
+    public IPage<TBQualityProblemApplyResult> influence(Page<Object> tPage, Long serviceUnitId, Long supplierId, Long region_id, InfluenceDegreeEnum influenceDegree, QualityProblemReasonEnum reason) {
+        return this.baseMapper.influenceDetail(tPage, serviceUnitId, supplierId,region_id, influenceDegree, reason);
     }
 }

+ 7 - 8
sop-business/src/main/java/com/qmth/sop/business/service/impl/ServiceAnalyseServiceImpl.java

@@ -51,11 +51,11 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
         map.put("projectProgress", this.baseMapper.projectProgress(serviceUnitId));
         map.put("equipmentOutboundTotal", this.baseMapper.equipmentOutboundTotal(serviceUnitId));
         int totalDevices = sysDeviceService.count(new LambdaQueryWrapper<SysDevice>().eq(SysDevice::getStatus, DeviceStatusEnum.NORMAL));
-        map.put("equipmentOccupancyRate", ((Integer) map.get("equipmentOutboundTotal")) * 100 / totalDevices);
+        map.put("equipmentOccupancyRate",totalDevices==0?0: ((Integer) map.get("equipmentOutboundTotal")) * 100 / totalDevices);
         map.put("servicePersonnelTotal", this.baseMapper.servicePersonnelTotal(serviceUnitId));
         //认证有效的人员总数
         int totalUserArchives = tbUserArchivesSupplierService.countAuthentication();
-        map.put("sitePersonnelOccupancyRate", ((Integer) map.get("servicePersonnelTotal")) * 100 / totalUserArchives);
+        map.put("sitePersonnelOccupancyRate",totalUserArchives==0?0: ((Integer) map.get("servicePersonnelTotal")) * 100 / totalUserArchives);
         return map;
     }
 
@@ -67,7 +67,7 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
         Map<String, Object> map = new HashMap<>();
         map.put("projectCount", this.baseMapper.projectCount(serviceUnitId));
         List<Map<String, Object>> maps = this.baseMapper.supplierDistribution(serviceUnitId);
-        maps = maps.stream().peek(m -> m.put("percent", ((Long) m.get("count")) * 100 / ((Integer) map.get("projectCount")) + "%")).collect(Collectors.toList());
+        maps = maps.stream().peek(m -> m.put("percent",(Integer) map.get("projectCount")==0?0: ((Long) m.get("count")) * 100 / ((Integer) map.get("projectCount")) + "%")).collect(Collectors.toList());
         map.put("supplierDistribution", maps);
         return map;
     }
@@ -100,10 +100,9 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
 
 
     @Override
-    public UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, String province, Long supplierId) {
-        province = SystemConstant.translateSpecificSign(province);
+    public UserArchivesAllocationSubTotalResult findCrmAllocationSubTotal(Long serviceUnitId, Long regionId, Long supplierId) {
 
-        List<UserArchivesAllocationResult> list = this.baseMapper.findCrmAllocation(serviceUnitId, province, supplierId);
+        List<UserArchivesAllocationResult> list = this.baseMapper.findCrmAllocation(serviceUnitId, regionId, supplierId);
         Integer publishedCrmCount = Math.toIntExact(list.stream().filter(e -> CrmStatusEnum.PUBLISH.equals(e.getCrmStatus())).count());
         Integer totalCrmCount = list.size();
 
@@ -129,7 +128,7 @@ public class ServiceAnalyseServiceImpl extends ServiceImpl<ServiceAnalyseMapper,
     }
 
     @Override
-    public List<UserArchivesAllocationResult> findCrmAllocation(Long serviceUnitId, String province, Long supplierId) {
-        return this.baseMapper.findCrmAllocation(serviceUnitId, province, supplierId);
+    public List<UserArchivesAllocationResult> findCrmAllocation(Long serviceUnitId, Long regionId, Long supplierId) {
+        return this.baseMapper.findCrmAllocation(serviceUnitId, regionId, supplierId);
     }
 }

+ 5 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/SopAnalyseServiceImpl.java

@@ -33,7 +33,7 @@ public class SopAnalyseServiceImpl extends ServiceImpl<SopAnalyseMapper, TBSopIn
         List<Map<String, Object>> list = this.baseMapper.overview(serviceId);
         List<Map<String, Object>> result = new ArrayList<>();
         if (group.equals(SopAnalyseGroupEnum.REGION)) {
-            list.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+            list.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
                 Map<String, Object> map = new HashMap<>();
                 map.put("province", k);
                 processOverviewData(v, map);
@@ -99,7 +99,7 @@ public class SopAnalyseServiceImpl extends ServiceImpl<SopAnalyseMapper, TBSopIn
                 result.add(map);
             });
         } else if (group.equals(SopAnalyseGroupEnum.REGION)) {
-            list.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+            list.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
                 Map<String, Object> map = new HashMap<>();
                 map.put("province", k);
                 processing(v, map);
@@ -110,7 +110,7 @@ public class SopAnalyseServiceImpl extends ServiceImpl<SopAnalyseMapper, TBSopIn
                 Map<String, Object> map = new HashMap<>();
                 map.put("supplier", k);
                 //大区
-                map.put("province", v.get(0).get("province"));
+                map.put("region_name", v.get(0).get("region_name"));
                 processing(v, map);
                 result.add(map);
             });
@@ -187,9 +187,9 @@ public class SopAnalyseServiceImpl extends ServiceImpl<SopAnalyseMapper, TBSopIn
 
 
         } else if (group.equals(SopAnalyseGroupEnum.REGION)) {
-            attendance.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> {
+            attendance.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> {
                 Map<String, Object> map = new HashMap<>();
-                map.put("supplier", k);
+                map.put("region_name", k);
                 map.put("real_name", v.get(0).get("real_name"));
                 long total = v.stream().filter(map1 -> map1.get("id") != null).count();
                 map.put("total", total);

+ 3 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/SopScheduleServiceImpl.java

@@ -28,7 +28,7 @@ public class SopScheduleServiceImpl extends ServiceImpl<SopScheduleMapper, TBSop
         if (group.equals(SopAnalyseGroupEnum.POPULATION)) {
             result.put("POPULATION", processData(list));
         } else if (group.equals(SopAnalyseGroupEnum.REGION)) {
-            list.stream().collect(Collectors.groupingBy(map -> map.get("province"))).forEach((k, v) -> result.put(k.toString(), processData(v)));
+            list.stream().collect(Collectors.groupingBy(map -> map.get("region_name"))).forEach((k, v) -> result.put(k.toString(), processData(v)));
         } else if (group.equals(SopAnalyseGroupEnum.SUPPLIER)) {
             list.stream().collect(Collectors.groupingBy(map -> map.get("name"))).forEach((k, v) -> result.put(k.toString(), processData(v)));
         }
@@ -46,8 +46,8 @@ public class SopScheduleServiceImpl extends ServiceImpl<SopScheduleMapper, TBSop
     }
 
     @Override
-    public <T> IPage<Map<String, Object>> detail(Page<T> tPage, Long serviceId, String provence, Long supplierId) {
-        return this.baseMapper.detail(tPage, serviceId, provence, supplierId);
+    public <T> IPage<Map<String, Object>> detail(Page<T> tPage, Long serviceId, Long regionId, Long supplierId) {
+        return this.baseMapper.detail(tPage, serviceId, regionId, supplierId);
     }
 
 }

+ 5 - 6
sop-business/src/main/resources/mapper/CrmAnalyseMapper.xml

@@ -4,14 +4,12 @@
     <select id="region" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
         SELECT
         r.id,
-        d.province name,
+        r.region_name,
         count( c.id ) count
         FROM
         t_b_crm c
-        LEFT JOIN sys_custom cu ON cu.id = c.custom_id
         LEFT JOIN t_b_service s ON c.service_id = s.id
         left join t_b_service_region r on r.service_id=s.id
-        left join t_b_service_region_detail d on d.service_region_id=r.id
         <where>
             and s.`status`='PUBLISH' and c.service_id is not null and r.id is not null
             <if test="type != null and type != ''">
@@ -29,7 +27,7 @@
         </where>
         GROUP BY
         r.id,
-        d.province
+        r.region_name
         order by count( c.id )
     </select>
     <select id="project" resultType="com.qmth.sop.business.bean.result.CrmAnalyseResult">
@@ -66,7 +64,8 @@
         FROM
         t_b_crm c
         LEFT JOIN t_b_service s ON c.service_id = s.id
-        LEFT JOIN sys_user u ON u.id = c.region_coordinator_id
+        left join t_b_service_region r on r.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id
@@ -176,7 +175,7 @@
         left join t_b_service_region r on r.service_id=tbs.id
         LEFT JOIN sys_custom sc ON sc.id = a.custom_id
 
-        LEFT JOIN sys_user u ON u.id = a.region_coordinator_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id

+ 17 - 11
sop-business/src/main/resources/mapper/QualityAnalyseMapper.xml

@@ -26,8 +26,9 @@
         FROM
         t_b_quality_problem_apply a
         LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
-        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
-        LEFT JOIN sys_user u ON u.id = sc.manager_id
+        LEFT JOIN t_b_service s ON a.service_id = s.id
+        left join t_b_service_region r on r.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
@@ -51,8 +52,9 @@
         FROM
         t_b_quality_problem_apply a
         LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
-        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
-        LEFT JOIN sys_user u ON u.id = sc.manager_id
+        LEFT JOIN t_b_service s ON a.service_id = s.id
+        left join t_b_service_region r on r.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
@@ -91,8 +93,9 @@
         FROM
         t_b_quality_problem_apply a
         LEFT JOIN t_b_sop_info si on si.sop_no = a.sop_no
-        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
-        LEFT JOIN sys_user u ON u.id = sc.manager_id
+        LEFT JOIN t_b_service s ON a.service_id = s.id
+        left join t_b_service_region r on r.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN t_f_custom_flow_entity fe ON 	fe.`code`= a.problem_no
@@ -128,8 +131,8 @@
             <if test="supplierId != null and supplierId != ''">
                 and us.supplier_id = #{supplierId}
             </if>
-            <if test="province != null and province != ''">
-                and sc.province = #{supplierId}
+            <if test="region_id != null and region_id != ''">
+                and r.id = #{region_id}
             </if>
             <if test="influenceDegree != null and influenceDegree != ''">
                 and a.Influence_degree = #{influenceDegree}
@@ -163,15 +166,18 @@
         a.Influence_degree,
         su.`name` supplier,
         su.id supplierId,
-        sc.province,
+        r.id region_id,
+        r.region_name,
         a.reason
         FROM
         t_b_quality_problem_apply a
         LEFT JOIN t_b_sop_info si ON si.sop_no = a.sop_no
-        LEFT JOIN sys_custom sc ON sc.id = si.custom_id
+        LEFT JOIN t_b_service s ON a.service_id = s.id
+        left join t_b_service_region r on r.service_id=s.id
         LEFT JOIN t_f_custom_flow_entity fe ON fe.`code` = a.problem_no
         LEFT JOIN t_f_flow_approve fa ON fa.flow_id = fe.flow_id
-        LEFT JOIN sys_user u ON find_in_set( u.id, a.user_ids )
+<!--        LEFT JOIN sys_user u ON find_in_set( u.id, a.user_ids )-->
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id

+ 29 - 18
sop-business/src/main/resources/mapper/ServiceAnalyseMapper.xml

@@ -89,8 +89,11 @@
         count(DISTINCT c.id ) count
         FROM
         t_b_user_archives_allocation aa
-        LEFT JOIN t_b_crm c ON c.service_id = aa.service_id
-        LEFT JOIN t_b_user_archives_supplier uas ON uas.user_archives_id = aa.archives_id
+        LEFT JOIN t_b_service s ON aa.service_id = s.id
+        left join t_b_service_region r on r.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
+        LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = uas.supplier_id
                 <where>
 
@@ -125,7 +128,8 @@
         left join t_b_service_region r on r.service_id=tbs.id
         LEFT JOIN sys_custom sc ON sc.id = a.custom_id
 
-        LEFT JOIN sys_user u ON u.id = a.region_coordinator_id
+
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id
@@ -161,13 +165,15 @@
     </select>
     <select id="supplierRegion" resultType="java.util.Map">
         SELECT DISTINCT
-        rd.province
+        r.id region_id,
+        r.region_name
         FROM
         t_b_crm c
-        LEFT JOIN t_b_service_region sr ON c.service_id = sr.service_id
-        LEFT JOIN t_b_service_region_detail rd ON rd.service_region_id = sr.id
-        LEFT JOIN t_b_user_archives_allocation ua ON ua.user_id = c.region_coordinator_id
-        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.archives_id
+        LEFT JOIN t_b_service_region r ON c.service_id = r.service_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
+        LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
+        LEFT JOIN sys_supplier su ON su.id = us.supplier_id
         <where>
             and rd.id IS NOT NULL
             <if test="serviceUnitId != null and serviceUnitId != ''">
@@ -214,12 +220,16 @@
         rm.real_name AS regionManagerName,
         pu.real_name AS publishUserName,
         tbc.publish_time AS publishTime,
+        r.id region_id,
         us.supplier_id
         FROM
         t_b_crm tbc
-        LEFT JOIN t_b_user_archives_allocation ua ON ua.user_id = tbc.region_coordinator_id
-        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.archives_id
+
         LEFT JOIN t_b_service tbs ON tbc.service_id = tbs.id
+        LEFT JOIN t_b_service_region r ON tbc.service_id = r.service_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
+        LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_custom su ON tbc.custom_id = su.id
         LEFT JOIN sys_level sl ON su.level_id = sl.id
         LEFT JOIN sys_user pu ON tbc.publish_user_id = pu.id
@@ -258,8 +268,8 @@
             <if test="serviceUnitId != null">
                 AND result.serviceUnitId = #{serviceUnitId}
             </if>
-            <if test="province != null and province != ''">
-                AND result.province LIKE CONCAT('%',#{province},'%')
+            <if test="region_id != null and region_id != ''">
+                AND result.region_id LIKE CONCAT('%',#{region_id},'%')
             </if>
             <if test="supplierId != null and supplierId != ''">
                 AND result.supplier_id = #{supplierId}
@@ -288,14 +298,15 @@
     <select id="personnel" resultType="java.util.Map">
         SELECT
         su.`name`,
-        sc.province,
+        r.region_name,
         count( DISTINCT aa.id ) count
         FROM
         t_b_user_archives_allocation aa
-        LEFT JOIN t_b_crm c ON c.service_id = aa.service_id
-        LEFT JOIN sys_custom sc ON c.custom_id = sc.id
-        LEFT JOIN t_b_user_archives_supplier uas ON uas.user_archives_id = aa.archives_id
-        LEFT JOIN sys_supplier su ON su.id = uas.supplier_id
+        LEFT JOIN t_b_service_region r ON aa.service_id = r.service_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
+        LEFT JOIN t_b_user_archives ua ON u.mobile_number = ua.mobile_number
+        LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
+        LEFT JOIN sys_supplier su ON su.id = us.supplier_id
         <where>
             <if test="serviceUnitId != null and serviceUnitId != ''">
                 and aa.service_id = #{serviceUnitId}
@@ -303,7 +314,7 @@
         </where>
         GROUP BY
         su.`name`,
-        sc.province
+        r.region_name
 
     </select>
 </mapper>

+ 8 - 6
sop-business/src/main/resources/mapper/SopAnalyseMapper.xml

@@ -21,7 +21,7 @@
     </select>
     <select id="overview" resultType="java.util.Map">
         SELECT
-        sc.province,
+        r.region_name,
         u.real_name,
         su.NAME supplier,
         c.crm_no,
@@ -38,11 +38,11 @@
         FROM
         t_b_sop_info s
         left join t_b_crm c on c.crm_no=s.crm_no
-        LEFT JOIN sys_custom sc ON sc.id = s.custom_id
+        left join t_b_service_region r on r.service_id=s.id
         LEFT join t_f_custom_flow_entity tfcfe on tfcfe.code = s.sop_no
         LEFT join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
         left join t_b_sop_info_detail id on id.sop_info_id=s.id
-        LEFT JOIN sys_user u ON u.id = id.lead_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id
@@ -89,7 +89,9 @@
         FROM
         t_b_sop_info s
         LEFT JOIN t_b_sop_info_detail id ON id.sop_info_id = s.id
-        LEFT JOIN sys_user u ON u.id = id.lead_id
+        left join t_b_crm c on c.crm_no=s.crm_no
+        left join t_b_service_region r on s.service_id=s.id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id
@@ -110,7 +112,7 @@
 
     <select id="attendance" resultType="java.util.Map">
         SELECT
-        sc.province,
+        r.region_name,
         u.real_name,
         su.NAME supplier,
         c.crm_no,
@@ -123,7 +125,7 @@
         FROM
         t_b_sop_info s
         left join t_b_crm c on c.crm_no=s.crm_no
-        LEFT JOIN sys_custom sc ON sc.id = s.custom_id
+        left join t_b_service_region r on s.service_id=s.id
         left join t_b_sop_info_detail id on id.sop_info_id=s.id
         LEFT JOIN sys_user u ON u.id = id.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number

+ 7 - 4
sop-business/src/main/resources/mapper/SopScheduleMapper.xml

@@ -3,7 +3,8 @@
 <mapper namespace="com.qmth.sop.business.mapper.SopScheduleMapper">
     <select id="progress" resultType="java.util.Map">
         SELECT DISTINCT
-        sc.province,
+        r.id region_id,
+        r.region_name,
         su.`name`,
         tbsi.sop_no,
         tffa.status,
@@ -19,7 +20,8 @@
         t_b_sop_info tbsi
         LEFT JOIN sys_custom sc ON sc.id = tbsi.custom_id
         LEFT JOIN t_b_sop_info_detail id ON id.sop_info_id = tbsi.id
-        LEFT JOIN sys_user u ON u.id = id.lead_id
+        left join t_b_service_region r on tbsi.service_id=r.service_id
+        LEFT JOIN sys_user u ON u.id = r.lead_id
         LEFT JOIN t_b_user_archives ua ON ua.mobile_number = u.mobile_number
         LEFT JOIN t_b_user_archives_supplier us ON us.user_archives_id = ua.id
         LEFT JOIN sys_supplier su ON su.id = us.supplier_id
@@ -71,6 +73,7 @@
         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 t_b_service_region r on tbsi.service_id=r.service_id
         left join sys_custom sc on sc.id = tbsi.custom_id
         left join sys_user su1 on su1.id = sc.manager_id
         left join t_b_product tbp on tbp.id = tbc.product_id
@@ -89,8 +92,8 @@
             <if test="serviceId != null and serviceId != ''">
                 and tbs.id = #{serviceId}
             </if>
-            <if test="provence != null and provence != ''">
-                and sc.provence = #{provence}
+            <if test="region_id != null and region_id != ''">
+                and r.id = #{region_id}
             </if>
             <if test="supplierId != null and supplierId != ''">
                 and us.supplier_id = #{supplierId}