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 321b0dc18e858dcf35feadd07dde2fbad7080fb8..4aa61a135fb8a078fca4c8bf3b7b89370bd8ea3b 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 b2985f747f0c610634ef1a2568316a74e0db8a9f..d83fcd9be87b9d08f5688ecb7dd1c6279a1f52f1 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 f37cc82527d530d668149207203e703d8cbb1492..7fc3268d1d3a5a521ceb63f51738100dc0703b5c 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();