Browse Source

月度工分汇总-个人场站维保维修统计

wanglt 3 tháng trước cách đây
mục cha
commit
b24eae7c81

+ 9 - 2
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtUserScoreController.java

@@ -12,6 +12,7 @@ import com.ygtx.common.constant.HttpStatus;
 import com.ygtx.common.core.domain.entity.SysDept;
 import com.ygtx.common.core.page.PageDomain;
 import com.ygtx.common.core.page.TableSupport;
+import com.ygtx.common.utils.SecurityUtils;
 import com.ygtx.gxt.domain.*;
 import com.ygtx.gxt.domain.GxtUserScoreSubmissionDTO;
 import com.ygtx.gxt.service.*;
@@ -163,7 +164,10 @@ public class GxtUserScoreController extends BaseController
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
-        List<GxtWorkOrder> list = gxtMonthScoreService.getWorkOrderByMonth(workOrder.getModel(),workOrder.getInspectionType(),workOrder.getPcsStationPid(),workOrder.getMonthPeriod());
+        if (workOrder.getUserId()!=null) {
+            workOrder.setUserId(SecurityUtils.getUserId());
+        }
+        List<GxtWorkOrder> list = gxtMonthScoreService.getWorkOrderByMonth(workOrder.getUserId(), workOrder.getModel(),workOrder.getInspectionType(),workOrder.getPcsStationPid(),workOrder.getMonthPeriod());
         List<GxtWorkOrder> result = new ArrayList<>();
         int total = list.size();
         if (pageNum!=null&&pageSize!=null) {
@@ -190,7 +194,10 @@ public class GxtUserScoreController extends BaseController
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
-        List<GxtRepairOrder> list = gxtMonthScoreService.getRepairOrderByMonth(repairOrder.getMaintenanceType(),repairOrder.getPcsStationPid(),repairOrder.getMonthPeriod());
+        if (repairOrder.getUserId()!=null) {
+            repairOrder.setUserId(SecurityUtils.getUserId());
+        }
+        List<GxtRepairOrder> list = gxtMonthScoreService.getRepairOrderByMonth(repairOrder.getUserId(), repairOrder.getMaintenanceType(),repairOrder.getPcsStationPid(),repairOrder.getMonthPeriod());
         List<GxtRepairOrder> result = new ArrayList<>();
         int total = list.size();
         if (pageNum!=null&&pageSize!=null) {

+ 10 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtMonthFanInspection.java

@@ -50,6 +50,8 @@ public class GxtMonthFanInspection extends BaseEntity
 
     private String inspectionTypeId;
 
+    private Long userId;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -165,4 +167,12 @@ public class GxtMonthFanInspection extends BaseEntity
     public void setInspectionTypeId(String inspectionTypeId) {
         this.inspectionTypeId = inspectionTypeId;
     }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
 }

+ 10 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtMonthRepairProject.java

@@ -40,6 +40,8 @@ public class GxtMonthRepairProject extends BaseEntity
     /** 统计月份 */
     private String monthPeriod;
 
+    private Long userId;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -121,4 +123,12 @@ public class GxtMonthRepairProject extends BaseEntity
     {
         return monthPeriod;
     }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
 }

+ 10 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtRepairOrder.java

@@ -294,6 +294,8 @@ public class GxtRepairOrder extends BaseEntity
 
     private String leader;
 
+    private Long userId;
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -1013,6 +1015,14 @@ public class GxtRepairOrder extends BaseEntity
         this.leader = leader;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 10 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtWorkOrder.java

@@ -304,6 +304,8 @@ public class GxtWorkOrder extends BaseEntity
 
     private String deptName;
 
+    private Long userId;
+
     public void setId(Long id)
     {
         this.id = id;
@@ -1005,6 +1007,14 @@ public class GxtWorkOrder extends BaseEntity
         this.deptName = deptName;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 2 - 2
ygtx-gxt/src/main/java/com/ygtx/gxt/service/IGxtMonthScoreService.java

@@ -23,9 +23,9 @@ public interface IGxtMonthScoreService
 
     public GxtMonthScore getGxtMonthScoreByParams(Integer rtType,String monthPeriod,Long deptId);
 
-    public List<GxtWorkOrder> getWorkOrderByMonth(String model, String inspectionTypeId, Long pid, String monthPeriod);
+    public List<GxtWorkOrder> getWorkOrderByMonth(Long userId, String model, String inspectionTypeId, Long pid, String monthPeriod);
 
-    public List<GxtRepairOrder> getRepairOrderByMonth(String maintenanceType, Long pid, String monthPeriod);
+    public List<GxtRepairOrder> getRepairOrderByMonth(Long userId, String maintenanceType, Long pid, String monthPeriod);
 
     public GxtMonthScore getGxtMonthScoreByParams(Integer rtType,Long id);
 

+ 15 - 4
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtMonthScoreServiceImpl.java

@@ -107,13 +107,14 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
     }
 
     @Override
