|
|
|
@ -6,7 +6,6 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
import cn.hutool.core.lang.Opt; |
|
|
|
import cn.hutool.core.lang.Opt; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.EnumUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
import com.alibaba.excel.ExcelWriter; |
|
|
|
@ -14,10 +13,12 @@ import com.alibaba.excel.write.metadata.WriteSheet; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.alibaba.fastjson2.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
import com.biutag.supervision.common.UserContextHolder; |
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
import com.biutag.supervision.constants.AppConstants; |
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
import com.biutag.supervision.constants.enums.*; |
|
|
|
import com.biutag.supervision.flow.action.ApplyCompletionAction; |
|
|
|
import com.biutag.supervision.flow.action.ApplyCompletionAction; |
|
|
|
|
|
|
|
import com.biutag.supervision.mapper.ComplaintCollectionMapper; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.Result; |
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
import com.biutag.supervision.pojo.domain.Blame; |
|
|
|
import com.biutag.supervision.pojo.dto.NegativeDto; |
|
|
|
import com.biutag.supervision.pojo.dto.NegativeDto; |
|
|
|
@ -27,10 +28,8 @@ import com.biutag.supervision.pojo.dto.complaintCollection.ComplaintCollectionPe |
|
|
|
import com.biutag.supervision.pojo.dto.complaintCollection.ComplaintCollectionRepeatDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.complaintCollection.ComplaintCollectionRepeatDTO; |
|
|
|
import com.biutag.supervision.pojo.dto.flow.VerifyData; |
|
|
|
import com.biutag.supervision.pojo.dto.flow.VerifyData; |
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
import com.biutag.supervision.pojo.entity.*; |
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionClosingStatusEnum; |
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.*; |
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionHandleMethodEnum; |
|
|
|
import com.biutag.supervision.pojo.enums.negative.NegativeSourceTypeEnum; |
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionInitialEnum; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionPublicApprovalEnum; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.enums.supDict.SupDictEnum; |
|
|
|
import com.biutag.supervision.pojo.enums.supDict.SupDictEnum; |
|
|
|
import com.biutag.supervision.pojo.model.UserAuth; |
|
|
|
import com.biutag.supervision.pojo.model.UserAuth; |
|
|
|
import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionExistParam; |
|
|
|
import com.biutag.supervision.pojo.param.ComplaintCollection.ComplaintCollectionExistParam; |
|
|
|
@ -68,8 +67,6 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import com.biutag.supervision.pojo.enums.complaintCollection.*; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.enums.negative.NegativeSourceTypeEnum; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
@ -93,6 +90,7 @@ import java.util.stream.Stream; |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class ComplaintCollectionServiceImpl implements ComplaintCollectionService { |
|
|
|
public class ComplaintCollectionServiceImpl implements ComplaintCollectionService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ComplaintCollectionMapper complaintCollectionMapper; |
|
|
|
private final ComplaintCollectionResourceService complaintCollectionResourceService; |
|
|
|
private final ComplaintCollectionResourceService complaintCollectionResourceService; |
|
|
|
private final SupDictDataService supDictDataService; |
|
|
|
private final SupDictDataService supDictDataService; |
|
|
|
private final ComplaintCollectionBlameResourceService complaintCollectionBlameResourceService; |
|
|
|
private final ComplaintCollectionBlameResourceService complaintCollectionBlameResourceService; |
|
|
|
@ -142,13 +140,15 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic |
|
|
|
complaintCollection.setCreateTime(LocalDateTime.now()); |
|
|
|
complaintCollection.setCreateTime(LocalDateTime.now()); |
|
|
|
complaintCollection.setCreateBy(UserContextHolder.getCurrentUser().getUserName()); |
|
|
|
complaintCollection.setCreateBy(UserContextHolder.getCurrentUser().getUserName()); |
|
|
|
complaintCollection.setGwf3(ComplaintCollectionInitialEnum.UN_UPLOADED.getCode()); |
|
|
|
complaintCollection.setGwf3(ComplaintCollectionInitialEnum.UN_UPLOADED.getCode()); |
|
|
|
Boolean res = complaintCollectionResourceService.createComplaintCollection(Arrays.asList(complaintCollection)); |
|
|
|
|
|
|
|
Assert.notNull(complaintCollection.getId(), "主表插入后未获取到ID"); |
|
|
|
|
|
|
|
saveThingFilesOrThrow(complaintCollection.getId(), request.getThingFiles()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 同步创建 Negative
|
|
|
|
// 同步创建 Negative
|
|
|
|
NegativeDto negativeDto = buildNegativeDtoFromComplaintCollection(complaintCollection, request); |
|
|
|
NegativeDto negativeDto = buildNegativeDtoFromComplaintCollection(complaintCollection, request); |
|
|
|
negativeService.save(negativeDto); |
|
|
|
Negative negative = negativeService.save(negativeDto); |
|
|
|
|
|
|
|
complaintCollection.setNegativeId(negative.getId()); |
|
|
|
|
|
|
|
// 创建主信息
|
|
|
|
|
|
|
|
Boolean res = complaintCollectionResourceService.createComplaintCollection(Arrays.asList(complaintCollection)); |
|
|
|
|
|
|
|
Assert.notNull(complaintCollection.getId(), "主表插入后未获取到ID"); |
|
|
|
|
|
|
|
saveThingFilesOrThrow(complaintCollection.getId(), request.getThingFiles()); |
|
|
|
return Result.success(res); |
|
|
|
return Result.success(res); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -301,6 +301,67 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic |
|
|
|
return Result.success(complaintCollectionPageVo); |
|
|
|
return Result.success(complaintCollectionPageVo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Page<ComplaintCollectionPageDTO> getComplaintCollectionPageNew(ComplaintCollectionPageRequest request) { |
|
|
|
|
|
|
|
ComplaintCollectionQueryParam param = ComplaintCollectionTransfer.INSTANCE.pageRequestToPageParam(request); |
|
|
|
|
|
|
|
if (request.getInitialReviewFileList().contains(ComplaintCollectionInitialEnum.UPLOADED.getCode())){ |
|
|
|
|
|
|
|
param.getInitialReviewFileList().add(ComplaintCollectionInitialEnum.TIMEOUT_UPLOAD.getCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
UserAuth user = UserContextHolder.getCurrentUser(); |
|
|
|
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType()) && (user.getRoleCodes().isEmpty() || user.getAuthSources().isEmpty() || user.getAuthDepartIds().isEmpty())) { |
|
|
|
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!AppConstants.USER_TYPE_SUPER.equals(user.getUserType())) { |
|
|
|
|
|
|
|
if (user.getRoleCodes().contains(RoleCodeEnum.SECOND_ADMIN.getCode()) |
|
|
|
|
|
|
|
|| user.getRoleCodes().contains(RoleCodeEnum.ADMIN_1_12337.getCode())) { |
|
|
|
|
|
|
|
List<String> orgIds = departService.getAllNodeIds(user.getAuthDepartIds()); |
|
|
|
|
|
|
|
Set<String> visibleSecondIds = new HashSet<>(orgIds); |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(request.getSecondDepartId())) { |
|
|
|
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getSecondDepartId())); |
|
|
|
|
|
|
|
visibleSecondIds.retainAll(new HashSet<>(reqAllIds)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(visibleSecondIds)) { |
|
|
|
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
param.setSecondDepartIds(visibleSecondIds); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (user.getRoleCodes().contains(RoleCodeEnum.THREE_ADMIN.getCode())) { |
|
|
|
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (StrUtil.isNotBlank(request.getSecondDepartId())) { |
|
|
|
|
|
|
|
List<String> reqAllIds = departService.getAllNodeIds(List.of(request.getSecondDepartId())); |
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(reqAllIds)) { |
|
|
|
|
|
|
|
param.setSecondDepartIds(new HashSet<>(reqAllIds)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setTotal(0).setRecords(new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Page<ComplaintCollection> page = new Page<>(param.getCurrent(), param.getSize()); |
|
|
|
|
|
|
|
IPage<ComplaintCollection> pageResult = complaintCollectionMapper.selectPageWithConditions(page, param); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ComplaintCollectionPageDTO> list = pageResult.getRecords().stream().map(item -> { |
|
|
|
|
|
|
|
ComplaintCollectionPageDTO dto = new ComplaintCollectionPageDTO(); |
|
|
|
|
|
|
|
BeanUtil.copyProperties(item, dto); |
|
|
|
|
|
|
|
return dto; |
|
|
|
|
|
|
|
}).toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 字典翻译和超时信息填充
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list)) { |
|
|
|
|
|
|
|
Map<String, String> dictLabelMap = buildDictLabelMap(SupDictEnum.SUSPECT_PROBLEM.getCode()); |
|
|
|
|
|
|
|
Map<String, String> sfssDictLabelMap = buildDictLabelMap(SupDictEnum.SFSS_SOURCE_TABLE.getCode()); |
|
|
|
|
|
|
|
list.forEach(one -> { |
|
|
|
|
|
|
|
one.setInvolveProblemStr(CodeTranslateUtil.translateCodesToLabels(one.getInvolveProblem(), dictLabelMap)); |
|
|
|
|
|
|
|
String sourceTable = CodeTranslateUtil.translateCodesToLabels(one.getSourceTable(), sfssDictLabelMap); |
|
|
|
|
|
|
|
String sourceTableSubOne = CodeTranslateUtil.translateCodesToLabels(one.getSourceTableSubOne(), sfssDictLabelMap); |
|
|
|
|
|
|
|
one.setSourceTablePath(sourceTable + "/" + sourceTableSubOne); |
|
|
|
|
|
|
|
fillCheckTimeoutInfo(one); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return new Page<ComplaintCollectionPageDTO>().setRecords(list).setTotal(pageResult.getTotal()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Deprecated |
|
|
|
@Deprecated |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|