|
|
@@ -1,5 +1,6 @@
|
|
|
package com.management.platform.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
@@ -11,6 +12,7 @@ import com.management.platform.entity.*;
|
|
|
import com.management.platform.entity.bo.QueryTaskChargePage;
|
|
|
import com.management.platform.entity.vo.OtherTaskFileInfoVO;
|
|
|
import com.management.platform.entity.vo.TaskFileChargePageVO;
|
|
|
+import com.management.platform.entity.vo.TokenVo;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
import com.management.platform.util.ExcelUtil;
|
|
|
@@ -38,6 +40,7 @@ import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.Period;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -104,6 +107,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
@Autowired
|
|
|
private InformationMapper informationMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ThirdPartyInterfaceMapper thirdPartyInterfaceMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg getExecutorPanel(Integer projectId) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
@@ -1160,4 +1166,50 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getTaskListByToken(String json) {
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ TokenVo tokenVo = JSON.parseObject(json, TokenVo.class);
|
|
|
+ String token = tokenVo.getToken();
|
|
|
+ List<ThirdPartyInterface> thirdPartyInterfaceList = thirdPartyInterfaceMapper.selectList(new QueryWrapper<ThirdPartyInterface>().eq("token", token));
|
|
|
+ if(thirdPartyInterfaceList.size()==0){
|
|
|
+ //msg.setError("token错误");
|
|
|
+ msg.setError(MessageUtils.message("other.tokenError"));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ ThirdPartyInterface thirdPartyInterface = thirdPartyInterfaceList.get(0);
|
|
|
+ if(LocalDateTime.now().isAfter(thirdPartyInterface.getExpireTime())){
|
|
|
+ //msg.setError("token过期失效");
|
|
|
+ msg.setError(MessageUtils.message("other.tokenOverdue"));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ if(null==tokenVo.getTaskType()){
|
|
|
+ msg.setError("taskType can not be empty");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ if(null==tokenVo.getStartDate()||StringUtils.isEmpty(tokenVo.getStartDate())){
|
|
|
+ msg.setError("startDate can not be empty");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ if(null==tokenVo.getEndDate()||StringUtils.isEmpty(tokenVo.getEndDate())){
|
|
|
+ msg.setError("endDate can not be empty");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ Period between = Period.between(LocalDate.parse(tokenVo.getStartDate(), df), LocalDate.parse(tokenVo.getEndDate(), df));
|
|
|
+ if(between.getDays()>31){
|
|
|
+ msg.setError("获取日期间隙不能超过一个月");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ if(token.equals(thirdPartyInterface.getToken())){
|
|
|
+ LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<Task>().between(Task::getCreateDate,LocalDate.parse(tokenVo.getStartDate(), df),LocalDate.parse(tokenVo.getEndDate(), df)).eq(Task::getCompanyId, thirdPartyInterface.getCompanyId());
|
|
|
+ if(null!=tokenVo.getTaskType()){
|
|
|
+ queryWrapper.eq(Task::getTaskType,tokenVo.getTaskType());
|
|
|
+ }
|
|
|
+ List<Task> taskList=taskMapper.selectList(queryWrapper);
|
|
|
+ msg.data=taskList;
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|