|
|
@@ -21,8 +21,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
-import java.time.LocalTime;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -57,6 +57,9 @@ public class FosterwxCashWorkClientController {
|
|
|
@Autowired
|
|
|
private CoralApiService coralApiService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FosterwxCashScheduleTaskMobileService fosterwxCashScheduleTaskMobileService;
|
|
|
+
|
|
|
|
|
|
@PostMapping(value = "/getTaskInfo", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
@ApiOperation(value = "返回凌晨到当前时间的未发送的数据,主体 昵称/团队id 昵称 两两一组必须有数据")
|
|
|
@@ -79,8 +82,9 @@ public class FosterwxCashWorkClientController {
|
|
|
if (null == fosterwxCashWorkwxMobile) return AjaxResult.error("该账号未划入变现分组");
|
|
|
|
|
|
LocalDate now = LocalDate.now();
|
|
|
- LocalDateTime firstDateTime = LocalDateTime.of(now, LocalTime.MIN);
|
|
|
LocalDateTime lastDateTime = LocalDateTime.now();
|
|
|
+ // 只获取一个小时前的
|
|
|
+ LocalDateTime firstDateTime = lastDateTime.minusHours(1);
|
|
|
|
|
|
LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
// 企微任务
|
|
|
@@ -95,12 +99,28 @@ public class FosterwxCashWorkClientController {
|
|
|
List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListList = fosterwxCashScheduleTaskListService.list(fosterwxCashScheduleTaskListLambdaQueryWrapper);
|
|
|
|
|
|
List<FosterwxCashBoxClientInfo> fosterwxCashBoxClientInfoList = new ArrayList<>();
|
|
|
- fosterwxCashScheduleTaskListList.forEach(fosterwxCashScheduleTaskList -> {
|
|
|
- fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
|
|
|
- setId(fosterwxCashScheduleTaskList.getId());
|
|
|
- setStatus(5);
|
|
|
- setUpdateAt(LocalDateTime.now());
|
|
|
- }});
|
|
|
+ for (FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList : fosterwxCashScheduleTaskListList) {
|
|
|
+ // fosterwxCashScheduleTaskListService.updateById(new FosterwxCashScheduleTaskList() {{
|
|
|
+ // setId(fosterwxCashScheduleTaskList.getId());
|
|
|
+ // setStatus(5);
|
|
|
+ // setUpdateAt(LocalDateTime.now());
|
|
|
+ // }});
|
|
|
+ FosterwxCashScheduleTaskMobile fosterwxCashScheduleTaskMobile = new FosterwxCashScheduleTaskMobile();
|
|
|
+ fosterwxCashScheduleTaskMobile.setTaskId(fosterwxCashScheduleTaskList.getId());
|
|
|
+ fosterwxCashScheduleTaskMobile.setGroupId(fosterwxCashScheduleTaskList.getGroupId());
|
|
|
+ fosterwxCashScheduleTaskMobile.setMobileId(fosterwxMobile.getId());
|
|
|
+ fosterwxCashScheduleTaskMobile.setStatus(2);
|
|
|
+ fosterwxCashScheduleTaskMobile.setCreateAt(LocalDateTime.now());
|
|
|
+ fosterwxCashScheduleTaskMobile.setUpdateAt(LocalDateTime.now());
|
|
|
+
|
|
|
+ // 如果已经获取到任务过了就不在获取
|
|
|
+ if (fosterwxCashScheduleTaskMobileService.count(new LambdaQueryWrapper<FosterwxCashScheduleTaskMobile>().
|
|
|
+ eq(FosterwxCashScheduleTaskMobile::getTaskId, fosterwxCashScheduleTaskList.getId()).
|
|
|
+ eq(FosterwxCashScheduleTaskMobile::getGroupId, fosterwxCashScheduleTaskList.getGroupId()).
|
|
|
+ eq(FosterwxCashScheduleTaskMobile::getMobileId, fosterwxMobile.getId())) > 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ fosterwxCashScheduleTaskMobileService.save(fosterwxCashScheduleTaskMobile);
|
|
|
|
|
|
// 获取任务详情
|
|
|
FosterwxCashWorkwxTaskList fosterwxCashWorkwxTaskList = fosterwxCashWorkwxTaskListService.getOne(new LambdaQueryWrapper<FosterwxCashWorkwxTaskList>().
|
|
|
@@ -110,8 +130,9 @@ public class FosterwxCashWorkClientController {
|
|
|
last("LIMIT 1"));
|
|
|
FosterwxCashBoxClientInfo fosterwxCashBoxClientInfo = new FosterwxCashBoxClientInfo();
|
|
|
fosterwxCashBoxClientInfo.setTaskType(fosterwxCashScheduleTaskList.getTaskType());
|
|
|
+ fosterwxCashBoxClientInfo.setId(fosterwxCashScheduleTaskMobile.getId());
|
|
|
if (3 == fosterwxCashScheduleTaskList.getTaskType()) {
|
|
|
- LambdaQueryWrapper<FosterwxCashWorkBoxClientInfo> fosterwxCashWorkBoxClientInfoLambdaQueryWrapper = new LambdaQueryWrapper<FosterwxCashWorkBoxClientInfo>();
|
|
|
+ LambdaQueryWrapper<FosterwxCashWorkBoxClientInfo> fosterwxCashWorkBoxClientInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
// fosterwxCashWorkBoxClientInfoLambdaQueryWrapper.like(FosterwxCashWorkBoxClientInfo::getWxid, fosterwxCashScheduleTaskList.getBoxGhid());
|
|
|
switch (fosterwxCashWorkwxTaskList.getBoxType()) {
|
|
|
case 8:
|
|
|
@@ -163,7 +184,7 @@ public class FosterwxCashWorkClientController {
|
|
|
}
|
|
|
|
|
|
fosterwxCashBoxClientInfoList.add(fosterwxCashBoxClientInfo);
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
return AjaxResult.success(fosterwxCashBoxClientInfoList);
|
|
|
}
|
|
|
@@ -181,7 +202,7 @@ public class FosterwxCashWorkClientController {
|
|
|
|
|
|
// 主体 手机号 组
|
|
|
if (null != handle.getCorpName() && !handle.getCorpName().isEmpty()) {
|
|
|
- // 获取主题信息
|
|
|
+ // 获取主体信息
|
|
|
Corp corp = corpService.getOne(new LambdaQueryWrapper<Corp>().eq(Corp::getName, handle.getCorpName()).last("LIMIT 1"));
|
|
|
if (null != handle.getMobileNo() && !handle.getMobileNo().isEmpty()) {
|
|
|
if (null == corp) return null;
|
|
|
@@ -211,6 +232,14 @@ public class FosterwxCashWorkClientController {
|
|
|
return fosterwxMobile;
|
|
|
}
|
|
|
|
|
|
+ // 团队id 手机号 组
|
|
|
+ if (null != handle.getMobileNo() && !handle.getMobileNo().isEmpty() && null != handle.getTeamId() && !handle.getTeamId().isEmpty()) {
|
|
|
+ fosterwxMobile = fosterwxMobileService.getOne(new LambdaQueryWrapper<FosterwxMobile>().eq(FosterwxMobile::getTeamId, handle.getTeamId()).eq(FosterwxMobile::getMobileNo, handle.getMobileNo()).last("LIMIT 1"));
|
|
|
+
|
|
|
+ if (null != fosterwxMobile)
|
|
|
+ return fosterwxMobile;
|
|
|
+ }
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
@@ -248,4 +277,15 @@ public class FosterwxCashWorkClientController {
|
|
|
|
|
|
return "新增修改成功!";
|
|
|
}
|
|
|
+
|
|
|
+ @PostMapping(value = "/changeStatus", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
+ @ApiOperation(value = "客户端返回发送状态 根据id更新状态<br>状态(1:待发送;2:发送中;3:已发送;4:已过期;5:发送失败)")
|
|
|
+ public Object changeTaskMobileStatus(FosterwxCashScheduleTaskMobile fosterwxCashScheduleTaskMobile) {
|
|
|
+ Arrays.asList(fosterwxCashScheduleTaskMobile.getIds().split(",")).forEach(id -> {
|
|
|
+ fosterwxCashScheduleTaskMobile.setId(Integer.valueOf(id));
|
|
|
+ fosterwxCashScheduleTaskMobileService.updateById(fosterwxCashScheduleTaskMobile);
|
|
|
+ });
|
|
|
+
|
|
|
+ return AjaxResult.success("更新成功!");
|
|
|
+ }
|
|
|
}
|