diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/AEventsController.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/AEventsController.java index 63d4c97..a1a2f14 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/AEventsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/AEventsController.java @@ -5,29 +5,35 @@ import com.ruoyi.common.constant.Constants; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.model.LoginBody; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.framework.web.service.SysLoginService; -import com.ruoyi.pt.entity.CaseInfo; import com.ruoyi.pt.entity.CasesImport; import com.ruoyi.pt.entity.Events; import com.ruoyi.pt.entity.dto.AEventChangeIsReport; import com.ruoyi.pt.entity.dto.AMassEventsRequest; -import com.ruoyi.pt.entity.dto.ASimilarRequest; import com.ruoyi.pt.entity.response.ANew100PageResponse; import com.ruoyi.pt.entity.response.FiveEventCountResponse; import com.ruoyi.pt.service.AEventsService; -import com.ruoyi.pt.service.EventsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; +import java.util.concurrent.TimeUnit; /** * 事件控制层 + * * @author du * @since 2024/9/2 10:20 */ @@ -40,10 +46,47 @@ public class AEventsController extends BaseController { private AEventsService aEventsService; @Resource - private EventsService eventsService; + private RedisCache redisCache; @Resource private SysLoginService sysLoginService; + + /** + * 校验 + * + * @return 响应类 + */ + @GetMapping("/verify") + @ApiOperation(value = "登录获取token") + public AjaxResult verificationCode() { + LocalDate cacheObject = redisCache.getCacheObject("88888888"); + if (cacheObject != null) { + return AjaxResult.success(true); + } else { + return AjaxResult.success(false); + } + } + + /** + * 根据校验码校验 + * + * @param verificationCode 校验码 + * @return 响应类 + */ + @GetMapping("/verificationCode") + @ApiOperation(value = "根据校验码校验") + public AjaxResult verificationCode(String verificationCode) { + if (!"88888888".equals(verificationCode)) { + throw new ServiceException("试用码错误,请重试"); + } + // 获取当前日期 + LocalDate startDate = LocalDate.now(); + LocalDate endDate = startDate.plusMonths(3); + long daysBetween = ChronoUnit.DAYS.between(startDate, endDate); + redisCache.setCacheObject(verificationCode, startDate, Math.toIntExact(daysBetween), TimeUnit.DAYS); + return AjaxResult.success(); + } + /** * 登录获取token */ @@ -94,18 +137,18 @@ public class AEventsController extends BaseController { * 获取日志错误信息 */ @GetMapping("/getErrorMsg") - @ApiOperation(value = "获取日志错误信息",response = Events.class) + @ApiOperation(value = "获取日志错误信息", response = Events.class) public AjaxResult getErrorMsg(HttpServletRequest request) { String header1 = request.getHeader("clientId"); String header2 = request.getHeader("clientSecret"); - if(header1==null||header2==null){ - return AjaxResult.error(401,"请求访问:/earlyWarningAudit/massEvents/getErrorMsg,认证失败,无法访问系统资源"); - }else { - if("3YSE6O8fRACPPRVCqAlxgkhzMG+tasXXYgdDsiWPi/U=".equals(header1) - && "kdoiIv5Wn2VvPG0sSGNF9Q4SVvu3CoBy+m6e8skq3AY=".equals(header2)){ + if (header1 == null || header2 == null) { + return AjaxResult.error(401, "请求访问:/earlyWarningAudit/massEvents/getErrorMsg,认证失败,无法访问系统资源"); + } else { + if ("3YSE6O8fRACPPRVCqAlxgkhzMG+tasXXYgdDsiWPi/U=".equals(header1) + && "kdoiIv5Wn2VvPG0sSGNF9Q4SVvu3CoBy+m6e8skq3AY=".equals(header2)) { return success(aEventsService.getErrorMsg()); - }else { - return AjaxResult.error(401,"请求访问:/earlyWarningAudit/massEvents/getErrorMsg,认证失败,无法访问系统资源"); + } else { + return AjaxResult.error(401, "请求访问:/earlyWarningAudit/massEvents/getErrorMsg,认证失败,无法访问系统资源"); } } } @@ -120,7 +163,7 @@ public class AEventsController extends BaseController { @GetMapping("/colonyPage") @ApiOperation(value = "分页条件查询事件数据", response = Events.class) public AjaxResult colonyPage(Page page, AMassEventsRequest events) { - return success(aEventsService.page(page,events)); + return success(aEventsService.page(page, events)); } /** @@ -139,7 +182,7 @@ public class AEventsController extends BaseController { * 查询五种事件待审核个数 */ @GetMapping("/fiveEventCount") - @ApiOperation(value = "查询五种事件待审核个数",response = FiveEventCountResponse.class) + @ApiOperation(value = "查询五种事件待审核个数", response = FiveEventCountResponse.class) public AjaxResult fiveEventCount() { return success(aEventsService.fiveEventCount()); } @@ -160,7 +203,7 @@ public class AEventsController extends BaseController { */ @GetMapping("/getByInnerEventId/{innerEventId}") @ApiOperation(value = "根据事件的innerEventId查询事件详情", response = Events.class) - public AjaxResult getByInnerEventId( @PathVariable String innerEventId) { + public AjaxResult getByInnerEventId(@PathVariable String innerEventId) { return success(aEventsService.getByInnerEventId(innerEventId)); } @@ -170,7 +213,7 @@ public class AEventsController extends BaseController { @GetMapping("/auditList/{innerEventId}") @ApiOperation(value = "根据事件的innerEventId分页查询审核工单列表", response = CasesImport.class) public AjaxResult auditList(Page page, @PathVariable String innerEventId) { - return success(aEventsService.auditList(page,innerEventId)); + return success(aEventsService.auditList(page, innerEventId)); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java index 3a7cfd9..d47ea87 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/controller/RemoteCallsController.java @@ -3,6 +3,7 @@ package com.ruoyi.pt.controller; import cn.hutool.core.date.LocalDateTimeUtil; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.pt.entity.dto.NoPassEventListDTO; import com.ruoyi.pt.service.CasesImportService; import com.ruoyi.pt.service.RemoteCallsService; import io.swagger.annotations.Api; @@ -123,16 +124,16 @@ public class RemoteCallsController extends BaseController { */ @ApiOperation(value = "过滤审核不通过的事件列表") @GetMapping("/noPassEventList") - public AjaxResult noPassEventList() { - // 获取当前时间 - LocalDateTime now = LocalDateTime.now(); - // 获取当前时间的上一个小时 - LocalDateTime lastHour = now.minusHours(1); + public AjaxResult noPassEventList(NoPassEventListDTO dto) { +// // 获取当前时间 +// LocalDateTime now = LocalDateTime.now(); +// // 获取当前时间的上一个小时 +// LocalDateTime lastHour = now.minusHours(1); // 获取上个小时 - LocalDateTime lastHourWholeHour = lastHour.withMinute(0).withSecond(0); + LocalDateTime lastHourWholeHour = dto.getStartTime().withMinute(0).withSecond(0); String lastHourStr = lastHourWholeHour.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); // 获取当前时间 - LocalDateTime wholeHour = now.withMinute(0).withSecond(0); + LocalDateTime wholeHour = dto.getEndTime().withMinute(0).withSecond(0); String localDateStr = wholeHour.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); remoteCallsService.noPassEventList(lastHourStr, localDateStr); return success(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/entity/dto/NoPassEventListDTO.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/entity/dto/NoPassEventListDTO.java new file mode 100644 index 0000000..96a1a52 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/entity/dto/NoPassEventListDTO.java @@ -0,0 +1,25 @@ +package com.ruoyi.pt.entity.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author wu + * @since 2024/11/12 09:19 + */ +@Data +public class NoPassEventListDTO implements Serializable { + private static final long serialVersionUID = 8846337468970694737L; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime startTime; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime endTime; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java index df07909..d2613d3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java @@ -1,7 +1,6 @@ package com.ruoyi.pt.quartz; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.io.unit.DataUnit; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.pt.entity.RemoteLog; import com.ruoyi.pt.service.RemoteCallsService; @@ -60,9 +59,9 @@ public class PushQuartz { // 过滤审核不通过的事件列表 log.info("==============过滤审核不通过的事件列表" + "============"); remoteCallsService.noPassEventList(lastHourStr, localDateStr); - // 过滤已办结的事件列表 - log.info("==============过滤已办结的事件列表" + "============"); - remoteCallsService.completionEventList(lastHourStr, localDateStr); + // todo 暂时注销 过滤已办结的事件列表 +// log.info("==============过滤已办结的事件列表" + "============"); +// remoteCallsService.completionEventList(lastHourStr, localDateStr); // 拉取社会治理中心增量事件保存到events_import表 int total = remoteCallsService.getEventDate(); remoteLog.setHqTotal(total); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/AEventsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/AEventsServiceImpl.java index c236804..c9b3de7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/AEventsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/AEventsServiceImpl.java @@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.http.HttpRequest; -import cn.hutool.json.JSONArray; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -28,7 +27,11 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 群体事件业务处理层 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java index c58b20a..994bb3b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java @@ -439,7 +439,9 @@ public class RemoteCallsServiceImpl implements RemoteCallsService { log.info("IfInstruct=2的数据条数=====================" + notPassed.size() + "========================="); if (CollectionUtil.isNotEmpty(notPassed)) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.in("innerEventId", notPassed); + wrapper.in("innerEventId", notPassed) + // todo 暂修改为只要第一次的数据 + .isNull("state"); // 设置1 events.setState(state); eventsService.update(events, wrapper); @@ -448,14 +450,18 @@ public class RemoteCallsServiceImpl implements RemoteCallsService { log.info("IfInstruct=4的数据条数=====================" + disuse.size() + "========================="); if (CollectionUtil.isNotEmpty(disuse)) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.in("innerEventId", disuse); + wrapper.in("innerEventId", disuse) + // todo 暂修改为只要第一次的数据 + .isNull("state"); events.setState(3); eventsService.update(events, wrapper); } } else { List innerEventIdList = list.stream().map(PassEventRequest::getInnerEventId).collect(Collectors.toList()); QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.in("innerEventId", innerEventIdList); + wrapper.in("innerEventId", innerEventIdList) + // todo 暂修改为只要第一次的数据 + .isNull("state"); // 设置2 events.setState(state); eventsService.update(events, wrapper); diff --git a/ruoyi-admin/src/main/resources/mapper/pt/AEventsMapper.xml b/ruoyi-admin/src/main/resources/mapper/pt/AEventsMapper.xml index f347813..81efae4 100644 --- a/ruoyi-admin/src/main/resources/mapper/pt/AEventsMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/pt/AEventsMapper.xml @@ -25,7 +25,8 @@ insert into audit @@ -120,15 +120,19 @@