-    public List<GxtWorkOrder> getWorkOrderByMonth(String model, String inspectionTypeId, Long pid, String monthPeriod) {
+    public List<GxtWorkOrder> getWorkOrderByMonth(Long userId, String model, String inspectionTypeId, Long pid, String monthPeriod) {
         GxtWorkOrder workOrder = new GxtWorkOrder();
         workOrder.setModel(model);
         workOrder.setInspectionType(inspectionTypeId);
         workOrder.setPcsStationPid(pid);
         workOrder.setMonthPeriod(monthPeriod);
         workOrder.setWorkOrderStatus("archived");
+        workOrder.setUserId(userId);
         addBusinessDataScopeFilter(workOrder);
         List<GxtWorkOrder> list = gxtWorkOrderMapper.selectGxtWorkOrderListByMonth(workOrder);
         if (!list.isEmpty()) {
@@ -493,12 +494,13 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
     }
 
     @Override
-    public List<GxtRepairOrder> getRepairOrderByMonth(String maintenanceType, Long pid, String monthPeriod) {
+    public List<GxtRepairOrder> getRepairOrderByMonth(Long userId, String maintenanceType, Long pid, String monthPeriod) {
         GxtRepairOrder repairOrder = new GxtRepairOrder();
         repairOrder.setMaintenanceType(maintenanceType);
         repairOrder.setPcsStationPid(pid);
         repairOrder.setMonthPeriod(monthPeriod);
         repairOrder.setWorkOrderStatus("archived");
+        repairOrder.setUserId(userId);
         addBusinessDataScopeFilter(repairOrder);
         return gxtRepairOrderMapper.selectGxtRepairOrderListByMonth(repairOrder);
     }
@@ -632,6 +634,12 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
         GxtMonthFanInspection monthFanInspection = new GxtMonthFanInspection();
         monthFanInspection.setDeptId(deptId);
         monthFanInspection.setMonthPeriod(monthPeriod);
+
+        Long userOnly = null;
+        if (rtType==0) {
+            userOnly = userId;
+            monthFanInspection.setUserId(userId);
+        }
         List<GxtMonthFanInspection> monthFanInspections = gxtMonthFanInspectionMapper.selectGxtMonthFanInspectionListByTwice(monthFanInspection);
         List<GxtMonthFanInspection> fanInspectionList = new ArrayList<>();
         if (!monthFanInspections.isEmpty()) {
@@ -678,7 +686,7 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
         List<GxtWorkOrder> workOrderList = new ArrayList<>();
         if (!monthFanInspections.isEmpty()) {
             GxtMonthFanInspection fanInspection = monthFanInspections.get(0);
-            workOrderList = getWorkOrderByMonth(fanInspection.getModel(),fanInspection.getInspectionTypeId(),deptId,monthPeriod);
+            workOrderList = getWorkOrderByMonth(userOnly, fanInspection.getModel(),fanInspection.getInspectionTypeId(),deptId,monthPeriod);
         }
         monthScore.setWorkOrderList(workOrderList);
 
@@ -686,6 +694,9 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
         GxtMonthRepairProject monthRepairProject = new GxtMonthRepairProject();
         monthRepairProject.setDeptId(deptId);
         monthRepairProject.setMonthPeriod(monthPeriod);
+        if (rtType==0) {
+            monthRepairProject.setUserId(userId);
+        }
         List<GxtMonthRepairProject> monthRepairProjects = gxtMonthRepairProjectMapper.selectGxtMonthRepairProjectListByTwice(monthRepairProject);
         monthScore.setMonthRepairProjects(monthRepairProjects);
 
@@ -693,7 +704,7 @@ public class GxtMonthScoreServiceImpl implements IGxtMonthScoreService
         List<GxtRepairOrder> repairOrderList = new ArrayList<>();
         if (!monthRepairProjects.isEmpty()) {
             GxtMonthRepairProject repairProject = monthRepairProjects.get(0);
-            repairOrderList = getRepairOrderByMonth(repairProject.getMaintenanceType(), deptId, monthPeriod);
+            repairOrderList = getRepairOrderByMonth(userOnly, repairProject.getMaintenanceType(), deptId, monthPeriod);
         }
         monthScore.setRepairOrderList(repairOrderList);
 

+ 13 - 10
ygtx-gxt/src/main/resources/mapper/gxt/GxtMonthFanInspectionMapper.xml

@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
         <result property="inspectionTypeId" column="inspection_type_id"/>
+        <result property="userId" column="user_id"/>
     </resultMap>
 
     <sql id="selectGxtMonthFanInspectionVo">
@@ -53,22 +54,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectGxtMonthFanInspectionListByTwice" parameterType="GxtMonthFanInspection" resultMap="GxtMonthFanInspectionResult">
         SELECT
-        model,
-        inspection_type AS inspection_type_id,
+        t.model,
+        t.inspection_type AS inspection_type_id,
         count(*) AS device_count
         FROM
-        gxt_work_order
+        gxt_work_order t
+        <if test="userId != null"> LEFT JOIN gxt_work_order_person wop ON t.id=wop.order_id</if>
         <where>
-            <if test="deptId != null "> and pcs_station_pid = #{deptId}</if>
-            <if test="monthPeriod != null  and monthPeriod != ''"> and DATE_FORMAT( create_time, '%Y-%m' ) = #{monthPeriod}</if>
-            AND inspection_type IS NOT NULL AND work_order_status = 'archived'
+            <if test="userId != null"> and wop.user_id = #{userId}</if>
+            <if test="deptId != null "> and t.pcs_station_pid = #{deptId}</if>
+            <if test="monthPeriod != null  and monthPeriod != ''"> and DATE_FORMAT( t.create_time, '%Y-%m' ) = #{monthPeriod}</if>
+            AND t.inspection_type IS NOT NULL AND t.work_order_status = 'archived'
         </where>
         GROUP BY
-        model,
-        inspection_type
+        t.model,
+        t.inspection_type
         ORDER BY
-        model,
-        inspection_type
+        t.model,
+        t.inspection_type
     </select>
 
     <select id="selectGxtMonthFanInspectionListByAdd" parameterType="GxtMonthFanInspection" resultMap="GxtMonthFanInspectionResult">

+ 10 - 7
ygtx-gxt/src/main/resources/mapper/gxt/GxtMonthRepairProjectMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="projectScore" column="project_score"/>
         <result property="calculatedScore" column="calculated_score"/>
         <result property="monthPeriod" column="month_period"/>
+        <result property="userId" column="user_id"/>
     </resultMap>
 
     <sql id="selectGxtMonthRepairProjectVo">
@@ -36,19 +37,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectGxtMonthRepairProjectListByTwice" parameterType="GxtMonthRepairProject" resultMap="GxtMonthRepairProjectResult">
         SELECT
-        maintenance_type,
+        t.maintenance_type,
         count(*) AS order_count
         FROM
-        gxt_repair_order
+        gxt_repair_order t
+        <if test="userId != null"> LEFT JOIN gxt_repair_order_person rop ON rop.order_id=t.id</if>
         <where>
-            <if test="deptId != null "> and pcs_station_pid = #{deptId}</if>
-            <if test="monthPeriod != null  and monthPeriod != ''"> and DATE_FORMAT( occur_time, '%Y-%m' ) = #{monthPeriod}</if>
-            AND maintenance_type IS NOT NULL AND work_order_status = 'archived'
+            <if test="userId != null"> and rop.user_id=#{userId}</if>
+            <if test="deptId != null "> and t.pcs_station_pid = #{deptId}</if>
+            <if test="monthPeriod != null  and monthPeriod != ''"> and DATE_FORMAT( t.occur_time, '%Y-%m' ) = #{monthPeriod}</if>
+            AND t.maintenance_type IS NOT NULL AND t.work_order_status = 'archived'
         </where>
         GROUP BY
-        maintenance_type
+        t.maintenance_type
         ORDER BY
-        maintenance_type
+        t.maintenance_type
     </select>
 
     <select id="selectGxtMonthRepairProjectListByAdd" parameterType="GxtMonthRepairProject" resultMap="GxtMonthRepairProjectResult">

+ 4 - 13
ygtx-gxt/src/main/resources/mapper/gxt/GxtRepairOrderMapper.xml

@@ -86,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="acceptReturnReason"    column="accept_return_reason"    />
         <result property="scoreReturnReason"    column="score_return_reason"    />
         <result property="leader"    column="leader"    />
+        <result property="userId"    column="user_id" />
     </resultMap>
 
     <resultMap type="GxtRepairOrder" id="GxtRepairOrderWithPersonResult" extends="GxtRepairOrderResult">
@@ -233,22 +234,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectGxtRepairOrderListByMonth" parameterType="GxtRepairOrder" resultMap="GxtRepairOrderResult">
         SELECT
-        t.*,
-        p.nick_names AS leader
+        t.*
         FROM
         gxt_repair_order t
-        LEFT JOIN (
-        SELECT
-        order_id,
-        GROUP_CONCAT(nick_name) AS nick_names
-        FROM
-        gxt_repair_order_person
-        WHERE
-        is_leader = 1
-        GROUP BY
-        order_id
-        ) p ON p.order_id = t.id
+        <if test="userId != null">LEFT JOIN gxt_repair_order_person p ON p.order_id = t.id</if>
         <where>
+            <if test="userId != null"> and p.user_id=#{userId}</if>
             <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
             <if test="pcsStationPid != null "> and pcs_station_pid = #{pcsStationPid}</if>
             <if test="maintenanceType != null and maintenanceType != ''"> and maintenance_type = #{maintenanceType}</if>

+ 4 - 13
ygtx-gxt/src/main/resources/mapper/gxt/GxtWorkOrderMapper.xml

@@ -86,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="runningDays"    column="running_days" />
         <result property="stopDays"    column="stop_days" />
         <result property="deptName"    column="dept_name" />
+        <result property="userId"    column="user_id" />
     </resultMap>
 
     <resultMap type="GxtOrderData" id="GxtOrderDataResult">
@@ -184,22 +185,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectGxtWorkOrderListByMonth" parameterType="GxtWorkOrder" resultMap="GxtWorkOrderResult">
         SELECT
-        t.*,
-        p.nick_names AS leader
+        t.*
         FROM
         gxt_work_order t
-        LEFT JOIN (
-        SELECT
-        order_id,
-        GROUP_CONCAT(nick_name) AS nick_names
-        FROM
-        gxt_work_order_person
-        WHERE
-        is_leader = 1
-        GROUP BY
-        order_id
-        ) p ON p.order_id = t.id
+        <if test="userId != null">LEFT JOIN gxt_work_order_person p ON p.order_id = t.id</if>
         <where>
+            <if test="userId != null"> and p.user_id=#{userId}</if>
             <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status = #{workOrderStatus}</if>
             <if test="model != null and model != ''"> and t.model = #{model}</if>
             <if test="inspectionType != null and inspectionType != ''"> and FIND_IN_SET(#{inspectionType}, inspection_type) > 0</if>

+ 10 - 2
ygtx-ui/src/views/gxt/monthScore/index.vue

@@ -271,7 +271,8 @@ export default {
         model: null,
         inspectionType: null,
         pcsStationPid: null,
-        monthPeriod: null
+        monthPeriod: null,
+        userId: null
       },
       wxtotal: 0,
       wxqueryParams: {
@@ -279,7 +280,8 @@ export default {
         pageSize: 5,
         maintenanceType: null,
         pcsStationPid: null,
-        monthPeriod: null
+        monthPeriod: null,
+        userId: null
       }
     }
   },
@@ -609,6 +611,9 @@ export default {
       this.wbqueryParams.inspectionType = this.getInspectionTypeValue(row.inspectionType);
       this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
       this.wbqueryParams.monthPeriod = this.selectedMonth;
+      if (!this.isInfo) {
+        this.wbqueryParams.userId = 1;
+      }
       
       // 调用后端接口
       this.queryWbList();
@@ -629,6 +634,9 @@ export default {
       this.wxqueryParams.maintenanceType = this.getMaintenanceTypeValue(row.repairType);
       this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
       this.wxqueryParams.monthPeriod = this.selectedMonth;
+      if (!this.isInfo) {
+        this.wxqueryParams.userId = 1;
+      }
       
       // 调用后端接口
       this.queryWxList();

+ 6 - 0
ygtx-ui/src/views/gxt/monthScore/info.vue

@@ -465,6 +465,9 @@ export default {
       this.wbqueryParams.inspectionType = this.getInspectionTypeValue(row.inspectionType);
       this.wbqueryParams.pcsStationPid = this.monthScore.deptId;
       this.wbqueryParams.monthPeriod = this.selectedMonth;
+      if (!this.isInfo) {
+        this.wbqueryParams.userId = 1;
+      }
       
       // 调用后端接口
       this.queryWbList();
@@ -510,6 +513,9 @@ export default {
       this.wxqueryParams.maintenanceType = this.getMaintenanceTypeValue(row.repairType);
       this.wxqueryParams.pcsStationPid = this.monthScore.deptId;
       this.wxqueryParams.monthPeriod = this.selectedMonth;
+      if (!this.isInfo) {
+        this.wxqueryParams.userId = 1;
+      }
       
       // 调用后端接口
       this.queryWxList();