فهرست منبع

【CHG】修改接口参数

zhaomn 2 سال پیش
والد
کامیت
5faf384349

+ 10 - 7
railway-business/src/main/java/com/railway/business/bi/controller/ShowSbxjController.java

@@ -1,17 +1,21 @@
 package com.railway.business.bi.controller;
 
-import com.railway.business.bi.domain.ShowSbxj;
+import com.railway.business.bi.domain.vo.SbxjVO;
 import com.railway.business.bi.service.IShowSbxjService;
 import com.railway.common.core.controller.BaseController;
-import com.railway.common.core.page.TableDataInfo;
+import com.railway.common.core.domain.AjaxResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import java.util.List;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+/**
+ * @author zhaomn
+ */
 @Api(value = "rest/bi", tags = "大屏展示-电力设备巡检兑现表")
 @RestController
 @Validated
@@ -25,11 +29,10 @@ public class ShowSbxjController extends BaseController {
   }
 
   @ApiOperation(value = "列表")
-  @GetMapping(value = "/list")
-  public TableDataInfo getList(ShowSbxj showSbxj) {
-    startPage();
-    List<ShowSbxj> list = showSbxjService.getList(showSbxj);
-    return getDataTable(list);
+  @GetMapping(value = {"/total/{month}"})
+  public AjaxResult getTotal(@PathVariable int month) {
+    List<SbxjVO> list = showSbxjService.getTotal(month);
+    return AjaxResult.success(list);
   }
 
 }

+ 41 - 0
railway-business/src/main/java/com/railway/business/bi/domain/vo/SbxjVO.java

@@ -0,0 +1,41 @@
+package com.railway.business.bi.domain.vo;
+
+import com.railway.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.hibernate.validator.constraints.Length;
+
+/**
+ * 大屏展示-电力设备巡检兑现表
+ *
+ * @author ZhaoMn 2023-01-30
+ */
+@Data
+@ApiModel("大屏展示-电力设备巡检兑现表")
+public class SbxjVO implements Serializable {
+
+  @ApiModelProperty(value = "车间")
+  private String deptName;
+
+  @ApiModelProperty(value = "班组")
+  private String teamName;
+
+  @ApiModelProperty(value = "设备名称")
+  private String sbmc;
+
+  @ApiModelProperty(value = "总数")
+  private String total;
+
+  @ApiModelProperty(value = "计划")
+  private String plan;
+
+  @ApiModelProperty(value = "实际")
+  private String actual;
+
+  @ApiModelProperty(value = "兑现")
+  private String dx;
+
+}

+ 9 - 0
railway-business/src/main/java/com/railway/business/bi/mapper/ShowSbxjMapper.java

@@ -2,6 +2,8 @@ package com.railway.business.bi.mapper;
 
 import com.github.pagehelper.Page;
 import com.railway.business.bi.domain.ShowSbxj;
+import com.railway.business.bi.domain.vo.SbxjVO;
+import java.util.List;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -40,4 +42,11 @@ public interface ShowSbxjMapper {
     */
     Page<ShowSbxj> getList(ShowSbxj showSbxj);
 
+    /**
+     * 查询某月的计划和兑现情况
+     * @param month 月份 1-12
+     * @return 查询结果
+     */
+    List<SbxjVO> getTotal(int month);
+
 }

+ 8 - 0
railway-business/src/main/java/com/railway/business/bi/service/IShowSbxjService.java

@@ -1,6 +1,7 @@
 package com.railway.business.bi.service;
 
 import com.railway.business.bi.domain.ShowSbxj;
+import com.railway.business.bi.domain.vo.SbxjVO;
 import java.util.List;
 /**
 * 大屏展示-电力设备巡检兑现表
@@ -34,4 +35,11 @@ public interface IShowSbxjService{
     */
     List<ShowSbxj> getList(ShowSbxj showSbxj);
 
+    /**
+     * 查询某月的计划和兑现情况
+     * @param month 月份 1-12
+     * @return 查询结果
+     */
+    List<SbxjVO> getTotal(int month);
+
 }

+ 12 - 0
railway-business/src/main/java/com/railway/business/bi/service/impl/ShowSbxjServiceImpl.java

@@ -1,6 +1,7 @@
 package com.railway.business.bi.service.impl;
 
 import com.railway.business.bi.domain.ShowSbxj;
