java110 пре 5 година
родитељ
комит
fedae06057

+ 8 - 0
java110-bean/src/main/java/com/java110/dto/repair/RepairDto.java

@@ -51,6 +51,7 @@ public class RepairDto extends PageDto implements Serializable {
     private String roomId;
     private String[] roomIds;
     private String repairTypeName;
+    private String repairWay;
 
     private String staffId;
 
@@ -209,4 +210,11 @@ public class RepairDto extends PageDto implements Serializable {
         this.roomIds = roomIds;
     }
 
+    public String getRepairWay() {
+        return repairWay;
+    }
+
+    public void setRepairWay(String repairWay) {
+        this.repairWay = repairWay;
+    }
 }

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/repair/RepairUserDto.java

@@ -33,6 +33,7 @@ public class RepairUserDto extends PageDto implements Serializable {
     private String[] repairIds;
     private String ruId;
     private String state;
+    private String stateName;
     private String communityId;
     private String userId;
     private String userName;
@@ -44,6 +45,7 @@ public class RepairUserDto extends PageDto implements Serializable {
     private Date startTime;
     private Date endTime;
     private String repairEvent;
+    private String duration;
 
 
     private Date createTime;
@@ -187,4 +189,20 @@ public class RepairUserDto extends PageDto implements Serializable {
     public void setRepairEvent(String repairEvent) {
         this.repairEvent = repairEvent;
     }
+
+    public String getStateName() {
+        return stateName;
+    }
+
+    public void setStateName(String stateName) {
+        this.stateName = stateName;
+    }
+
+    public String getDuration() {
+        return duration;
+    }
+
+    public void setDuration(String duration) {
+        this.duration = duration;
+    }
 }

+ 4 - 16
java110-db/src/main/resources/mapper/community/RepairServiceDaoImplMapper.xml

@@ -106,26 +106,14 @@
         appointmentTime,t.repair_type,t.repair_type repairType,t.context,t.repair_id,t.repair_id
         repairId,t.tel,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id
         bId,t.room_id,t.room_id roomId,
-        (CASE
-        WHEN t.`state` = '1000'
-        THEN '未派单'
-        WHEN t.state = '1100'
-        THEN '处理中'
-        ELSE
-        '处理完成'
-        END) stateName,
-        (CASE
-        WHEN t.`repair_type` = '10001'
-        THEN '卧室报修'
-        WHEN t.repair_type = '10002'
-        THEN '管道报修'
-        ELSE
-        '客厅报修'
-        END) repairTypeName
+        d.name stateName,
+        rs.repair_type_name repairTypeName,rs.repair_way repairWay
         <if test="staffId != null and staffId != ''">
             ,rru.state repairDispatchState,rru.context repairDispatchContext,td.name repairDispatchStateName
         </if>
         from r_repair_pool t
+        left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_pool' and d.table_columns = 'state'
+        left join r_repair_setting rs on rs.repair_type = t.repair_type and rs.status_cd = '0'
         <if test="staffId != null and staffId != ''">
             ,r_repair_user rru
             ,t_dict td

+ 2 - 3
java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml

@@ -55,9 +55,9 @@
     <insert id="saveRepairUserInfoInstance" parameterType="Map">
         insert into r_repair_user(
         context,repair_id,status_cd,ru_id,state,community_id,b_id,staff_id,staff_name,pre_staff_id,
-        pre_staff_name,repair_event,start_time,end_time,repair_event
+        pre_staff_name,repair_event,start_time,end_time
         ) select t.context,t.repair_id,'0',t.ru_id,t.state,t.community_id,t.b_id,t.staff_id,t.staff_name,
-        t.pre_staff_id,t.pre_staff_name,t.repair_event,t.start_time,t.end_time,t.repair_event
+        t.pre_staff_id,t.pre_staff_name,t.repair_event,t.start_time,t.end_time
         from business_repair_user t
         where 1=1
         and t.operate= 'ADD'
@@ -180,7 +180,6 @@
     <select id="queryRepairUsersCount" parameterType="Map" resultType="Map">
         select count(1) count
         from r_repair_user t
-        where 1 =1
         left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_user' and d.table_columns = 'state'
         where 1 =1
         <if test="context !=null and context != ''">

+ 6 - 0
java110-utils/src/main/java/com/java110/utils/constant/ServiceCodeOwnerRepairConstant.java

@@ -28,4 +28,10 @@ public class ServiceCodeOwnerRepairConstant {
     public static final String LIST_OWNERREPAIRS = "ownerRepair.listOwnerRepairs";
 
 
+    /**
+     * 查询 报修处理员工
+     */
+    public static final String LIST_REPAIR_STAFFS = "ownerRepair.listRepairStaffs";
+
+
 }

+ 1 - 1
service-api/src/main/java/com/java110/api/listener/ownerRepair/ListOwnerRepairsListener.java

@@ -87,7 +87,7 @@ public class ListOwnerRepairsListener extends AbstractServiceApiListener {
             ownerRepairs = new ArrayList<>();
         }
 
-        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity(count, (int) Math.ceil((double) count / (double) reqJson.getInteger("row")), ownerRepairs);
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, ownerRepairs);
 
 
         context.setResponseEntity(responseEntity);

+ 116 - 0
service-api/src/main/java/com/java110/api/listener/ownerRepair/ListRepairStaffsListener.java

@@ -0,0 +1,116 @@
+package com.java110.api.listener.ownerRepair;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.listener.AbstractServiceApiListener;
+import com.java110.core.annotation.Java110Listener;
+import com.java110.core.context.DataFlowContext;
+import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.core.smo.community.IRepairInnerServiceSMO;
+import com.java110.core.smo.community.IRepairUserInnerServiceSMO;
+import com.java110.dto.repair.RepairUserDto;
+import com.java110.utils.constant.ServiceCodeOwnerRepairConstant;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 查询小区侦听类
+ */
+@Java110Listener("listRepairStaffsListener")
+public class ListRepairStaffsListener extends AbstractServiceApiListener {
+
+    @Autowired
+    private IRepairInnerServiceSMO repairInnerServiceSMOImpl;
+
+
+    @Autowired
+    private IRepairUserInnerServiceSMO repairUserInnerServiceSMOImpl;
+
+    @Override
+    public String getServiceCode() {
+        return ServiceCodeOwnerRepairConstant.LIST_REPAIR_STAFFS;
+    }
+
+    @Override
+    public HttpMethod getHttpMethod() {
+        return HttpMethod.GET;
+    }
+
+
+    @Override
+    public int getOrder() {
+        return DEFAULT_ORDER;
+    }
+
+
+    public IRepairInnerServiceSMO getRepairInnerServiceSMOImpl() {
+        return repairInnerServiceSMOImpl;
+    }
+
+    public void setRepairInnerServiceSMOImpl(IRepairInnerServiceSMO repairInnerServiceSMOImpl) {
+        this.repairInnerServiceSMOImpl = repairInnerServiceSMOImpl;
+    }
+
+    @Override
+    protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        RepairUserDto repairUserDto = BeanConvertUtil.covertBean(reqJson, RepairUserDto.class);
+
+        int count = repairUserInnerServiceSMOImpl.queryRepairUsersCount(repairUserDto);
+
+
+        List<RepairUserDto> repairUserDtos = null;
+        if (count > 0) {
+            repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto);
+            refreshRepairUser(repairUserDtos);
+        } else {
+            repairUserDtos = new ArrayList<>();
+        }
+
+        ResponseEntity<String> responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, repairUserDtos);
+
+
+        context.setResponseEntity(responseEntity);
+
+    }
+
+    private void refreshRepairUser(List<RepairUserDto> repairUserDtos) {
+        long duration = 0;
+        for (RepairUserDto repairUserDto : repairUserDtos) {
+            if (repairUserDto.getEndTime() == null) {
+                duration = DateUtil.getCurrentDate().getTime() - repairUserDto.getStartTime().getTime();
+            } else {
+                duration = repairUserDto.getEndTime().getTime() - repairUserDto.getStartTime().getTime();
+            }
+            repairUserDto.setDuration(getCostTime(duration));
+        }
+    }
+
+
+    public String getCostTime(Long time) {
+        if (time == null) {
+            return "00:00";
+        }
+        long hours = time / (1000 * 60 * 60);
+        long minutes = (time - hours * (1000 * 60 * 60)) / (1000 * 60);
+        String diffTime = "";
+        if (minutes < 10) {
+            diffTime = hours + ":0" + minutes;
+        } else {
+            diffTime = hours + ":" + minutes;
+        }
+        return diffTime;
+    }
+}

+ 2 - 0
service-front/src/main/java/com/java110/front/smo/ownerRepair/impl/ListOwnerRepairsSMOImpl.java

@@ -1,6 +1,7 @@
 package com.java110.front.smo.ownerRepair.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.cache.MappingCache;
 import com.java110.utils.util.Assert;
 import org.springframework.web.client.RestTemplate;
 import com.java110.core.context.IPageData;
@@ -53,6 +54,7 @@ public class ListOwnerRepairsSMOImpl extends AbstractComponentSMO implements ILi
             paramIn.put("staffId", result.getUserId());
         }
 
+
         String apiUrl = ServiceConstant.SERVICE_API_URL + "/api/ownerRepair.listOwnerRepairs" + mapToUrlParam(paramIn);