ソースを参照

资源保障报表

wangliang 9 ヶ月 前
コミット
d182d8d554

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

@@ -1,6 +1,7 @@
 package com.qmth.sop.server.api;
 
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.bean.report.DingExceptionCountReportBean;
 import com.qmth.sop.business.bean.report.SupplierCountReportBean;
 import com.qmth.sop.business.service.ResourceSecurityReportService;
 import com.qmth.sop.common.contant.SystemConstant;
@@ -24,7 +25,7 @@ public class ResourceSecurityReportController {
 
     @ApiOperation(value = "设备商供货数量分布")
     @RequestMapping(value = "/device_supplier_count/report", method = RequestMethod.POST)
-    @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = SupplierCountReportBean.class) })
+    @ApiResponses({ @ApiResponse(code = 200, message = "供应商供货数量分布报表", response = SupplierCountReportBean.class) })
     public Result deviceSupplierCountReport(
             @ApiParam(value = "设备商供货数量分布报表", required = true) @RequestParam Long serviceId) {
         return ResultUtil.ok(resourceSecurityReportService.deviceSupplierCountReport(serviceId));
@@ -32,9 +33,25 @@ public class ResourceSecurityReportController {
 
     @ApiOperation(value = "人力数量分布")
     @RequestMapping(value = "/human_supplier_count/report", method = RequestMethod.POST)
-    @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = SupplierCountReportBean.class) })
+    @ApiResponses({ @ApiResponse(code = 200, message = "供应商供货数量分布报表", response = SupplierCountReportBean.class) })
     public Result humanSupplierCountReport(
             @ApiParam(value = "人力数量分布报表", required = true) @RequestParam Long serviceId) {
         return ResultUtil.ok(resourceSecurityReportService.humanSupplierCountReport(serviceId));
     }
+
+    @ApiOperation(value = "大区考勤异常数统计")
+    @RequestMapping(value = "/area_ding_exception_count/report", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "考勤异常报表", response = DingExceptionCountReportBean.class) })
+    public Result areaDingExceptionCountReport(
+            @ApiParam(value = "大区考勤异常数统计报表", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok(resourceSecurityReportService.areaDingExceptionCountReport(serviceId));
+    }
+
+    @ApiOperation(value = "人力供应商考勤异常数统计")
+    @RequestMapping(value = "/human_ding_exception_count/report", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "考勤异常报表", response = DingExceptionCountReportBean.class) })
+    public Result humanDingExceptionCountReport(
+            @ApiParam(value = "人力供应商考勤异常数统计报表", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok(resourceSecurityReportService.humanSupplierCountReport(serviceId));
+    }
 }

+ 50 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/report/DingExceptionCountReportBean.java

