| | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.sxkj.common.constant.WordOrderConstant; |
| | | import org.sxkj.common.utils.OrderNumUtils; |
| | | import org.sxkj.gd.workorder.entity.GdClueEventEntity; |
| | | import org.sxkj.gd.workorder.entity.GdTaskResultEntity; |
| | | import org.sxkj.gd.workorder.excel.GdClueEventExcel; |
| | |
| | | * @author lw |
| | | * @since 2026-01-14 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class GdClueEventServiceImpl extends BaseServiceImpl<GdClueEventMapper, GdClueEventEntity> implements IGdClueEventService { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine) { |
| | | public List<GdClueEventListVO> listGdClueEventByDept(Integer onlyMine, String keyword) { |
| | | Long deptId = Long.valueOf(AuthUtil.getDeptId()); |
| | | Long userId = AuthUtil.getUserId(); |
| | | Integer mine = onlyMine == null ? 0 : onlyMine; |
| | | return baseMapper.selectGdClueEventSimpleList(deptId, userId, mine); |
| | | return baseMapper.selectGdClueEventSimpleList(deptId, userId, mine, keyword); |
| | | } |
| | | |
| | | @Override |
| | |
| | | throw new RuntimeException("事件不存在"); |
| | | } |
| | | String address = GdGeoAddressUtil.getFormattedAddress(detail.getLongitude(), detail.getLatitude()); |
| | | log.info("地址:{}", address); |
| | | if (StringUtil.isNotBlank(address)) { |
| | | detail.setEventLocation(address); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public GdClueEventCountVO getGdClueEventCount() { |
| | | public GdClueEventCountVO getGdClueEventCount(String keyword) { |
| | | Long deptId = Long.valueOf(AuthUtil.getDeptId()); |
| | | Long userId = AuthUtil.getUserId(); |
| | | GdClueEventCountVO countVO = baseMapper.selectGdClueEventCount(deptId, userId); |
| | | GdClueEventCountVO countVO = baseMapper.selectGdClueEventCount(deptId, userId, keyword); |
| | | if (countVO == null) { |
| | | GdClueEventCountVO empty = new GdClueEventCountVO(); |
| | | empty.setTotalCount(0L); |
| | |
| | | clueEvent.setLongitude(distributeParam.getLongitude()); |
| | | clueEvent.setLatitude(distributeParam.getLatitude()); |
| | | clueEvent.setEventStatus(1); |
| | | String times = OrderNumUtils.initOrderNum(WordOrderConstant.EVENT_NUM_KEY); |
| | | String eventNum = WordOrderConstant.EVENT_NUM_PREFIX + times; |
| | | clueEvent.setEventNum(eventNum); |
| | | if (StringUtil.isBlank(distributeParam.getAreaCode())) { |
| | | clueEvent.setAreaCode(taskResult.getAreaCode()); |
| | | } else { |
| | |
| | | clueEvent.setCreateUser(AuthUtil.getUserId()); |
| | | clueEvent.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | | clueEvent.setCreateTime(new Date()); |
| | | clueEvent.setEventName(distributeParam.getEventName()); |
| | | if (!save(clueEvent)) { |
| | | throw new RuntimeException("事件分发失败"); |
| | | } |
| | | taskResult.setDistributeStatus(1); |
| | | taskResult.setUpdateUser(AuthUtil.getUserId()); |
| | | taskResult.setUpdateTime(new Date()); |
| | | if (!gdTaskResultService.updateById(taskResult)) { |
| | | if (!gdTaskResultService.updateTaskResultById(taskResult)) { |
| | | throw new RuntimeException("成果状态更新失败"); |
| | | } |
| | | return true; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean rejectClueEvent(GdClueEventRejectParam rejectParam) { |
| | | public boolean handleClueEvent(GdClueEventRejectParam rejectParam) { |
| | | GdClueEventEntity clueEvent = getById(rejectParam.getEventId()); |
| | | if (clueEvent == null || (clueEvent.getIsDeleted() != null && clueEvent.getIsDeleted() != 0)) { |
| | | throw new RuntimeException("事件不存在"); |
| | | } |
| | | if (clueEvent.getEventStatus() == null || clueEvent.getEventStatus() != 1) { |
| | | throw new RuntimeException("事件当前状态无法驳回"); |
| | | throw new RuntimeException("事件当前状态无法处理"); |
| | | } |
| | | clueEvent.setEventStatus(2); |
| | | Integer operateStatus = rejectParam.getEventStatus(); |
| | | if (operateStatus == null || (operateStatus != 0 && operateStatus != 1)) { |
| | | throw new RuntimeException("事件状态不正确"); |
| | | } |
| | | int targetStatus = operateStatus == 0 ? 2 : 3; |
| | | clueEvent.setEventStatus(targetStatus); |
| | | clueEvent.setUpdateUser(AuthUtil.getUserId()); |
| | | clueEvent.setUpdateTime(new Date()); |
| | | if (!updateById(clueEvent)) { |
| | | throw new RuntimeException("事件驳回失败"); |
| | | throw new RuntimeException("事件处理失败"); |
| | | } |
| | | GdTaskResultEntity taskResult = gdTaskResultService.getById(clueEvent.getResultId()); |
| | | if (taskResult == null || (taskResult.getIsDeleted() != null && taskResult.getIsDeleted() != 0)) { |
| | | throw new RuntimeException("成果不存在"); |
| | | } |
| | | taskResult.setDistributeStatus(2); |
| | | // 使用XML方式更新成果信息(更新所有字段) |
| | | taskResult.setDistributeStatus(targetStatus); |
| | | taskResult.setUpdateUser(AuthUtil.getUserId()); |
| | | taskResult.setUpdateTime(new Date()); |
| | | if (!gdTaskResultService.updateById(taskResult)) { |
| | | if (!gdTaskResultService.updateTaskResultById(taskResult)) { |
| | | throw new RuntimeException("成果状态更新失败"); |
| | | } |
| | | return true; |