|
@@ -8,6 +8,7 @@ import com.etotem.cfc.entity.Article;
|
|
|
import com.etotem.cfc.entity.ButlerProfile;
|
|
import com.etotem.cfc.entity.ButlerProfile;
|
|
|
import com.etotem.cfc.entity.Product;
|
|
import com.etotem.cfc.entity.Product;
|
|
|
import com.etotem.cfc.entity.PendingRefund;
|
|
import com.etotem.cfc.entity.PendingRefund;
|
|
|
|
|
+import com.etotem.cfc.entity.ServiceRoleApplication;
|
|
|
import com.etotem.cfc.entity.SupplyHierarchyChangeRequest;
|
|
import com.etotem.cfc.entity.SupplyHierarchyChangeRequest;
|
|
|
import com.etotem.cfc.entity.TaskTemplatePackage;
|
|
import com.etotem.cfc.entity.TaskTemplatePackage;
|
|
|
import com.etotem.cfc.entity.User;
|
|
import com.etotem.cfc.entity.User;
|
|
@@ -17,6 +18,7 @@ import com.etotem.cfc.mapper.ActivityRegistrationMapper;
|
|
|
import com.etotem.cfc.mapper.ArticleMapper;
|
|
import com.etotem.cfc.mapper.ArticleMapper;
|
|
|
import com.etotem.cfc.mapper.ButlerProfileMapper;
|
|
import com.etotem.cfc.mapper.ButlerProfileMapper;
|
|
|
import com.etotem.cfc.mapper.ProductMapper;
|
|
import com.etotem.cfc.mapper.ProductMapper;
|
|
|
|
|
+import com.etotem.cfc.mapper.ServiceRoleApplicationMapper;
|
|
|
import com.etotem.cfc.mapper.SupplyHierarchyChangeRequestMapper;
|
|
import com.etotem.cfc.mapper.SupplyHierarchyChangeRequestMapper;
|
|
|
import com.etotem.cfc.mapper.TaskTemplatePackageMapper;
|
|
import com.etotem.cfc.mapper.TaskTemplatePackageMapper;
|
|
|
import com.etotem.cfc.mapper.UserMapper;
|
|
import com.etotem.cfc.mapper.UserMapper;
|
|
@@ -28,6 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -64,6 +67,29 @@ public class ReviewCenterController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private PendingRefundMapper pendingRefundMapper;
|
|
private PendingRefundMapper pendingRefundMapper;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ServiceRoleApplicationMapper serviceRoleApplicationMapper;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 统计待审(status=0)服务角色申请中命中任一目标角色的条数,同一记录只计一次。
|
|
|
|
|
+ */
|
|
|
|
|
+ public static int countPendingByRoles(List<ServiceRoleApplication> apps, String... roles) {
|
|
|
|
|
+ if (apps == null || apps.isEmpty()) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ int count = 0;
|
|
|
|
|
+ for (ServiceRoleApplication app : apps) {
|
|
|
|
|
+ if (app == null || app.getStatus() == null || app.getStatus() != 0) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (com.etotem.cfc.service.impl.ServiceRoleApplicationServiceImpl.matchesAnyRole(
|
|
|
|
|
+ app.getRoles(), java.util.Arrays.asList(roles))) {
|
|
|
|
|
+ count++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return count;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@PostMapping("/summary")
|
|
@PostMapping("/summary")
|
|
|
public Result<Map<String, Integer>> summary() {
|
|
public Result<Map<String, Integer>> summary() {
|
|
|
Map<String, Integer> counts = new HashMap<>();
|
|
Map<String, Integer> counts = new HashMap<>();
|
|
@@ -74,14 +100,22 @@ public class ReviewCenterController {
|
|
|
counts.put("productPending", productMapper.selectCount(
|
|
counts.put("productPending", productMapper.selectCount(
|
|
|
new QueryWrapper<Product>().eq("status", "pending")).intValue());
|
|
new QueryWrapper<Product>().eq("status", "pending")).intValue());
|
|
|
|
|
|
|
|
- counts.put("guidePending", userMapper.selectCount(
|
|
|
|
|
- new QueryWrapper<User>().eq("teacher_status", "pending")).intValue());
|
|
|
|
|
|
|
+ // 服务角色申请中的待审记录按角色分流合并到各 Tab 计数
|
|
|
|
|
+ List<ServiceRoleApplication> pendingApplications = serviceRoleApplicationMapper.selectList(
|
|
|
|
|
+ new QueryWrapper<ServiceRoleApplication>().eq("status", 0));
|
|
|
|
|
|
|
|
- counts.put("vendorPending", userMapper.selectCount(
|
|
|
|
|
- new QueryWrapper<User>().eq("vendor_status", "pending")).intValue());
|
|
|
|
|
|
|
+ counts.put("guidePending",
|
|
|
|
|
+ userMapper.selectCount(new QueryWrapper<User>().eq("teacher_status", "pending")).intValue()
|
|
|
|
|
+ + countPendingByRoles(pendingApplications, "planner"));
|
|
|
|
|
|
|
|
- counts.put("butlerPending", butlerProfileMapper.selectCount(
|
|
|
|
|
- new QueryWrapper<ButlerProfile>().eq("status", "pending")).intValue());
|
|
|
|
|
|
|
+ counts.put("vendorPending",
|
|
|
|
|
+ userMapper.selectCount(new QueryWrapper<User>().eq("vendor_status", "pending")).intValue()
|
|
|
|
|
+ + countPendingByRoles(pendingApplications, "vendor", "activity_provider"));
|
|
|
|
|
+
|
|
|
|
|
+ counts.put("butlerPending",
|
|
|
|
|
+ butlerProfileMapper.selectCount(new QueryWrapper<ButlerProfile>().eq("status", "pending")).intValue()
|
|
|
|
|
+ + userMapper.selectCount(new QueryWrapper<User>().eq("butler_status", "pending")).intValue()
|
|
|
|
|
+ + countPendingByRoles(pendingApplications, "butler"));
|
|
|
|
|
|
|
|
counts.put("packagePending", taskTemplatePackageMapper.selectCount(
|
|
counts.put("packagePending", taskTemplatePackageMapper.selectCount(
|
|
|
new QueryWrapper<TaskTemplatePackage>().eq("status", "pending")).intValue());
|
|
new QueryWrapper<TaskTemplatePackage>().eq("status", "pending")).intValue());
|
|
@@ -101,8 +135,11 @@ public class ReviewCenterController {
|
|
|
counts.put("hierarchyChangePending", supplyHierarchyChangeRequestMapper.selectCount(
|
|
counts.put("hierarchyChangePending", supplyHierarchyChangeRequestMapper.selectCount(
|
|
|
new QueryWrapper<SupplyHierarchyChangeRequest>().eq("status", "pending")).intValue());
|
|
new QueryWrapper<SupplyHierarchyChangeRequest>().eq("status", "pending")).intValue());
|
|
|
|
|
|
|
|
- counts.put("nutritionistPending", userMapper.selectCount(
|
|
|
|
|
- new QueryWrapper<User>().eq("nutritionist_status", "pending")).intValue());
|
|
|
|
|
|
|
+ counts.put("nutritionistPending",
|
|
|
|
|
+ userMapper.selectCount(new QueryWrapper<User>().eq("nutritionist_status", "pending")).intValue()
|
|
|
|
|
+ + countPendingByRoles(pendingApplications, "nutritionist"));
|
|
|
|
|
+
|
|
|
|
|
+ counts.put("knowledgePending", countPendingByRoles(pendingApplications, "article_admin"));
|
|
|
|
|
|
|
|
return Result.success(counts);
|
|
return Result.success(counts);
|
|
|
}
|
|
}
|