|
|
|
|
@ -10,21 +10,25 @@ import com.biutag.supervision.constants.AppConstants;
|
|
|
|
|
import com.biutag.supervision.constants.enums.RoleCodeEnum; |
|
|
|
|
import com.biutag.supervision.mapper.ConfinementMapper; |
|
|
|
|
import com.biutag.supervision.pojo.entity.Confinement; |
|
|
|
|
import com.biutag.supervision.pojo.entity.NegativeBlame; |
|
|
|
|
import com.biutag.supervision.pojo.model.UserAuth; |
|
|
|
|
import com.biutag.supervision.pojo.param.ConfinementQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.param.negativeBlame.NegativeBlameConfinementQueryParam; |
|
|
|
|
import com.biutag.supervision.pojo.vo.ConfinementExcelVo; |
|
|
|
|
import com.biutag.supervision.pojo.vo.ConfinementVo; |
|
|
|
|
import com.biutag.supervision.repository.negativeBlame.NegativeBlameResourceService; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@Service |
|
|
|
|
public class ConfinementService extends ServiceImpl<ConfinementMapper, Confinement> { |
|
|
|
|
|
|
|
|
|
private final SupDepartService departService; |
|
|
|
|
private final NegativeBlameResourceService negativeBlameResourceService; |
|
|
|
|
|
|
|
|
|
public Page<ConfinementVo> page(ConfinementQueryParam param) { |
|
|
|
|
QueryWrapper<Confinement> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
@ -57,8 +61,31 @@ public class ConfinementService extends ServiceImpl<ConfinementMapper, Confineme
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//todo 排序
|
|
|
|
|
|
|
|
|
|
return baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper); |
|
|
|
|
Page<ConfinementVo> confinementVoPage = baseMapper.queryPage(Page.of(param.getCurrent(), param.getSize()), queryWrapper); |
|
|
|
|
List<ConfinementVo> records = confinementVoPage.getRecords(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(records)){ |
|
|
|
|
// 所有的禁闭ID
|
|
|
|
|
Set<String> confinementIdList = records.stream().map(ConfinementVo::getId).collect(Collectors.toSet()); |
|
|
|
|
// 去negativeBlame中找negativeId
|
|
|
|
|
NegativeBlameConfinementQueryParam negativeBlameQueryParam = new NegativeBlameConfinementQueryParam(); |
|
|
|
|
negativeBlameQueryParam.setConfinementIds(confinementIdList); |
|
|
|
|
negativeBlameQueryParam.setLeadConfinementIds(confinementIdList); |
|
|
|
|
List<NegativeBlame> negativeBlames = negativeBlameResourceService.queryConfinement(negativeBlameQueryParam); |
|
|
|
|
// confinementId --- negativeId
|
|
|
|
|
Map<String, String> negativeIdMap = new HashMap<>(); |
|
|
|
|
for (NegativeBlame nb : negativeBlames) { |
|
|
|
|
if (StrUtil.isNotBlank(nb.getNegativeId())) { |
|
|
|
|
if (StrUtil.isNotBlank(nb.getConfinementId())) { |
|
|
|
|
negativeIdMap.putIfAbsent(nb.getConfinementId(), nb.getNegativeId()); |
|
|
|
|
} |
|
|
|
|
if (StrUtil.isNotBlank(nb.getLeadConfinementId())) { |
|
|
|
|
negativeIdMap.putIfAbsent(nb.getLeadConfinementId(), nb.getNegativeId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
records.forEach(one -> one.setNegativeId(negativeIdMap.get(one.getId()))); |
|
|
|
|
} |
|
|
|
|
return confinementVoPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|