guarantee-lsq 3 жил өмнө
parent
commit
b9abbfe505

+ 9 - 0
platform-common/src/main/java/com/platform/common/constant/CommonConstants.java

@@ -225,4 +225,13 @@ public interface CommonConstants {
      * 	已完成
      */
     int FINISHED = 6;
+
+    /**
+     * 角色类别-维修-普通
+     */
+    String WORKPLACE_REPAIR_NORMAL = "workplace-repair-normal";
+    /**
+     * 角色类别-维修-管理员
+     */
+    String WORKPLACE_REPAIR_MANAGE = "workplace-repair-manage";
 }

+ 33 - 7
platform-rest/src/main/java/com/platform/rest/controller/index/IndexController.java

@@ -1,27 +1,21 @@
 package com.platform.rest.controller.index;
 
 import com.platform.common.model.UserInfo;
-import com.platform.common.util.DateUtils;
 import com.platform.common.util.R;
 import com.platform.common.util.SecurityUtils;
-import com.platform.dao.entity.upms.SysUser;
 import com.platform.dao.enums.CheckStandardTypeEnum;
-import com.platform.dao.enums.RepairApplicationFormStatusEnum;
 import com.platform.dao.enums.SysRoleCodeEnum;
 import com.platform.dao.vo.index.GatherTaskVO;
 import com.platform.service.check.CheckJobService;
 import com.platform.service.repair.RepairApplicationFormService;
 import com.platform.service.sb.SbOilService;
-import com.platform.service.wechat.model.request.WechatTemplateRequestBuilder;
-import com.platform.service.wechat.model.request.template.WechatTemplateRequest;
-import com.platform.service.wechat.service.WeChatConnectService;
+import com.platform.service.workplace.IndexService;
 import lombok.AllArgsConstructor;
 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;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -41,6 +35,8 @@ public class IndexController {
 
     private final RepairApplicationFormService repairApplicationFormService;
 
+    private final IndexService indexService;
+
     /**
      * 统计用户的任务
      * 当日的任务(截止到当前日期未完成的)
@@ -99,4 +95,34 @@ public class IndexController {
 
     }
 
+    /**
+     * 获取工作台的顶部统计数据
+     *
+     * @return R
+     */
+    @GetMapping("/gather/workplace/topData/{roleCode}")
+    public R gatherWorkplaceTopData(@PathVariable(value = "roleCode") String roleCode) {
+        return indexService.getWorkplaceTopData(roleCode);
+    }
+
+    /**
+     * 获取工作台的左侧饼状图数据
+     *
+     * @return R
+     */
+    @GetMapping("/gather/workplace/pie/{roleCode}")
+    public R gatherWorkplacePieData(@PathVariable(value = "roleCode") String roleCode) {
+        return indexService.getWorkplaceLeftPie(roleCode);
+    }
+
+    /**
+     * 获取工作台的近一周数据
+     *
+     * @return R
+     */
+    @GetMapping("/gather/workplace/week/{roleCode}")
+    public R gatherWorkplaceWeekData(@PathVariable(value = "roleCode") String roleCode) {
+        return indexService.getWorkplaceWeekData(roleCode);
+    }
+
 }

+ 27 - 0
platform-service/src/main/java/com/platform/service/workplace/IndexService.java

@@ -0,0 +1,27 @@
+package com.platform.service.workplace;
+
+import com.platform.common.util.R;
+
+public interface IndexService {
+
+    /**
+     * 根据roleCode获取工作台顶层数据
+     * @param roleCode
+     * @return
+     */
+    R getWorkplaceTopData(String roleCode);
+
+    /**
+     * 根据roleCode获取工作台左侧饼状图数据
+     * @param roleCode
+     * @return
+     */
+    R getWorkplaceLeftPie(String roleCode);
+
+    /**
+     * 根据roleCode获取工作台近一周数据
+     * @param roleCode
+     * @return
+     */
+    R getWorkplaceWeekData(String roleCode);
+}

+ 68 - 0
platform-service/src/main/java/com/platform/service/workplace/impl/IndexServiceImpl.java

@@ -0,0 +1,68 @@
+package com.platform.service.workplace.impl;
+
+import com.platform.common.constant.CommonConstants;
+import com.platform.common.util.DateUtils;
+import com.platform.common.util.R;
+import com.platform.common.util.SecurityUtils;
+import com.platform.service.repair.RepairApplicationFormService;
+import com.platform.service.repair.RepairFeeService;
+import com.platform.service.workplace.IndexService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
+
+@Service("indexService")
+public class IndexServiceImpl implements IndexService {
+    @Resource
+    private RepairApplicationFormService repairApplicationFormService;
+    @Resource
+    private RepairFeeService repairFeeService;
+
+    @Override
+    public R getWorkplaceTopData(String roleCode) {
+        String userId = SecurityUtils.getUserInfo().getUserId();
+        LocalDateTime now = LocalDateTime.now();
+        R r = R.success();
+        switch (roleCode){
+            case CommonConstants.WORKPLACE_REPAIR_NORMAL:
+                r.setData(repairApplicationFormService.getWorkplaceRepairData(userId, DateUtils.dateToString(now,DateUtils.PATTERN_YMD)));
+                break;
+            case CommonConstants.WORKPLACE_REPAIR_MANAGE:
+                r.setData(repairApplicationFormService.getWorkplaceRepairData(null, DateUtils.dateToString(now,DateUtils.PATTERN_YMD)));
+                break;
+        }
+        return r;
+    }
+
+    @Override
+    public R getWorkplaceLeftPie(String roleCode) {
+        String userId = SecurityUtils.getUserInfo().getUserId();
+        LocalDateTime now = LocalDateTime.now();
+        R r = R.success();
+        switch (roleCode){
+            case CommonConstants.WORKPLACE_REPAIR_NORMAL:
+                r.setData(repairFeeService.listForWorkplacePie(userId, DateUtils.dateToString(now,DateUtils.PATTERN_YMD)));
+                break;
+            case CommonConstants.WORKPLACE_REPAIR_MANAGE:
+                r.setData(repairFeeService.listForWorkplacePie(null, DateUtils.dateToString(now,DateUtils.PATTERN_YMD)));
+                break;
+        }
+        return r;
+    }
+
+    @Override
+    public R getWorkplaceWeekData(String roleCode) {
+        String userId = SecurityUtils.getUserInfo().getUserId();
+        R r = R.success();
+        switch (roleCode){
+            case CommonConstants.WORKPLACE_REPAIR_NORMAL:
+                r.setData(repairApplicationFormService.getCurrentlyList(userId));
+                break;
+            case CommonConstants.WORKPLACE_REPAIR_MANAGE:
+                r.setData(repairApplicationFormService.getCurrentlyList(null));
+                break;
+        }
+        return r;
+    }
+}