Showing
3 changed files
with
64 additions
and
0 deletions
| ... | ... | @@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.contract; |
| 3 | 3 | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 5 | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 6 | +import com.github.pagehelper.Page; | |
| 6 | 7 | import com.github.pagehelper.PageInfo; |
| 7 | 8 | import com.lframework.starter.bpm.dto.FlowTaskDto; |
| 8 | 9 | import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper; |
| ... | ... | @@ -170,6 +171,28 @@ public class ContractDistributorStandardServiceImpl extends |
| 170 | 171 | // vo.setContractIdList(contractIdList); |
| 171 | 172 | // } |
| 172 | 173 | |
| 174 | + // 是否需要审核:true=只查当前用户待审核(正式合同或标准合同任一待办)的数据;false或空=按原逻辑查所有 | |
| 175 | + // examineType:FORMAL-只看正式合同待办;STANDARD-只看标准合同待办;空=两者任一 | |
| 176 | + // 将待办ID集合下沉到SQL过滤,直接走数据库分页,避免全量查询入内存 | |
| 177 | + if (Boolean.TRUE.equals(vo.getNeedExamine())) { | |
| 178 | + if (CollectionUtils.isEmpty(flowTaskList)) { | |
| 179 | + Page<ContractDistributorStandard> emptyPage = new Page<>(pageIndex, pageSize); | |
| 180 | + emptyPage.setTotal(0); | |
| 181 | + return PageResultUtil.convert(new PageInfo<>(emptyPage)); | |
| 182 | + } | |
| 183 | + | |
| 184 | + Set<String> formalTodoIds = flowTaskList.stream() | |
| 185 | + .filter(flowTaskDto -> FORMAL_FLAG.equals(flowTaskDto.getMode())) | |
| 186 | + .map(FlowTaskDto::getBusinessId) | |
| 187 | + .collect(Collectors.toSet()); | |
| 188 | + Set<String> standardTodoIds = flowTaskList.stream() | |
| 189 | + .filter(flowTaskDto -> STANDARD_FLAG.equals(flowTaskDto.getMode())) | |
| 190 | + .map(FlowTaskDto::getBusinessId) | |
| 191 | + .collect(Collectors.toSet()); | |
| 192 | + vo.setExamineFormalIds(new ArrayList<>(formalTodoIds)); | |
| 193 | + vo.setExamineStandardIds(new ArrayList<>(standardTodoIds)); | |
| 194 | + } | |
| 195 | + | |
| 173 | 196 | PageHelperUtil.startPage(pageIndex, pageSize); |
| 174 | 197 | List<ContractDistributorStandard> datas = this.query(vo); |
| 175 | 198 | if (CollectionUtils.isEmpty(datas)) { | ... | ... |
| ... | ... | @@ -101,5 +101,16 @@ public class QueryContractDistributorStandardVo extends PageVo implements BaseVo |
| 101 | 101 | @ApiModelProperty("锁价状态:UNLOCKED-未锁价,LOCKED-已锁价") |
| 102 | 102 | private String lockedPriceStatus; |
| 103 | 103 | |
| 104 | + @ApiModelProperty("是否需要审核(true=只查当前用户待审核的数据)") | |
| 105 | + private Boolean needExamine; | |
| 106 | + | |
| 107 | + @ApiModelProperty("审核类型(needExamine=true时生效:FORMAL-正式合同,STANDARD-标准合同)") | |
| 108 | + private String examineType; | |
| 109 | + | |
| 110 | + @ApiModelProperty(hidden = true) | |
| 111 | + private List<String> examineFormalIds; | |
| 112 | + | |
| 113 | + @ApiModelProperty(hidden = true) | |
| 114 | + private List<String> examineStandardIds; | |
| 104 | 115 | } |
| 105 | 116 | ... | ... |
| ... | ... | @@ -243,6 +243,36 @@ |
| 243 | 243 | #{item} |
| 244 | 244 | </foreach> |
| 245 | 245 | </if> |
| 246 | + <!-- 待审核筛选(needExamine=true时由服务层注入待办ID集合,SQL直接过滤以便走数据库分页) --> | |
| 247 | + <if test="vo.needExamine != null and vo.needExamine"> | |
| 248 | + <choose> | |
| 249 | + <when test="vo.examineType == 'FORMAL'"> | |
| 250 | + <choose> | |
| 251 | + <when test="vo.examineFormalIds != null and vo.examineFormalIds.size() > 0"> | |
| 252 | + AND tb.id IN | |
| 253 | + <foreach collection="vo.examineFormalIds" open="(" separator="," close=")" item="item"> | |
| 254 | + #{item} | |
| 255 | + </foreach> | |
| 256 | + </when> | |
| 257 | + <otherwise>AND 1 = 0</otherwise> | |
| 258 | + </choose> | |
| 259 | + </when> | |
| 260 | + <when test="vo.examineType == 'STANDARD'"> | |
| 261 | + <choose> | |
| 262 | + <when test="vo.examineStandardIds != null and vo.examineStandardIds.size() > 0"> | |
| 263 | + AND tb.id IN | |
| 264 | + <foreach collection="vo.examineStandardIds" open="(" separator="," close=")" item="item"> | |
| 265 | + #{item} | |
| 266 | + </foreach> | |
| 267 | + </when> | |
| 268 | + <otherwise>AND 1 = 0</otherwise> | |
| 269 | + </choose> | |
| 270 | + </when> | |
| 271 | + <otherwise> | |
| 272 | + AND 1 = 0 | |
| 273 | + </otherwise> | |
| 274 | + </choose> | |
| 275 | + </if> | |
| 246 | 276 | <!-- <choose>--> |
| 247 | 277 | <!-- <when test="vo.contractIdList != null and vo.contractIdList.size() > 0">--> |
| 248 | 278 | <!-- AND (tb.id IN--> | ... | ... |