Commit f65d0db3c9612c0ee19dca49544072d30d49239f
1 parent
5968c962
app首页统计详情页面修改,区分督察员和组长
Showing
7 changed files
with
62 additions
and
4 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/homepage/HomepageSummaryMapper.java
| ... | ... | @@ -215,5 +215,5 @@ public interface HomepageSummaryMapper extends BaseMapperX<DepartmentCostDO> { |
| 215 | 215 | * @Param null |
| 216 | 216 | * @Return |
| 217 | 217 | */ |
| 218 | - List<AppWorkOrderSummaryVo> countWorkOrder(@Param("queryType") String queryType, @Param("beginTime") String beginTime, @Param("endTime") String endTime); | |
| 218 | + List<AppWorkOrderSummaryVo> countWorkOrder(@Param("queryType") String queryType,@Param("userId") Long userId, @Param("beginTime") String beginTime, @Param("endTime") String endTime); | |
| 219 | 219 | } | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/homepage/HomepageSummaryServiceImpl.java
| ... | ... | @@ -15,6 +15,7 @@ import com.zteits.urbanops.module.garden.dal.mysql.taskstatistics.TaskStatistics |
| 15 | 15 | import com.zteits.urbanops.module.system.api.dept.DeptApi; |
| 16 | 16 | import com.zteits.urbanops.module.system.api.permission.RoleApi; |
| 17 | 17 | import com.zteits.urbanops.module.system.api.user.AdminUserApi; |
| 18 | +import com.zteits.urbanops.module.system.enums.common.CommonConstants; | |
| 18 | 19 | import jakarta.annotation.Resource; |
| 19 | 20 | import org.apache.commons.collections4.CollectionUtils; |
| 20 | 21 | import org.apache.commons.lang3.StringUtils; |
| ... | ... | @@ -29,6 +30,8 @@ import java.time.format.DateTimeFormatter; |
| 29 | 30 | import java.util.*; |
| 30 | 31 | import java.util.stream.Collectors; |
| 31 | 32 | |
| 33 | +import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 34 | + | |
| 32 | 35 | /** |
| 33 | 36 | * @Classname HomepageSummaryServiceImpl |
| 34 | 37 | * @Description 首页统计实现 |
| ... | ... | @@ -56,7 +59,7 @@ public class HomepageSummaryServiceImpl implements HomepageSummaryService{ |
| 56 | 59 | |
| 57 | 60 | @Override |
| 58 | 61 | public List<TaskCompletionStatusRspVo> taskCompletionSummary(AppHomePageSummaryReqVO req) { |
| 59 | - Long userId = SecurityFrameworkUtils.getLoginUserId(); | |
| 62 | + Long userId = getLoginUserId(); | |
| 60 | 63 | //巡查任务和养护任务已完成,未完成数量统计 |
| 61 | 64 | //返回数据初始化 |
| 62 | 65 | List<String> days = getDays(req.getBeginTime(), req.getEndTime()); |
| ... | ... | @@ -102,7 +105,7 @@ public class HomepageSummaryServiceImpl implements HomepageSummaryService{ |
| 102 | 105 | |
| 103 | 106 | @Override |
| 104 | 107 | public PageResult<TaskDetailsRspVo> queryTaskDetails(AppHomePageSummaryPageReqVO req) { |
| 105 | - Long userId = SecurityFrameworkUtils.getLoginUserId(); | |
| 108 | + Long userId = getLoginUserId(); | |
| 106 | 109 | IPage<TaskDetailsRspVo> mpPage = MyBatisUtils.buildPage(req); |
| 107 | 110 | if (req.getQueryType() == 2) { |
| 108 | 111 | //已完成 |
| ... | ... | @@ -110,7 +113,7 @@ public class HomepageSummaryServiceImpl implements HomepageSummaryService{ |
| 110 | 113 | } else { |
| 111 | 114 | //待办 |
| 112 | 115 | Long deptId = SecurityFrameworkUtils.getDeptId(); |
| 113 | - List<Long> roleIds = roleApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId()); | |
| 116 | + List<Long> roleIds = roleApi.getRoleIdsByUserId(getLoginUserId()); | |
| 114 | 117 | mpPage = homepageSummaryMapper.queryPendingTaskDetails(mpPage, roleIds, userId, deptId, LocalDateTime.now()); |
| 115 | 118 | } |
| 116 | 119 | return new PageResult<>(mpPage.getRecords(), mpPage.getTotal()); |
| ... | ... | @@ -289,9 +292,19 @@ public class HomepageSummaryServiceImpl implements HomepageSummaryService{ |
| 289 | 292 | // 1. 创建返回对象 |
| 290 | 293 | AppWorkOrderSummaryRspVo respVo = new AppWorkOrderSummaryRspVo(); |
| 291 | 294 | |
| 295 | + Long userId = null; | |
| 296 | + //部派工单 | |
| 297 | + if ("1".equals(req.getQueryType())) { | |
| 298 | + // 全域督察员查询自己发起的工单 | |
| 299 | + List<Long> userIds = roleApi.getUserIdsByRoleCode(CommonConstants.INSPECTOR_ROLE_KEY); | |
| 300 | + if (userIds.contains(getLoginUserId())) { | |
| 301 | + userId = getLoginUserId(); | |
| 302 | + } | |
| 303 | + } | |
| 292 | 304 | // 2. 查询工单列表 |
| 293 | 305 | List<AppWorkOrderSummaryVo> workOrderList = homepageSummaryMapper.countWorkOrder( |
| 294 | 306 | req.getQueryType(), |
| 307 | + userId, | |
| 295 | 308 | req.getBeginTime(), |
| 296 | 309 | req.getEndTime() |
| 297 | 310 | ); | ... | ... |
urbanops-module-garden/src/main/resources/mapper/homepage/HomepageSummaryMapper.xml
| ... | ... | @@ -603,6 +603,9 @@ |
| 603 | 603 | <if test='queryType != null and queryType == "1"'> |
| 604 | 604 | AND w.order_no LIKE 'IWO%' |
| 605 | 605 | </if> |
| 606 | + <if test="userId != null"> | |
| 607 | + AND w.user_id = #{userId} | |
| 608 | + </if> | |
| 606 | 609 | <if test="beginTime != null and beginTime != ''"> |
| 607 | 610 | AND w.create_time >= #{beginTime} |
| 608 | 611 | </if> | ... | ... |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/enums/common/CommonConstants.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.system.enums.common; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * @Classname CommonConstants | |
| 5 | + * @Description 公共静态参数 | |
| 6 | + * @Date 2026/1/3 10:15 | |
| 7 | + * @Created by wangqian | |
| 8 | + */ | |
| 9 | +public interface CommonConstants { | |
| 10 | + | |
| 11 | + public static final String INSPECTOR_ROLE_KEY = "Inspector_global"; | |
| 12 | + | |
| 13 | +} | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/maininfo/vo/AppMainInfoPageReqVO.java
| ... | ... | @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.workorder.controller.app.maininfo.vo; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | +import jakarta.validation.constraints.NotEmpty; | |
| 5 | 6 | import lombok.Data; |
| 6 | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| 7 | 8 | |
| ... | ... | @@ -15,6 +16,10 @@ import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YE |
| 15 | 16 | @Data |
| 16 | 17 | public class AppMainInfoPageReqVO extends PageParam { |
| 17 | 18 | |
| 19 | + @NotEmpty | |
| 20 | + @Schema(description = "查询类型", example = "0:全部工单 1:全域工单") | |
| 21 | + public String queryType; | |
| 22 | + | |
| 18 | 23 | @Schema(description = "搜索类型:1 位置 2 工单名称 3 情况描述 4 工单编号", example = "1") |
| 19 | 24 | private String type; |
| 20 | 25 | |
| ... | ... | @@ -56,6 +61,9 @@ public class AppMainInfoPageReqVO extends PageParam { |
| 56 | 61 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| 57 | 62 | private String endTime; |
| 58 | 63 | |
| 64 | + @Schema(description = "用户id", example = "12" , hidden = true) | |
| 65 | + private Long userId; | |
| 66 | + | |
| 59 | 67 | /** |
| 60 | 68 | * 组装时间:beginTime + endTime → createTime |
| 61 | 69 | */ | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoMapper.java
| ... | ... | @@ -147,6 +147,10 @@ public interface MainInfoMapper extends BaseMapperX<MainInfoDO> { |
| 147 | 147 | LambdaQueryWrapperX<MainInfoDO> queryWrapper = new LambdaQueryWrapperX<>(); |
| 148 | 148 | // 不查询快速工单 → 订单类型 != "Q" |
| 149 | 149 | queryWrapper.ne(MainInfoDO::getOrderType, "Q"); |
| 150 | + // 部派工单 → 工单编号以 "IWO" 开头 | |
| 151 | + if ("1".equals(reqVO.getQueryType()) ) { | |
| 152 | + queryWrapper.likeRight(MainInfoDO::getOrderNo, "IWO"); | |
| 153 | + } | |
| 150 | 154 | queryWrapper.eqIfPresent(MainInfoDO::getWorkerCompanyId, reqVO.getWorkerCompanyId()) |
| 151 | 155 | .eqIfPresent(MainInfoDO::getCompanyId, reqVO.getCompanyId()) |
| 152 | 156 | .likeIfPresent(MainInfoDO::getOrderNo, reqVO.getOrderNo()) |
| ... | ... | @@ -155,6 +159,7 @@ public interface MainInfoMapper extends BaseMapperX<MainInfoDO> { |
| 155 | 159 | .betweenIfPresent(MainInfoDO::getCreateTime, reqVO.getCreateTime()) |
| 156 | 160 | .likeIfPresent(MainInfoDO::getLonLatAddress, reqVO.getLonLatAddress()) |
| 157 | 161 | .likeIfPresent(MainInfoDO::getRemark, reqVO.getRemark()) |
| 162 | + .eqIfPresent(MainInfoDO::getUserId, reqVO.getUserId()) | |
| 158 | 163 | .orderByDesc(MainInfoDO::getId); |
| 159 | 164 | return selectPage(reqVO, queryWrapper); |
| 160 | 165 | } | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/maininfo/MainInfoServiceImpl.java
| ... | ... | @@ -3,6 +3,8 @@ package com.zteits.urbanops.module.workorder.service.maininfo; |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 5 | 5 | import com.zteits.urbanops.framework.common.util.object.ObjectUtils; |
| 6 | +import com.zteits.urbanops.module.system.api.permission.RoleApi; | |
| 7 | +import com.zteits.urbanops.module.system.enums.common.CommonConstants; | |
| 6 | 8 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoPageReqVO; |
| 7 | 9 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoSaveReqVO; |
| 8 | 10 | import com.zteits.urbanops.module.workorder.controller.app.maininfo.vo.AppMainInfoPageReqVO; |
| ... | ... | @@ -15,6 +17,7 @@ import org.springframework.validation.annotation.Validated; |
| 15 | 17 | import java.util.List; |
| 16 | 18 | |
| 17 | 19 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | +import static com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | |
| 18 | 21 | import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.MAIN_INFO_NOT_EXISTS; |
| 19 | 22 | |
| 20 | 23 | /** |
| ... | ... | @@ -29,6 +32,10 @@ public class MainInfoServiceImpl implements MainInfoService { |
| 29 | 32 | @Resource |
| 30 | 33 | private MainInfoMapper mainInfoMapper; |
| 31 | 34 | |
| 35 | + @Resource | |
| 36 | + private RoleApi roleApi; | |
| 37 | + | |
| 38 | + | |
| 32 | 39 | @Override |
| 33 | 40 | public Long createMainInfo(MainInfoSaveReqVO createReqVO) { |
| 34 | 41 | // 插入 |
| ... | ... | @@ -106,6 +113,15 @@ public class MainInfoServiceImpl implements MainInfoService { |
| 106 | 113 | pageReqVO.setOrderName(content); |
| 107 | 114 | } |
| 108 | 115 | } |
| 116 | + //部派工单 | |
| 117 | + if ("1".equals(pageReqVO.getQueryType())) { | |
| 118 | + //全域督察员查询自己发起的工单 | |
| 119 | + List<Long> userIds = roleApi.getUserIdsByRoleCode(CommonConstants.INSPECTOR_ROLE_KEY); | |
| 120 | + if (userIds.contains(getLoginUserId())) { | |
| 121 | + pageReqVO.setUserId(getLoginUserId()); | |
| 122 | + pageReqVO.setWorkerCompanyId(null); | |
| 123 | + } | |
| 124 | + } | |
| 109 | 125 | return mainInfoMapper.selectPageExcludeQuickOrder(pageReqVO); |
| 110 | 126 | } |
| 111 | 127 | ... | ... |