@@ -0,0 +1,50 @@
+package com.qmth.sop.business.bean.report;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 考勤异常报表bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class DingExceptionCountReportBean implements Serializable {
+
+    @ApiModelProperty(value = "大区经理名称")
+    String areaManagerName;
+
+    @ApiModelProperty(value = "人力商名称")
+    String humanSupplierName;
+
+    @ApiModelProperty(value = "数量")
+    Integer count;
+
+    public String getHumanSupplierName() {
+        return humanSupplierName;
+    }
+
+    public void setHumanSupplierName(String humanSupplierName) {
+        this.humanSupplierName = humanSupplierName;
+    }
+
+    public String getAreaManagerName() {
+        return areaManagerName;
+    }
+
+    public void setAreaManagerName(String areaManagerName) {
+        this.areaManagerName = areaManagerName;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 1 - 1
sop-business/src/main/java/com/qmth/sop/business/bean/report/SupplierCountReportBean.java

@@ -21,7 +21,7 @@ public class SupplierCountReportBean implements Serializable {
     @ApiModelProperty(value = "人力商名称")
     String humanSupplierName;
 
-    @ApiModelProperty(value = "设备商数量")
+    @ApiModelProperty(value = "数量")
     Integer count;
 
     public String getHumanSupplierName() {

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/mapper/ResourceSecurityReportMapper.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.sop.business.bean.report.DingExceptionCountReportBean;
 import com.qmth.sop.business.bean.report.SupplierCountReportBean;
 import com.qmth.sop.business.entity.TBService;
 import org.apache.ibatis.annotations.Param;
@@ -31,4 +32,12 @@ public interface ResourceSecurityReportMapper extends BaseMapper<TBService> {
      * @return
      */
     List<SupplierCountReportBean> humanSupplierCountReport(@Param("serviceId") Long serviceId);
+
+    /**
+     * 大区考勤异常数统计
+     *
+     * @param serviceId
+     * @return
+     */
+    List<DingExceptionCountReportBean> areaDingExceptionCountReport(@Param("serviceId") Long serviceId);
 }

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/ResourceSecurityReportService.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.report.DingExceptionCountReportBean;
 import com.qmth.sop.business.bean.report.SupplierCountReportBean;
 import com.qmth.sop.business.entity.TBService;
 
@@ -30,4 +31,12 @@ public interface ResourceSecurityReportService extends IService<TBService> {
      * @return
      */
     List<SupplierCountReportBean> humanSupplierCountReport(Long serviceId);
+
+    /**
+     * 大区考勤异常数统计
+     *
+     * @param serviceId
+     * @return
+     */
+    List<DingExceptionCountReportBean> areaDingExceptionCountReport(Long serviceId);
 }

+ 12 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/ResourceSecurityReportServiceImpl.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.bean.report.DingExceptionCountReportBean;
 import com.qmth.sop.business.bean.report.SupplierCountReportBean;
 import com.qmth.sop.business.entity.TBService;
 import com.qmth.sop.business.mapper.ResourceSecurityReportMapper;
@@ -41,4 +42,15 @@ public class ResourceSecurityReportServiceImpl extends ServiceImpl<ResourceSecur
     public List<SupplierCountReportBean> humanSupplierCountReport(Long serviceId) {
         return this.baseMapper.humanSupplierCountReport(serviceId);
     }
+
+    /**
+     * 大区考勤异常数统计
+     *
+     * @param serviceId
+     * @return
+     */
+    @Override
+    public List<DingExceptionCountReportBean> areaDingExceptionCountReport(Long serviceId) {
+        return this.baseMapper.areaDingExceptionCountReport(serviceId);
+    }
 }

+ 5 - 2
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -371,7 +371,7 @@ UPDATE sys_privilege
 SET name='项目进度分析', url='sopSchedule', `type`='MENU', parent_id=1100, `sequence`=2, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
 WHERE id=1104;
 UPDATE sys_privilege
-SET name='资源保障分析', url='deviceMonitor', `type`='MENU', parent_id=1100, `sequence`=5, property=NULL, related='1107,1108', enable=1, default_auth=0, front_display=1
+SET name='资源保障分析', url='deviceMonitor', `type`='MENU', parent_id=1100, `sequence`=5, property=NULL, related='1107,1108,1109', enable=1, default_auth=0, front_display=1
 WHERE id=1105;
 UPDATE sys_privilege
 SET name='质量监控分析', url='qualityAnalyse', `type`='MENU', parent_id=1100, `sequence`=6, property=NULL, related=NULL, enable=1, default_auth=0, front_display=1
@@ -382,4 +382,7 @@ INSERT INTO sys_privilege
 VALUES(1107, '设备商供货数量分布接口', '/api/admin/resource/security/device_supplier_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(1108, '人力数量分布接口', '/api/admin/resource/security/human_supplier_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
+VALUES(1108, '人力数量分布接口', '/api/admin/resource/security/human_supplier_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(1109, '大区考勤异常数统计接口', '/api/admin/resource/security/area_ding_exception_count/report', 'URL', 1105, 1, 'AUTH', NULL, 1, 1, 1);

+ 28 - 13
sop-business/src/main/resources/mapper/ResourceSecurityReportMapper.xml

@@ -4,10 +4,10 @@
 
     <select id="deviceSupplierCountReport" resultType="com.qmth.sop.business.bean.report.SupplierCountReportBean">
         select ss.name as deviceSupplierName,count(distinct tbdd.id) as count from t_b_service tbs
-        left join t_b_sop_info tbsi on tbsi.service_id = tbs.id
-        left join t_b_device_delivery tbdd on tbdd.crm_no = tbsi.crm_no
-        left join sys_device sd on sd.serial_no = tbdd.serial_no
-        left join sys_supplier ss on ss.id = sd.supplier_id
+        join t_b_sop_info tbsi on tbsi.service_id = tbs.id
+        join t_b_device_delivery tbdd on tbdd.crm_no = tbsi.crm_no
+        join sys_device sd on sd.serial_no = tbdd.serial_no
+        join sys_supplier ss on ss.id = sd.supplier_id
         where tbs.id = #{serviceId}
         and ss.`type` = 'DEVICE' and tbdd.status = 'USING'
         and tbs.status <![CDATA[ <> ]]> 'CANCEL'
@@ -17,19 +17,34 @@
 
     <select id="humanSupplierCountReport" resultType="com.qmth.sop.business.bean.report.SupplierCountReportBean">
         select ss.name as humanSupplierName,count(distinct tbuas.user_archives_id) as count from t_b_service tbs
-        left join t_b_sop_info tbsi on tbsi.service_id = tbs.id
-        left join t_b_crm_detail tbcd on tbcd.sop_no = tbsi.sop_no
-        left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbcd.sop_no
-        left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
-        left join t_b_user_archives_allocation tbuaa on tbuaa.crm_detail_id = tbcd.id
-        left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbuaa.archives_id
-        left join sys_supplier ss on ss.id = tbuas.supplier_id
+        join t_b_sop_info tbsi on tbsi.service_id = tbs.id
+        join t_b_crm_detail tbcd on tbcd.sop_no = tbsi.sop_no
+        join t_f_custom_flow_entity tfcfe on tfcfe.code = tbcd.sop_no
+        join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
+        join t_b_user_archives_allocation tbuaa on tbuaa.crm_detail_id = tbcd.id
+        join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbuaa.archives_id
+        join sys_supplier ss on ss.id = tbuas.supplier_id
         where tbs.id = #{serviceId}
-        and ss.`type` = 'HUMAN'
-        and tbcd.status = 'PUBLISH'
+        and ss.`type` = 'HUMAN' and tbcd.status = 'PUBLISH'
         and tbs.status <![CDATA[ <> ]]> 'CANCEL'
         and tffa.status <![CDATA[ <> ]]> 'END'
         group by ss.name
         order by ss.name
     </select>
+
+    <select id="areaDingExceptionCountReport" resultType="com.qmth.sop.business.bean.report.DingExceptionCountReportBean">
+        select * from(select distinct su.real_name as areaManagerName,sum(case when tbd.sign_in_time is null or tbd.sign_out_time is null then 1 else 0 end) as count
+        from t_b_service tbs
+        join t_b_crm tbc on tbc.service_id = tbs.id
+        join t_b_sop_info tbsi on tbsi.crm_no = tbc.crm_no
+        join sys_user su on su.id = tbc.lead_id
+        join t_f_custom_flow_entity tfcfe on tfcfe.code = tbsi.sop_no
+        join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id
+        join t_b_ding tbd on tbd.ding_sop_no = tbsi.sop_no
+        where tbs.id = #{serviceId}
+        and tbs.status <![CDATA[ <> ]]> 'CANCEL'
+        and tffa.status <![CDATA[ <> ]]> 'END'
+        group by su.real_name) t where t.count > 0
+        order by t.areaManagerName
+    </select>
 </mapper>