+import com.railway.business.bi.domain.vo.SbxjVO;
 import com.railway.business.bi.mapper.ShowSbxjMapper;
 import com.railway.business.bi.service.IShowSbxjService;
 import com.railway.common.utils.SecurityUtils;
@@ -71,4 +72,15 @@ public class ShowSbxjServiceImpl implements IShowSbxjService {
   public List<ShowSbxj> getList(ShowSbxj showSbxj) {
     return showSbxjMapper.getList(showSbxj);
   }
+
+  /**
+   * 查询某月的计划和兑现情况
+   *
+   * @param month 月份 1-12
+   * @return 查询结果
+   */
+  @Override
+  public List<SbxjVO> getTotal(int month) {
+    return showSbxjMapper.getTotal(month);
+  }
 }

+ 166 - 1
railway-business/src/main/resources/mapper/bi/ShowSbxjMapper.xml

@@ -41,7 +41,8 @@
   </resultMap>
 
   <sql id="Base_Column_List">
-    id,
+    id
+    ,
     dept_name,
     team_name,
     xjdy,
@@ -449,4 +450,168 @@
     </where>
   </select>
 
+  <resultMap id="TotalResultMap" type="com.railway.business.bi.domain.vo.SbxjVO">
+    <result column="dept_name" property="deptName"/>
+    <result column="team_name" property="teamName"/>
+    <result column="sbmc" property="sbmc"/>
+    <result column="total" property="total"/>
+    <result column="planTotal" property="plan"/>
+    <result column="actualTotal" property="actual"/>
+    <result column="dx" property="dx"/>
+  </resultMap>
+
+  <select id="getTotal" resultMap="TotalResultMap">
+
+    select dept_name,
+    team_name,
+    '单元' as sbmc,
+    count(*) as total,
+    sum(plan) as planTotal,
+    sum(actual) as actualTotal,
+    round(sum(actual) * 100 / sum(plan)) as dx
+    from (select dept_name,
+    team_name,
+    case when plan is not null then 1 else 0 end as plan,
+    case when actual is not null then 1 else 0 end as actual
+    from (select dept_name, team_name,
+    <if test="month==1">plan1 as plan, actual1 as actual</if>
+    <if test="month==2">plan2 as plan, actual2 as actual</if>
+    <if test="month==3">plan3 as plan, actual3 as actual</if>
+    <if test="month==4">plan4 as plan, actual4 as actual</if>
+    <if test="month==5">plan5 as plan, actual5 as actual</if>
+    <if test="month==6">plan6 as plan, actual6 as actual</if>
+    <if test="month==7">plan7 as plan, actual7 as actual</if>
+    <if test="month==8">plan8 as plan, actual8 as actual</if>
+    <if test="month==9">plan9 as plan, actual9 as actual</if>
+    <if test="month==10">plan10 as plan, actual10 as actual</if>
+    <if test="month==11">plan11 as plan, actual11 as actual</if>
+    <if test="month==12">plan12 as plan, actual12 as actual</if>
+    from show_sbxj) a) b
+    group by dept_name, team_name
+
+    union
+
+    select dept_name,
+    team_name,
+    '箱变' as sbmc,
+    sum(xb) as total,
+    sum(plan) as planTotal,
+    sum(actual) as actualTotal,
+    round(sum(actual) * 100 / sum(plan)) as dx
+    from (select dept_name,
+    team_name,
+    xb,
+    case when plan is not null then 1 else 0 end as plan,
+    case when actual is not null then 1 else 0 end as actual
+    from (select dept_name, team_name, xb,
+    <if test="month==1">plan1 as plan, actual1 as actual</if>
+    <if test="month==2">plan2 as plan, actual2 as actual</if>
+    <if test="month==3">plan3 as plan, actual3 as actual</if>
+    <if test="month==4">plan4 as plan, actual4 as actual</if>
+    <if test="month==5">plan5 as plan, actual5 as actual</if>
+    <if test="month==6">plan6 as plan, actual6 as actual</if>
+    <if test="month==7">plan7 as plan, actual7 as actual</if>
+    <if test="month==8">plan8 as plan, actual8 as actual</if>
+    <if test="month==9">plan9 as plan, actual9 as actual</if>
+    <if test="month==10">plan10 as plan, actual10 as actual</if>
+    <if test="month==11">plan11 as plan, actual11 as actual</if>
+    <if test="month==12">plan12 as plan, actual12 as actual</if>
+    from show_sbxj
+    where xb is not null) a) b
+    group by dept_name, team_name
+
+    union
+
+    select dept_name,
+    team_name,
+    '10/0.4变电所' as sbmc,
+    sum(bds) as total,
+    sum(plan) as planTotal,
+    sum(actual) as actualTotal,
+    round(sum(actual) * 100 / sum(plan)) as dx
+    from (select dept_name,
+    team_name,
+    bds,
+    case when plan is not null then 1 else 0 end as plan,
+    case when actual is not null then 1 else 0 end as actual
+    from (select dept_name, team_name, bds,
+    <if test="month==1">plan1 as plan, actual1 as actual</if>
+    <if test="month==2">plan2 as plan, actual2 as actual</if>
+    <if test="month==3">plan3 as plan, actual3 as actual</if>
+    <if test="month==4">plan4 as plan, actual4 as actual</if>
+    <if test="month==5">plan5 as plan, actual5 as actual</if>
+    <if test="month==6">plan6 as plan, actual6 as actual</if>
+    <if test="month==7">plan7 as plan, actual7 as actual</if>
+    <if test="month==8">plan8 as plan, actual8 as actual</if>
+    <if test="month==9">plan9 as plan, actual9 as actual</if>
+    <if test="month==10">plan10 as plan, actual10 as actual</if>
+    <if test="month==11">plan11 as plan, actual11 as actual</if>
+    <if test="month==12">plan12 as plan, actual12 as actual</if>
+    from show_sbxj
+    where bds is not null) a) b
+    group by dept_name, team_name
+
+    union
+
+    select dept_name,
+    team_name,
+    '配电所' as sbmc,
+    sum(pds) as total,
+    sum(plan) as planTotal,
+    sum(actual) as actualTotal,
+    round(sum(actual) * 100 / sum(plan)) as dx
+    from (select dept_name,
+    team_name,
+    pds,
+    case when plan is not null then 1 else 0 end as plan,
+    case when actual is not null then 1 else 0 end as actual
+    from (select dept_name, team_name, pds,
+    <if test="month==1">plan1 as plan, actual1 as actual</if>
+    <if test="month==2">plan2 as plan, actual2 as actual</if>
+    <if test="month==3">plan3 as plan, actual3 as actual</if>
+    <if test="month==4">plan4 as plan, actual4 as actual</if>
+    <if test="month==5">plan5 as plan, actual5 as actual</if>
+    <if test="month==6">plan6 as plan, actual6 as actual</if>
+    <if test="month==7">plan7 as plan, actual7 as actual</if>
+    <if test="month==8">plan8 as plan, actual8 as actual</if>
+    <if test="month==9">plan9 as plan, actual9 as actual</if>
+    <if test="month==10">plan10 as plan, actual10 as actual</if>
+    <if test="month==11">plan11 as plan, actual11 as actual</if>
+    <if test="month==12">plan12 as plan, actual12 as actual</if>
+    from show_sbxj
+    where pds is not null) a) b
+    group by dept_name, team_name
+
+    union
+
+    select dept_name,
+    team_name,
+    '受电线路' as sbmc,
+    sum(sdxl) as total,
+    sum(plan) as planTotal,
+    sum(actual) as actualTotal,
+    round(sum(actual) * 100 / sum(plan)) as dx
+    from (select dept_name,
+    team_name,
+    sdxl,
+    case when plan is not null then 1 else 0 end as plan,
+    case when actual is not null then 1 else 0 end as actual
+    from (select dept_name, team_name, sdxl,
+    <if test="month==1">plan1 as plan, actual1 as actual</if>
+    <if test="month==2">plan2 as plan, actual2 as actual</if>
+    <if test="month==3">plan3 as plan, actual3 as actual</if>
+    <if test="month==4">plan4 as plan, actual4 as actual</if>
+    <if test="month==5">plan5 as plan, actual5 as actual</if>
+    <if test="month==6">plan6 as plan, actual6 as actual</if>
+    <if test="month==7">plan7 as plan, actual7 as actual</if>
+    <if test="month==8">plan8 as plan, actual8 as actual</if>
+    <if test="month==9">plan9 as plan, actual9 as actual</if>
+    <if test="month==10">plan10 as plan, actual10 as actual</if>
+    <if test="month==11">plan11 as plan, actual11 as actual</if>
+    <if test="month==12">plan12 as plan, actual12 as actual</if>
+    from show_sbxj
+    where sdxl is not null) a) b
+    group by dept_name, team_name
+  </select>
+
 </mapper>