|
|
@ -22,14 +22,12 @@ import com.epmet.commons.tools.scan.param.ImgTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
|
import com.epmet.commons.tools.utils.EpmetRequestHolder; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
import com.epmet.dao.IcEventDao; |
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
|
import com.epmet.dto.CustomerDTO; |
|
|
|
import com.epmet.dto.IcEventDTO; |
|
|
|
import com.epmet.dto.IssueProjectCategoryDictDTO; |
|
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
|
import com.epmet.dto.IssueProjectCategoryDictDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
@ -42,6 +40,7 @@ import com.epmet.resi.group.constant.TopicConstant; |
|
|
|
import com.epmet.service.*; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -53,6 +52,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -61,7 +61,9 @@ import java.util.stream.Collectors; |
|
|
|
* @author generator generator@elink-cn.com |
|
|
|
* @since v1.0.0 2022-05-17 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
|
|
|
|
public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntity> implements IcEventService, ResultDataResolver { |
|
|
|
|
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
@ -90,6 +92,9 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
private IcEventOperationLogService icEventOperationLogService; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient userOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private OperCrmOpenFeignClient crmOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<IcEventListResultDTO> list(IcEventListFormDTO formDTO) { |
|
|
@ -103,7 +108,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); |
|
|
|
|
|
|
|
//与户主关系字典表数据
|
|
|
|
//事件管理字典表数据
|
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
|
|
|
@ -209,7 +214,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
//2.判断是否立项或转需求
|
|
|
|
//2-1.项目立项
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "1".equals(formDTO.getOperationType())) { |
|
|
|
EventToProjectResultDTO project = projectTraceService.eventToProject(formDTO.getProject()); |
|
|
|
EventToProjectResultDTO project = projectTraceService.icEventToProject(formDTO.getProject()); |
|
|
|
formDTO.setOperationId(project.getProjectId()); |
|
|
|
} |
|
|
|
//2-2.转需求
|
|
|
@ -230,6 +235,8 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
IcEventEntity entity = ConvertUtils.sourceToTarget(formDTO, IcEventEntity.class); |
|
|
|
entity.setAgencyId(gridInfo.getPid()); |
|
|
|
entity.setGridPids(gridInfo.getPids()); |
|
|
|
entity.setLatestOperatedTime(new Date()); |
|
|
|
entity.setAuditStatus(TopicConstant.AUTO_PASSED); |
|
|
|
insert(entity); |
|
|
|
//3-2.附件数据保存
|
|
|
|
List<IcEventAttachmentEntity> imageEntityList = new ArrayList<>(); |
|
|
@ -294,8 +301,7 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
} |
|
|
|
//转需求对应的操作记录
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "2".equals(formDTO.getOperationType())) { |
|
|
|
date.setTime(date.getTime() + 6000 * 1); |
|
|
|
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), date, "shift_demand", "shift_demand")); |
|
|
|
logList.add(logEntity(formDTO.getCustomerId(), entity.getId(), formDTO.getUserId(), formDTO.getDemand().getWantServiceTime(), "shift_demand", "shift_demand")); |
|
|
|
} |
|
|
|
//选择了已完成
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "closed_case".equals(formDTO.getStatus())) { |
|
|
@ -603,4 +609,350 @@ public class IcEventServiceImpl extends BaseServiceImpl<IcEventDao, IcEventEntit |
|
|
|
PageInfo<IcEventResultDTO> pageInfo = new PageInfo<>(list); |
|
|
|
return new PageData<>(list, pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-回复 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void reply(IcEventReplyFormDTO formDTO) { |
|
|
|
//1.查询事件数据 判断是否允许回复
|
|
|
|
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); |
|
|
|
if (null == entity || "1".equals(entity.getOperationType()) || "2".equals(entity.getOperationType())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前事件不允许回复"); |
|
|
|
} |
|
|
|
//2.修改事件数据
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getOperationType()) && "closed_case".equals(formDTO.getStatus())){ |
|
|
|
entity.setStatus(formDTO.getStatus()); |
|
|
|
entity.setCloseCaseTime(new Date()); |
|
|
|
} |
|
|
|
entity.setLatestOperatedTime(new Date()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
//3.新增回复数据
|
|
|
|
//获取当前工作人员缓存信息
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); |
|
|
|
} |
|
|
|
IcEventReplyEntity replyEntity = new IcEventReplyEntity(); |
|
|
|
replyEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
replyEntity.setIcEventId(formDTO.getIcEventId()); |
|
|
|
replyEntity.setFromUserId(formDTO.getUserId()); |
|
|
|
replyEntity.setContent(formDTO.getContent()); |
|
|
|
replyEntity.setUserShowName(staffInfo.getAgencyName() + "-" + staffInfo.getRealName()); |
|
|
|
icEventReplyService.insert(replyEntity); |
|
|
|
|
|
|
|
//4.判断新增或修改分类数据
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getOperationType())) { |
|
|
|
//查询分类信息
|
|
|
|
List<String> categoryList = new ArrayList<>(); |
|
|
|
categoryList.add(formDTO.getCategoryId()); |
|
|
|
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); |
|
|
|
AtomicReference<IcEventCategoryEntity> categoryEntity = null; |
|
|
|
category.getCategoryList().forEach(ca -> { |
|
|
|
if (ca.getId().equals(formDTO.getCategoryId())) { |
|
|
|
categoryEntity.set(new IcEventCategoryEntity()); |
|
|
|
categoryEntity.get().setCustomerId(formDTO.getCustomerId()); |
|
|
|
categoryEntity.get().setIcEventId(entity.getId()); |
|
|
|
categoryEntity.get().setCategoryId(ca.getId()); |
|
|
|
categoryEntity.get().setCategoryPids(ca.getPids()); |
|
|
|
categoryEntity.get().setCategoryCode(ca.getCategoryCode()); |
|
|
|
} |
|
|
|
}); |
|
|
|
IcEventCategoryEntity icEventCategory = icEventCategoryService.getByEventId(formDTO.getIcEventId()); |
|
|
|
if (null == category) { |
|
|
|
icEventCategoryService.insert(categoryEntity.get()); |
|
|
|
} else { |
|
|
|
categoryEntity.get().setId(icEventCategory.getId()); |
|
|
|
icEventCategoryService.updateById(categoryEntity.get()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//5.新增操作记录数据
|
|
|
|
IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getUserId(), new Date(), "reply", "reply"); |
|
|
|
icEventOperationLogService.insert(logEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-立项 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void icEventToProject(IcEventToProjectFormDTO formDTO) { |
|
|
|
//1.查询事件数据
|
|
|
|
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); |
|
|
|
if (null == entity || "1".equals(entity.getOperationType()) || "2".equals(entity.getOperationType())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前事件不允许立项"); |
|
|
|
} |
|
|
|
//2.调用事件立项接口
|
|
|
|
EventToProjectResultDTO project = projectTraceService.icEventToProject(formDTO); |
|
|
|
|
|
|
|
//3.更新事件数据
|
|
|
|
entity.setOperationType("1"); |
|
|
|
entity.setOperationId(project.getProjectId()); |
|
|
|
entity.setLatestOperatedTime(new Date()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
//4.新增操作记录
|
|
|
|
IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getUserId(), new Date(), "shift_project", "shift_project"); |
|
|
|
icEventOperationLogService.insert(logEntity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-转需求 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void icEventToDemand(IcDemandFormDTO formDTO) { |
|
|
|
//1.查询事件数据
|
|
|
|
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); |
|
|
|
if (null == entity || "1".equals(entity.getOperationType()) || "2".equals(entity.getOperationType())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前事件不允许转需求"); |
|
|
|
} |
|
|
|
//2.调用转需求接口
|
|
|
|
Result<DemandRecId> recIdResult = epmetHeartOpenFeignClient.icEventToDemand(formDTO); |
|
|
|
if (!recIdResult.success() || recIdResult.getData() == null) { |
|
|
|
throw new RenException(recIdResult.getCode(), recIdResult.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
//3.更新事件数据
|
|
|
|
entity.setOperationType("2"); |
|
|
|
entity.setOperationId(recIdResult.getData().getDemandRecId()); |
|
|
|
entity.setLatestOperatedTime(new Date()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
|
|
|
|
//4.新增操作记录
|
|
|
|
IcEventOperationLogEntity logEntity = logEntity(formDTO.getCustomerId(), formDTO.getIcEventId(), formDTO.getDemandUserId(), new Date(), "shift_demand", "shift_demand"); |
|
|
|
icEventOperationLogService.insert(logEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 事件分类分析-一级分类下事件数量 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<IcEventCategoryAnalysisResDTO> categoryAnalysisTotal(IcEventCategoryAnalysisFormDTO formDTO) { |
|
|
|
Result<List<IssueProjectCategoryDictDTO>> res = govIssueOpenFeignClient.queryFirstCategory(formDTO.getCustomerId()); |
|
|
|
if (!res.success() || CollectionUtils.isEmpty(res.getData())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前客户下未配置事件分类"); |
|
|
|
} |
|
|
|
int length = res.getData().get(NumConstant.ZERO).getCategoryCode().length(); |
|
|
|
formDTO.setCategoryOneLength(length); |
|
|
|
if ("agency".equals(formDTO.getOrgType())) { |
|
|
|
formDTO.setGridPids(getEventGridPids(formDTO.getOrgId())); |
|
|
|
} |
|
|
|
|
|
|
|
List<IcEventCategoryAnalysisResDTO> resList = baseDao.selectFirstCategoryTotal(formDTO); |
|
|
|
Map<String, IcEventCategoryAnalysisResDTO> resMap = resList.stream().collect(Collectors.toMap(IcEventCategoryAnalysisResDTO::getCategoryCode, Function.identity())); |
|
|
|
List<IcEventCategoryAnalysisResDTO> result = new ArrayList<>(); |
|
|
|
for (IssueProjectCategoryDictDTO dict : res.getData()) { |
|
|
|
IcEventCategoryAnalysisResDTO resultDto = ConvertUtils.sourceToTarget(dict, IcEventCategoryAnalysisResDTO.class); |
|
|
|
resultDto.setTotal(MapUtils.isNotEmpty(resMap) && resMap.containsKey(dict.getCategoryCode()) ? resMap.get(dict.getCategoryCode()).getTotal() : NumConstant.ZERO); |
|
|
|
result.add(resultDto); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-评价 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void comment(IcEventReplyFormDTO formDTO) { |
|
|
|
//1.查询事件是否存在
|
|
|
|
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); |
|
|
|
if (null == entity || !"closed_case".equals(entity.getStatus()) || StringUtils.isNotBlank(entity.getSatisfaction())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "不允许评价,事件不存在或还未办结"); |
|
|
|
} |
|
|
|
|
|
|
|
//2.判断当前评价人是否是事件创建人
|
|
|
|
if (!formDTO.getUserId().equals(entity.getCreatedBy())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "不允许评价,当前评价人不是事件创建人"); |
|
|
|
} |
|
|
|
|
|
|
|
//3.修改事件数据
|
|
|
|
entity.setCommentUserId(formDTO.getUserId()); |
|
|
|
entity.setSatisfaction(formDTO.getSatisfaction()); |
|
|
|
entity.setCommentTime(new Date()); |
|
|
|
baseDao.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-评价 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public IcEventListResultDTO detail(IcEventListFormDTO formDTO) { |
|
|
|
IcEventListResultDTO resultDTO = new IcEventListResultDTO(); |
|
|
|
//1.获取事件基本信息
|
|
|
|
List<IcEventListResultDTO> list = baseDao.icEventList(formDTO); |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
resultDTO = list.get(0); |
|
|
|
//查询网格名称(组织-网格)
|
|
|
|
List<String> gridIds = list.stream().map(IcEventListResultDTO::getGridId).collect(Collectors.toList()).stream().distinct().collect(Collectors.toList()); |
|
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
Map<String, String> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, AllGridsByUserIdResultDTO::getGridName, (key1, key2) -> key2)); |
|
|
|
|
|
|
|
//事件管理字典表数据
|
|
|
|
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.IC_EVENT_SOURCE_TYPE.getCode()); |
|
|
|
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>(); |
|
|
|
|
|
|
|
//封装数据
|
|
|
|
if (gridInfoMap.containsKey(resultDTO.getGridId())) { |
|
|
|
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(resultDTO.getSourceType())) { |
|
|
|
resultDTO.setSourceTypeName(statusMap.get(resultDTO.getSourceType())); |
|
|
|
} |
|
|
|
//每个事件对应的图片数据
|
|
|
|
List<String> imageList = new ArrayList<>(); |
|
|
|
List<String> voiceList = new ArrayList<>(); |
|
|
|
resultDTO.getAttachmentList().forEach(file -> { |
|
|
|
if ("image".equals(file.getType())) { |
|
|
|
imageList.add(file.getUrl()); |
|
|
|
} else if ("voice".equals(file.getType())) { |
|
|
|
voiceList.add(file.getUrl()); |
|
|
|
} |
|
|
|
}); |
|
|
|
resultDTO.setImageList(imageList); |
|
|
|
resultDTO.setVoiceList(voiceList); |
|
|
|
|
|
|
|
//分类信息
|
|
|
|
if(StringUtils.isNotBlank(resultDTO.getCategoryId())){ |
|
|
|
List<String> categoryList = new ArrayList<>(); |
|
|
|
categoryList.add(resultDTO.getCategoryId()); |
|
|
|
CategoryTagResultDTO category = queryCategory(formDTO.getCustomerId(), categoryList); |
|
|
|
for (IssueProjectCategoryDictDTO ca : category.getCategoryList()){ |
|
|
|
if (ca.getId().equals(resultDTO.getCategoryId())) { |
|
|
|
resultDTO.setCategoryName(ca.getParentCategoryName()+"-"+ca.getCategoryName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 事件分类分析- 饼图2,直属下级 事件数量 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<IcEventAnalysisOrgResDTO> analysisOrgTotal(IcEventCategoryAnalysisFormDTO formDTO) { |
|
|
|
List<IcEventAnalysisOrgResDTO> list = new ArrayList<>(); |
|
|
|
if ("grid".equals(formDTO.getOrgType())) { |
|
|
|
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); |
|
|
|
if (null == gridInfoCache) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "网格信息查询异常"); |
|
|
|
} |
|
|
|
IcEventAnalysisOrgResDTO grid = ConvertUtils.sourceToTarget(formDTO,IcEventAnalysisOrgResDTO.class); |
|
|
|
grid.setOrgName(gridInfoCache.getGridName()); |
|
|
|
grid.setTotal(baseDao.selectGridTotal(formDTO.getOrgId())); |
|
|
|
list.add(grid); |
|
|
|
return list; |
|
|
|
} |
|
|
|
Result<List<SubOrgResDTO>> subOrgListRes = govOrgOpenFeignClient.subOrgList(formDTO.getOrgId()); |
|
|
|
if (!subOrgListRes.success() || CollectionUtils.isEmpty(subOrgListRes.getData())) { |
|
|
|
return list; |
|
|
|
} |
|
|
|
for (SubOrgResDTO org : subOrgListRes.getData()) { |
|
|
|
IcEventAnalysisOrgResDTO resultDto = ConvertUtils.sourceToTarget(org, IcEventAnalysisOrgResDTO.class); |
|
|
|
resultDto.setTotal(baseDao.selectOrgTotal(org.getOrgId(), org.getOrgType())); |
|
|
|
list.add(resultDto); |
|
|
|
} |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 定时任务自动评价 |
|
|
|
* @param formDTO |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/18 16:35 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void autoEvaluation(AutoEvaluationFormDTO formDTO) { |
|
|
|
List<String> customerIds = new ArrayList<>(); |
|
|
|
if (StringUtils.isBlank(formDTO.getCustomerId())){ |
|
|
|
Result<List<CustomerDTO>> allCustomerList = crmOpenFeignClient.getAllCustomerList(); |
|
|
|
if (!allCustomerList.success()){ |
|
|
|
throw new EpmetException("查询所有客户失败"); |
|
|
|
} |
|
|
|
List<CustomerDTO> data = allCustomerList.getData(); |
|
|
|
customerIds.addAll(data.stream().map(m -> m.getId()).collect(Collectors.toList())); |
|
|
|
}else { |
|
|
|
customerIds.add(formDTO.getCustomerId()); |
|
|
|
} |
|
|
|
customerIds.forEach(c -> { |
|
|
|
autoEvaluationDispose(c); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Desc: 处理未评价的icEvent |
|
|
|
* @param customerId |
|
|
|
* @author zxc |
|
|
|
* @date 2022/5/18 16:52 |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void autoEvaluationDispose(String customerId){ |
|
|
|
Integer no = NumConstant.ONE; |
|
|
|
Integer size = NumConstant.ONE_HUNDRED; |
|
|
|
List<String> ids = new ArrayList<>(); |
|
|
|
do { |
|
|
|
int start = (no - NumConstant.ONE) * size; |
|
|
|
ids = baseDao.getAutoEvaluationIds(customerId,start,size); |
|
|
|
// 批量更新
|
|
|
|
baseDao.updateAutoEvaluation(ids); |
|
|
|
no++; |
|
|
|
}while (ids.size() == size); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author sun |
|
|
|
* @Description 事件管理-处理进展 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public LinkedList<IcEventProcessListResultDTO> process(IcEventReplyFormDTO formDTO) { |
|
|
|
LinkedList<IcEventProcessListResultDTO> resultList = new LinkedList<IcEventProcessListResultDTO>(); |
|
|
|
//1.查询事件基础信息
|
|
|
|
IcEventEntity entity = baseDao.selectById(formDTO.getIcEventId()); |
|
|
|
if (null == entity) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "事件不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
//2.查询事件回复信息
|
|
|
|
LinkedList<IcEventProcessListResultDTO> event = icEventReplyService.getByEventId(formDTO.getIcEventId()); |
|
|
|
|
|
|
|
|
|
|
|
//3.判断查询事件项目进展或需求进展信息
|
|
|
|
//项目进展
|
|
|
|
if ("1".equals(entity.getOperationType())) { |
|
|
|
ProcessListV2FormDTO processListV2FormDTO = new ProcessListV2FormDTO(); |
|
|
|
processListV2FormDTO.setProjectId(entity.getOperationId()); |
|
|
|
List<ProcessListV2ResultDTO> project = projectTraceService.processListV2(processListV2FormDTO); |
|
|
|
resultList.addAll(ConvertUtils.sourceToTarget(project, IcEventProcessListResultDTO.class)); |
|
|
|
} |
|
|
|
//需求进展
|
|
|
|
if ("2".equals(entity.getOperationType())) { |
|
|
|
LinkedList<IcEventProcessListResultDTO> demand = icEventOperationLogService.getByEventId(formDTO.getIcEventId()); |
|
|
|
resultList.addAll(demand); |
|
|
|
} |
|
|
|
resultList.addAll(event); |
|
|
|
|
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |