任务列表优化
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")
|
@SaCheckPermission("business:task:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo<PsTaskMainVo> list(PsTaskQueryBo bo, PageQuery pageQuery) {
|
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")
|
@SaCheckPermission("business:task:list")
|
||||||
@GetMapping("/childList")
|
@GetMapping("/childList")
|
||||||
public TableDataInfo<PsTaskMainVo> childList(@Validated(QueryGroup.class) PsTaskQueryBo bo, PageQuery pageQuery) {
|
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<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, String> getLastFail(List<String> businessIds, List<String> businessTypes);
|
||||||
|
|
||||||
Map<String, List<PsApproverRecordVo>> getLastRecord(List<String> contractCodes, 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);
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * 新增审批记录
|
// * 新增审批记录
|
||||||
|
@ -149,13 +149,13 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
|||||||
*/
|
*/
|
||||||
public String getLastFail(String businessId, String contractCode, List<String> businessTypes){
|
public String getLastFail(String businessId, String contractCode, List<String> businessTypes){
|
||||||
PsApproverRecord record = baseMapper.selectOne(Wrappers.<PsApproverRecord>lambdaQuery()
|
PsApproverRecord record = baseMapper.selectOne(Wrappers.<PsApproverRecord>lambdaQuery()
|
||||||
.select(PsApproverRecord::getApproverStatus,PsApproverRecord::getApproverDesc)
|
.select(PsApproverRecord::getApproverStatus, PsApproverRecord::getApproverDesc)
|
||||||
.eq(StringUtils.isNotBlank(businessId), PsApproverRecord::getBusinessId, businessId)
|
.eq(StringUtils.isNotBlank(businessId), PsApproverRecord::getBusinessId, businessId)
|
||||||
.eq(StringUtils.isNotBlank(contractCode), PsApproverRecord::getContractCode, contractCode)
|
.eq(StringUtils.isNotBlank(contractCode), PsApproverRecord::getContractCode, contractCode)
|
||||||
.in(CollectionUtils.isNotEmpty(businessTypes), PsApproverRecord::getBusinessType, businessTypes)
|
.in(CollectionUtils.isNotEmpty(businessTypes), PsApproverRecord::getBusinessType, businessTypes)
|
||||||
.orderByDesc(PsApproverRecord::getApplyDate).last("limit 1"));
|
.orderByDesc(PsApproverRecord::getApplyDate).last("limit 1"));
|
||||||
return record!=null&&StringUtils.equals(ApproverStatusEnum.FAIL.getCode(),record.getApproverStatus())
|
return record != null && StringUtils.equals(ApproverStatusEnum.FAIL.getCode(), record.getApproverStatus())
|
||||||
?record.getApproverDesc():null;
|
? record.getApproverDesc() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getLastFail(List<String> businessIds, List<String> businessTypes){
|
public Map<String, String> getLastFail(List<String> businessIds, List<String> businessTypes){
|
||||||
@ -184,8 +184,10 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
|||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
QueryWrapper<PsApproverRecord> qw = Wrappers.query();
|
QueryWrapper<PsApproverRecord> qw = Wrappers.query();
|
||||||
qw.in("r.contract_code", contractCodes)
|
|
||||||
.in("r.business_type", businessTypes);
|
qw
|
||||||
|
.in("r.contract_code", contractCodes)
|
||||||
|
.in("r.business_type", businessTypes);
|
||||||
List<PsApproverRecordVo> record = baseMapper.getLastFail(qw);
|
List<PsApproverRecordVo> record = baseMapper.getLastFail(qw);
|
||||||
|
|
||||||
Map<String, List<PsApproverRecordVo>> map = new HashMap<>();
|
Map<String, List<PsApproverRecordVo>> map = new HashMap<>();
|
||||||
@ -195,6 +197,23 @@ public class PsApproverRecordServiceImpl implements IPsApproverRecordService {
|
|||||||
}
|
}
|
||||||
return map;
|
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.PsTaskMediaBo;
|
||||||
import com.pusong.business.domain.bo.PsTaskQueryBo;
|
import com.pusong.business.domain.bo.PsTaskQueryBo;
|
||||||
import com.pusong.business.domain.vo.*;
|
import com.pusong.business.domain.vo.*;
|
||||||
import com.pusong.business.enums.ApproverTypeEnum;
|
import com.pusong.business.enums.*;
|
||||||
import com.pusong.business.enums.ContractStatusEnum;
|
|
||||||
import com.pusong.business.enums.TaskStatusEnum;
|
|
||||||
import com.pusong.business.enums.TaskStatusEnum.AppointStatusEnum;
|
import com.pusong.business.enums.TaskStatusEnum.AppointStatusEnum;
|
||||||
import com.pusong.business.enums.TaskTypeEnum;
|
|
||||||
import com.pusong.business.mapper.*;
|
import com.pusong.business.mapper.*;
|
||||||
import com.pusong.business.service.*;
|
import com.pusong.business.service.*;
|
||||||
import com.pusong.business.service.approver.ApproverContainer;
|
import com.pusong.business.service.approver.ApproverContainer;
|
||||||
@ -123,6 +120,21 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
|||||||
// lqw.orderByAsc("assigned");
|
// lqw.orderByAsc("assigned");
|
||||||
lqw.orderByDesc("main.create_time");
|
lqw.orderByDesc("main.create_time");
|
||||||
page = baseMapper.queryTaskPageList(pageQuery.build(), lqw);
|
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);
|
fillInfo(page);
|
||||||
@ -132,30 +144,33 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fillInfo(Page<PsTaskMainVo> page) {
|
private void fillInfo(Page<PsTaskMainVo> page) {
|
||||||
String contractCode = null;
|
|
||||||
if (page.getRecords().isEmpty()){
|
if (page.getRecords().isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, List<PsContractBusinessDetailVo>> busMap = new HashMap<>();
|
Map<String, List<PsContractBusinessDetailVo>> busMap = new HashMap<>();
|
||||||
List<Long> serviceCompanyIdList = page.getRecords().stream().map(PsTaskMainVo::getServiceCompanyId).toList();
|
List<Long> serviceCompanyIdList = page.getRecords().stream().map(PsTaskMainVo::getServiceCompanyId).toList();
|
||||||
List<String> contractCodeList = page.getRecords().stream().map(PsTaskMainVo::getContractCode).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>()
|
QueryWrapper<PsContractBusiness> objectQueryWrapper = new QueryWrapper<PsContractBusiness>()
|
||||||
.in("bus.contract_code", contractCodeList)
|
.in("bus.contract_code", contractCodeList)
|
||||||
.in("bus.company_id", serviceCompanyIdList);
|
.in("bus.company_id", serviceCompanyIdList);
|
||||||
List<PsContractBusinessDetailVo> psContractBusinesses = businessMapper.selectListByContractCodeAndComanyId(objectQueryWrapper);
|
List<PsContractBusinessDetailVo> psContractBusinesses = businessMapper.selectListByContractCodeAndCompanyId(objectQueryWrapper);
|
||||||
|
|
||||||
for (PsContractBusinessDetailVo psContractBusiness : psContractBusinesses) {
|
for (PsContractBusinessDetailVo psContractBusiness : psContractBusinesses) {
|
||||||
List<PsContractBusinessDetailVo> psContractBusinesses1 = busMap.computeIfAbsent(psContractBusiness.getContractCode() + "_" + psContractBusiness.getCompanyId(), a -> new ArrayList<>());
|
List<PsContractBusinessDetailVo> psContractBusinesses1 = busMap.computeIfAbsent(psContractBusiness.getContractCode() + "_" + psContractBusiness.getCompanyId(), a -> new ArrayList<>());
|
||||||
psContractBusinesses1.add(psContractBusiness);
|
psContractBusinesses1.add(psContractBusiness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Map<String, List<PsApproverRecordVo>> lastFailMap = approverRecordService.getLastRecordByBus( taskIdList
|
||||||
|
// , List.of(ApproverTypeEnum.TASKCANCE.getCode()));
|
||||||
|
|
||||||
for (PsTaskMainVo vo : page.getRecords()) {
|
for (PsTaskMainVo vo : page.getRecords()) {
|
||||||
if(vo.getStartDate() != null){
|
if(vo.getStartDate() != null){
|
||||||
vo.setNumOfDat(DateUtils.calWorkDate(vo.getCreateTime(), new Date()));
|
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){
|
if (vo.getServiceCompanyId() != null){
|
||||||
@ -168,6 +183,14 @@ public class PsTaskServiceImpl implements IPsTaskService {
|
|||||||
vo.setBusinessTypeName(vo.getBusinessType());
|
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()));
|
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}
|
where cc.company_id = ${companyId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectListByContractCodeAndComanyId" resultType="com.pusong.business.domain.vo.PsContractBusinessDetailVo">
|
<select id="selectListByContractCodeAndCompanyId" resultType="com.pusong.business.domain.vo.PsContractBusinessDetailVo">
|
||||||
select
|
select
|
||||||
detail.*,
|
detail.*,
|
||||||
bus.company_id
|
bus.company_id
|
||||||
from ps_contract_business bus
|
from ps_contract_business bus
|
||||||
left join ps_contract_business_detail detail on bus.id = detail.business_id
|
left join ps_contract_business_detail detail on bus.id = detail.business_id
|
||||||
|
${ew.getCustomSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</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 columnPrefix="appoint_" property="psTaskAppointVoList" ofType="com.pusong.business.domain.vo.PsTaskAppointVo" >
|
||||||
</collection>
|
</collection>
|
||||||
|
|
||||||
<collection property="psTaskAppointVoList" javaType="ArrayList"
|
<!-- <collection property="psTaskAppointVoList" javaType="ArrayList"-->
|
||||||
column="mainid" ofType="com.pusong.business.domain.vo.PsTaskAppointVo"
|
<!-- column="mainid" ofType="com.pusong.business.domain.vo.PsTaskAppointVo"-->
|
||||||
select="queryByMainId" fetchType="eager">
|
<!-- select="queryByMainId" fetchType="eager">-->
|
||||||
</collection>
|
<!-- </collection>-->
|
||||||
|
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user