任务列表优化
This commit is contained in:
parent
fa8b566da9
commit
50a3b0d23c
@ -45,7 +45,7 @@ public class PsTaskController extends BaseController {
|
||||
/**
|
||||
* 查询主任务列表
|
||||
*/
|
||||
@Log(title = "查询主任务列表")
|
||||
// @Log(title = "查询主任务列表")
|
||||
@SaCheckPermission("business:task:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<PsTaskMainVo> list(PsTaskQueryBo bo, PageQuery pageQuery) {
|
||||
@ -55,7 +55,7 @@ public class PsTaskController extends BaseController {
|
||||
/**
|
||||
* 查询内外特任务列表
|
||||
*/
|
||||
@Log(title = "查询内外特任务列表")
|
||||
// @Log(title = "查询内外特任务列表")
|
||||
@SaCheckPermission("business:task:list")
|
||||
@GetMapping("/childList")
|
||||
public TableDataInfo<PsTaskMainVo> childList(@Validated(QueryGroup.class) PsTaskQueryBo bo, PageQuery pageQuery) {
|
||||
|
@ -26,6 +26,6 @@ public interface PsContractBusinessMapper extends BaseMapperPlus<PsContractBusin
|
||||
List<PsContractBusinessVo> selectTuoGuanBusinessList(@Param(Constants.WRAPPER) Wrapper<PsContractBusiness> queryWrapper);
|
||||
|
||||
|
||||
List<PsContractBusinessDetailVo> selectListByContractCodeAndComanyId(@Param(Constants.WRAPPER) Wrapper<PsContractBusiness> queryWrapper);
|
||||
List<PsContractBusinessDetailVo> selectListByContractCodeAndCompanyId(@Param(Constants.WRAPPER) Wrapper<PsContractBusiness> queryWrapper);
|
||||
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ public interface IPsApproverRecordService {
|
||||
Map<String, String> getLastFail(List<String> businessIds, List<String> businessTypes);
|
||||
|
||||
Map<String, List<PsApproverRecordVo>> getLastRecord(List<String> contractCodes, List<String> businessTypes);
|
||||
|
||||
Map<String, List<PsApproverRecordVo>> getLastRecordByBus(List<String> businessIds, List<String> businessTypes);
|
||||
//
|
||||
// /**
|
||||
// * 新增审批记录
|
||||
|
@ -184,7 +184,9 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
||||
return new HashMap<>();
|
||||
}
|
||||
QueryWrapper<PsApproverRecord> qw = Wrappers.query();
|
||||
qw.in("r.contract_code", contractCodes)
|
||||
|
||||
qw
|
||||
.in("r.contract_code", contractCodes)
|
||||
.in("r.business_type", businessTypes);
|
||||
List<PsApproverRecordVo> record = baseMapper.getLastFail(qw);
|
||||
|
||||
@ -195,6 +197,23 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, List<PsApproverRecordVo>> getLastRecordByBus(List<String> businessIds, List<String> businessTypes){
|
||||
if (businessIds.isEmpty()){
|
||||
return new HashMap<>();
|
||||
}
|
||||
QueryWrapper<PsApproverRecord> qw = Wrappers.query();
|
||||
|
||||
qw.in("r.business_id", businessIds).in("r.business_type", businessTypes);
|
||||
List<PsApproverRecordVo> record = baseMapper.getLastFail(qw);
|
||||
|
||||
Map<String, List<PsApproverRecordVo>> map = new HashMap<>();
|
||||
for (PsApproverRecordVo v : record) {
|
||||
List<PsApproverRecordVo> psApproverRecordVos = map.computeIfAbsent(v.getBusinessId(), s -> new ArrayList<>());
|
||||
psApproverRecordVos.add(v);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
// /**
|
||||
// * 新增审批记录
|
||||
// *
|
||||
|
@ -11,11 +11,8 @@ import com.pusong.business.domain.bo.MediaCompanySaveBo;
|
||||
import com.pusong.business.domain.bo.PsTaskMediaBo;
|
||||
import com.pusong.business.domain.bo.PsTaskQueryBo;
|
||||
import com.pusong.business.domain.vo.*;
|
||||
import com.pusong.business.enums.ApproverTypeEnum;
|
||||
import com.pusong.business.enums.ContractStatusEnum;
|
||||
import com.pusong.business.enums.TaskStatusEnum;
|
||||
import com.pusong.business.enums.*;
|
||||
import com.pusong.business.enums.TaskStatusEnum.AppointStatusEnum;
|
||||
import com.pusong.business.enums.TaskTypeEnum;
|
||||
import com.pusong.business.mapper.*;
|
||||
import com.pusong.business.service.*;
|
||||
import com.pusong.business.service.approver.ApproverContainer;
|
||||
@ -123,6 +120,21 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
// lqw.orderByAsc("assigned");
|
||||
lqw.orderByDesc("main.create_time");
|
||||
page = baseMapper.queryTaskPageList(pageQuery.build(), lqw);
|
||||
|
||||
if (page.getSize() > 0){
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
List<Long> list = page.getRecords().stream().map(PsTaskMainVo::getId).toList();
|
||||
queryWrapper.in("task_id", list);
|
||||
queryWrapper.ne("appoint_status", "50");
|
||||
queryWrapper.eq("del_flag", "0");
|
||||
List<PsTaskAppointVo> taskAppointVos = appointMapper.selectVoList(queryWrapper);
|
||||
LinkedHashMap<Long, List<PsTaskAppointVo>> collect = taskAppointVos.stream().collect(Collectors.groupingBy(PsTaskAppointVo::getTaskId, LinkedHashMap::new, Collectors.toList()));
|
||||
for (PsTaskMainVo record : page.getRecords()) {
|
||||
record.setPsTaskAppointVoList(collect.get(record.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fillInfo(page);
|
||||
@ -132,30 +144,33 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
}
|
||||
|
||||
private void fillInfo(Page<PsTaskMainVo> page) {
|
||||
String contractCode = null;
|
||||
if (page.getRecords().isEmpty()){
|
||||
return;
|
||||
}
|
||||
Map<String, List<PsContractBusinessDetailVo>> busMap = new HashMap<>();
|
||||
List<Long> serviceCompanyIdList = page.getRecords().stream().map(PsTaskMainVo::getServiceCompanyId).toList();
|
||||
List<String> contractCodeList = page.getRecords().stream().map(PsTaskMainVo::getContractCode).toList();
|
||||
// List<String> taskIdList = page.getRecords().stream().map(PsTaskMainVo::getId).map(Object::toString).toList();
|
||||
|
||||
QueryWrapper<PsContractBusiness> objectQueryWrapper = new QueryWrapper<PsContractBusiness>()
|
||||
.in("bus.contract_code", contractCodeList)
|
||||
.in("bus.company_id", serviceCompanyIdList);
|
||||
List<PsContractBusinessDetailVo> psContractBusinesses = businessMapper.selectListByContractCodeAndComanyId(objectQueryWrapper);
|
||||
List<PsContractBusinessDetailVo> psContractBusinesses = businessMapper.selectListByContractCodeAndCompanyId(objectQueryWrapper);
|
||||
|
||||
for (PsContractBusinessDetailVo psContractBusiness : psContractBusinesses) {
|
||||
List<PsContractBusinessDetailVo> psContractBusinesses1 = busMap.computeIfAbsent(psContractBusiness.getContractCode() + "_" + psContractBusiness.getCompanyId(), a -> new ArrayList<>());
|
||||
psContractBusinesses1.add(psContractBusiness);
|
||||
}
|
||||
|
||||
// Map<String, List<PsApproverRecordVo>> lastFailMap = approverRecordService.getLastRecordByBus( taskIdList
|
||||
// , List.of(ApproverTypeEnum.TASKCANCE.getCode()));
|
||||
|
||||
for (PsTaskMainVo vo : page.getRecords()) {
|
||||
if(vo.getStartDate() != null){
|
||||
vo.setNumOfDat(DateUtils.calWorkDate(vo.getCreateTime(), new Date()));
|
||||
}
|
||||
//任务作废审批
|
||||
vo.setTaskStatusDesc(approverRecordService.getLastFail(vo.getId() + "",null,List.of(ApproverTypeEnum.TASKCANCE.getCode())));
|
||||
// vo.setTaskStatusDesc(approverRecordService.getLastFail(vo.getId() + "",null, List.of(ApproverTypeEnum.TASKCANCE.getCode())));
|
||||
|
||||
//装填服务公司信息
|
||||
if (vo.getServiceCompanyId() != null){
|
||||
@ -168,6 +183,14 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
||||
vo.setBusinessTypeName(vo.getBusinessType());
|
||||
}
|
||||
|
||||
// List<PsApproverRecordVo> psApproverRecordVos = lastFailMap.get(vo.getId());
|
||||
// if (psApproverRecordVos != null && !psApproverRecordVos.isEmpty()) {
|
||||
// PsApproverRecordVo record = psApproverRecordVos.get(0);
|
||||
// String s = record != null && StringUtils.equals(ApproverStatusEnum.FAIL.getCode(), record.getApproverStatus())
|
||||
// ? record.getApproverDesc() : null;
|
||||
// vo.setTaskStatusDesc(s);
|
||||
// }
|
||||
|
||||
vo.setPsContractBusinesses(busMap.get(vo.getContractCode() + "_" + vo.getServiceCompanyId()));
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where cc.company_id = ${companyId}
|
||||
</select>
|
||||
|
||||
<select id="selectListByContractCodeAndComanyId" resultType="com.pusong.business.domain.vo.PsContractBusinessDetailVo">
|
||||
<select id="selectListByContractCodeAndCompanyId" resultType="com.pusong.business.domain.vo.PsContractBusinessDetailVo">
|
||||
select
|
||||
detail.*,
|
||||
bus.company_id
|
||||
from ps_contract_business bus
|
||||
left join ps_contract_business_detail detail on bus.id = detail.business_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -16,10 +16,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<collection columnPrefix="appoint_" property="psTaskAppointVoList" ofType="com.pusong.business.domain.vo.PsTaskAppointVo" >
|
||||
</collection>
|
||||
|
||||
<collection property="psTaskAppointVoList" javaType="ArrayList"
|
||||
column="mainid" ofType="com.pusong.business.domain.vo.PsTaskAppointVo"
|
||||
select="queryByMainId" fetchType="eager">
|
||||
</collection>
|
||||
<!-- <collection property="psTaskAppointVoList" javaType="ArrayList"-->
|
||||
<!-- column="mainid" ofType="com.pusong.business.domain.vo.PsTaskAppointVo"-->
|
||||
<!-- select="queryByMainId" fetchType="eager">-->
|
||||
<!-- </collection>-->
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user