wangliang 9 mesiacov pred
rodič
commit
24095d74e0

+ 31 - 0
sop-api/src/main/java/com/qmth/sop/server/api/ResourceSecurityReportController.java

@@ -0,0 +1,31 @@
+package com.qmth.sop.server.api;
+
+import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.bean.report.DeviceSupplierCountReportBean;
+import com.qmth.sop.business.service.ResourceSecurityReportService;
+import com.qmth.sop.common.contant.SystemConstant;
+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;
+
+@Api(tags = "资源保障报表Controller")
+@RestController
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_RESOURCE_SECURITY)
+public class ResourceSecurityReportController {
+
+    @Resource
+    ResourceSecurityReportService resourceSecurityReportService;
+
+    @ApiOperation(value = "设备商供货数量分布")
+    @RequestMapping(value = "/device_supplier_count/report", method = RequestMethod.POST)
+    @ApiResponses({ @ApiResponse(code = 200, message = "返回信息", response = DeviceSupplierCountReportBean.class) })
+    public Result deviceSupplierCountReport(@ApiParam(value = "服务单元id", required = true) @RequestParam Long serviceId) {
+        return ResultUtil.ok(resourceSecurityReportService.deviceSupplierCountReport(serviceId));
+    }
+}

+ 37 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/report/DeviceSupplierCountReportBean.java

@@ -0,0 +1,37 @@
+package com.qmth.sop.business.bean.report;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 设备商供货数量分布报表bean
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+public class DeviceSupplierCountReportBean implements Serializable {
+
+    @ApiModelProperty(value = "设备商名称")
+    String deviceSupplierName;
+
+    @ApiModelProperty(value = "设备商数量")
+    Integer count;
+
+    public String getDeviceSupplierName() {
+        return deviceSupplierName;
+    }
+
+    public void setDeviceSupplierName(String deviceSupplierName) {
+        this.deviceSupplierName = deviceSupplierName;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

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

@@ -0,0 +1,25 @@
+package com.qmth.sop.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.qmth.sop.business.bean.report.DeviceSupplierCountReportBean;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @Description: 设备商供货数量分布报表mapper
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+public interface ResourceSecurityReportMapper extends BaseMapper<Object> {
+
+    /**
+     * 设备商供货数量分布
+     *
+     * @param serviceId
+     * @return
+     */
+    List<DeviceSupplierCountReportBean> deviceSupplierCountReport(@Param("serviceId") Long serviceId);
+}

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

@@ -0,0 +1,24 @@
+package com.qmth.sop.business.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.report.DeviceSupplierCountReportBean;
+
+import java.util.List;
+
+/**
+ * @Description: 设备商供货数量分布报表service
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+public interface ResourceSecurityReportService extends IService<Object> {
+
+    /**
+     * 设备商供货数量分布
+     *
+     * @param serviceId
+     * @return
+     */
+    List<DeviceSupplierCountReportBean> deviceSupplierCountReport(Long serviceId);
+}

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

@@ -0,0 +1,32 @@
+package com.qmth.sop.business.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.bean.report.DeviceSupplierCountReportBean;
+import com.qmth.sop.business.mapper.ResourceSecurityReportMapper;
+import com.qmth.sop.business.service.ResourceSecurityReportService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @Description: 设备商供货数量分布报表service impl
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2024/9/18
+ */
+@Service
+public class ResourceSecurityReportServiceImpl extends ServiceImpl<ResourceSecurityReportMapper, Object>
+        implements ResourceSecurityReportService {
+
+    /**
+     * 设备商供货数量分布
+     *
+     * @param serviceId
+     * @return
+     */
+    @Override
+    public List<DeviceSupplierCountReportBean> deviceSupplierCountReport(Long serviceId) {
+        return this.baseMapper.deviceSupplierCountReport(serviceId);
+    }
+}

+ 17 - 0
sop-business/src/main/resources/mapper/ResourceSecurityReportMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.qmth.sop.business.mapper.ResourceSecurityReportMapper">
+
+    <select id="deviceSupplierCountReport" resultType="com.qmth.sop.business.bean.report.DeviceSupplierCountReportBean">
+        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
+        where tbs.id = #{serviceId}
+        and ss.`type` = 'DEVICE' and tbdd.status = 'USING'
+        and tbs.status <![CDATA[ <> ]]> 'CANCEL'
+        group by ss.name
+        order by ss.name
+    </select>
+</mapper>

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

@@ -445,6 +445,8 @@ public class SystemConstant {
 
     public static final String PREFIX_URL_CRM_PROCESS_MONITOR = "/admin/crm/process/monitor";
 
+    public static final String PREFIX_URL_RESOURCE_SECURITY = "/admin/resource/security";
+
     /**
      * 缓存配置
      */