From 20be465a6f32f3ddc53374d7d7fc652ff1da0100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Wed, 4 Jun 2025 16:17:04 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E6=8A=A5=E4=BF=AE=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/api/ApiWxRepairsController.java | 9 +++++ .../business/service/IWxRepairsService.java | 6 +++ .../service/impl/WxRepairsServiceImpl.java | 40 +++++++++++++++++-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/api/ApiWxRepairsController.java b/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/api/ApiWxRepairsController.java index 321b0dc..4aa61a1 100644 --- a/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/api/ApiWxRepairsController.java +++ b/propertyManagement-admin/src/main/java/com/propertyManagement/web/controller/business/api/ApiWxRepairsController.java @@ -20,6 +20,7 @@ import javax.validation.constraints.NotNull; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import java.util.Map; /** * 报修 @@ -46,6 +47,14 @@ public class ApiWxRepairsController extends BaseController { return R.ok(iWxRepairsService.queryList(bo)); } + /** + * 查询用户报修状态统计 + */ + @GetMapping("/userCountAll") + public R> userCountAll() { + return R.ok(iWxRepairsService.countAll()); + } + /** * 查询维修报修列表 */ diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/IWxRepairsService.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/IWxRepairsService.java index b2985f7..d83fcd9 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/IWxRepairsService.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/IWxRepairsService.java @@ -8,6 +8,7 @@ import com.propertyManagement.common.core.domain.PageQuery; import java.util.Collection; import java.util.List; +import java.util.Map; /** * 报修Service接口 @@ -32,6 +33,11 @@ public interface IWxRepairsService { */ List queryList(WxRepairsBo bo); + /** + * 查询用户报修状态统计 + */ + Map countAll(); + /** * 小程序新增报修 */ diff --git a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxRepairsServiceImpl.java b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxRepairsServiceImpl.java index f37cc82..7fc3268 100644 --- a/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxRepairsServiceImpl.java +++ b/propertyManagement-business/src/main/java/com/propertyManagement/business/service/impl/WxRepairsServiceImpl.java @@ -9,6 +9,7 @@ import com.propertyManagement.business.mapper.WxAccountMapper; import com.propertyManagement.business.support.util.AuthUtil; import com.propertyManagement.common.core.domain.BaseEntity; import com.propertyManagement.common.enums.AccountType; +import com.propertyManagement.common.enums.RepairsState; import com.propertyManagement.common.utils.StringUtils; import com.propertyManagement.common.core.page.TableDataInfo; import com.propertyManagement.common.core.domain.PageQuery; @@ -24,10 +25,7 @@ import com.propertyManagement.business.mapper.WxRepairsMapper; import com.propertyManagement.business.service.IWxRepairsService; import org.springframework.transaction.annotation.Transactional; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.util.*; /** * 报修Service业务层处理 @@ -69,6 +67,40 @@ public class WxRepairsServiceImpl implements IWxRepairsService { return baseMapper.selectVoList(lqw); } + /** + * 查询用户报修状态统计 + */ + @Override + public Map countAll() { + Map map = new LinkedHashMap<>(); + LoginWxUser wxUser = AuthUtil.getWxUser(); + LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper + .eq(WxRepairs::getUserId, wxUser.getId()) + .eq(WxRepairs::getCommunityId, wxUser.getCommunityId()) + .eq(WxRepairs::getState, RepairsState.ONE.getCode()); + map.put(RepairsState.ONE.getCode(), baseMapper.selectCount(lambdaQueryWrapper)); + lambdaQueryWrapper.clear(); + lambdaQueryWrapper + .eq(WxRepairs::getUserId, wxUser.getId()) + .eq(WxRepairs::getCommunityId, wxUser.getCommunityId()) + .eq(WxRepairs::getState, RepairsState.TWO.getCode()); + map.put(RepairsState.TWO.getCode(), baseMapper.selectCount(lambdaQueryWrapper)); + lambdaQueryWrapper.clear(); + lambdaQueryWrapper + .eq(WxRepairs::getUserId, wxUser.getId()) + .eq(WxRepairs::getCommunityId, wxUser.getCommunityId()) + .eq(WxRepairs::getState, RepairsState.THREE.getCode()); + map.put(RepairsState.THREE.getCode(), baseMapper.selectCount(lambdaQueryWrapper)); + lambdaQueryWrapper.clear(); + lambdaQueryWrapper + .eq(WxRepairs::getUserId, wxUser.getId()) + .eq(WxRepairs::getCommunityId, wxUser.getCommunityId()) + .eq(WxRepairs::getState, RepairsState.FOUR.getCode()); + map.put(RepairsState.FOUR.getCode(), baseMapper.selectCount(lambdaQueryWrapper)); + return map; + } + private LambdaQueryWrapper buildQueryWrapper(WxRepairsBo bo) { Map params = bo.getParams(); -- 2.22.0