|
@@ -2,11 +2,11 @@ package com.management.platform.task;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.management.platform.controller.ReportController;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.*;
|
|
import com.management.platform.entity.vo.TisTimeVO;
|
|
import com.management.platform.entity.vo.TisTimeVO;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.mapper.*;
|
|
-import com.management.platform.service.StagesService;
|
|
|
|
-import com.management.platform.service.TaskService;
|
|
|
|
|
|
+import com.management.platform.service.*;
|
|
import com.management.platform.util.MessageUtils;
|
|
import com.management.platform.util.MessageUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,6 +21,7 @@ import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -43,9 +44,13 @@ public class DataCollectTask {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private ErpOrderInfoMapper erpOrderInfoMapper;
|
|
private ErpOrderInfoMapper erpOrderInfoMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ErpOrderInfoService erpOrderInfoService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private ProjectMapper projectMapper;
|
|
private ProjectMapper projectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private UserSalaryService userSalaryService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private ProjectCategoryMapper projectCategoryMapper;
|
|
private ProjectCategoryMapper projectCategoryMapper;
|
|
@@ -64,10 +69,12 @@ public class DataCollectTask {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private FmwDetailMapper fmwDetailMapper;
|
|
private FmwDetailMapper fmwDetailMapper;
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private FinanceMonthlyWorktimeMapper financeMonthlyWorktimeMapper;
|
|
private FinanceMonthlyWorktimeMapper financeMonthlyWorktimeMapper;
|
|
- @Autowired
|
|
|
|
|
|
+ @Resource
|
|
private CompanyMapper companyMapper;
|
|
private CompanyMapper companyMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private LeaveSheetService leaveSheetService;
|
|
|
|
|
|
|
|
|
|
// private static HikariDataSource sqlServerDataSource;
|
|
// private static HikariDataSource sqlServerDataSource;
|
|
@@ -195,7 +202,7 @@ public class DataCollectTask {
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 1 * * ?")
|
|
@Scheduled(cron = "0 0 1 * * ?")
|
|
-// @Scheduled(cron = "0 05 16 * * ?")
|
|
|
|
|
|
+// @Scheduled(cron = "0 46 7 * * ?")
|
|
@Async
|
|
@Async
|
|
public void sqlServerTask() {
|
|
public void sqlServerTask() {
|
|
if(isDev){return;}
|
|
if(isDev){return;}
|
|
@@ -239,20 +246,21 @@ public class DataCollectTask {
|
|
List<ErpOrderInfo> dataList = listResponse.getBody();
|
|
List<ErpOrderInfo> dataList = listResponse.getBody();
|
|
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(dataList)){
|
|
if(org.apache.commons.collections.CollectionUtils.isNotEmpty(dataList)){
|
|
List<String> collect = dataList.stream().map(ErpOrderInfo::getMoDId).distinct().collect(Collectors.toList());
|
|
List<String> collect = dataList.stream().map(ErpOrderInfo::getMoDId).distinct().collect(Collectors.toList());
|
|
- List<String> existIds = erpOrderInfoMapper.getExistIds(collect);
|
|
|
|
- if(!CollectionUtils.isEmpty(existIds)){
|
|
|
|
- toUpdateList.addAll(dataList.stream().filter(t -> existIds.contains(t.getMoDId())).collect(Collectors.toList()));
|
|
|
|
- toAddList.addAll(dataList.stream().filter(t -> !existIds.contains(t.getMoDId())).collect(Collectors.toList()));
|
|
|
|
- }else{
|
|
|
|
- toAddList.addAll(dataList);
|
|
|
|
|
|
+ List<ErpOrderInfo> erpOrderInfos = erpOrderInfoMapper.selectList(new LambdaQueryWrapper<ErpOrderInfo>().in(ErpOrderInfo::getMoDId, collect));
|
|
|
|
+ for (ErpOrderInfo item : dataList) {
|
|
|
|
+ Optional<ErpOrderInfo> first = erpOrderInfos.stream().filter(t -> t.getMoDId().equals(item.getMoDId())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ item.setId(first.get().getId());
|
|
|
|
+ toUpdateList.add(item);
|
|
|
|
+ } else {
|
|
|
|
+ toAddList.add(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
erpOrderInfoMapper.batchInsert(toAddList);
|
|
erpOrderInfoMapper.batchInsert(toAddList);
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
- for (ErpOrderInfo orderInfo : toUpdateList) {
|
|
|
|
- erpOrderInfoMapper.updateById(orderInfo);
|
|
|
|
- }
|
|
|
|
|
|
+ erpOrderInfoService.updateBatchById(toUpdateList);
|
|
}
|
|
}
|
|
toUpdateList.clear();
|
|
toUpdateList.clear();
|
|
toAddList.clear();
|
|
toAddList.clear();
|
|
@@ -357,7 +365,7 @@ public class DataCollectTask {
|
|
}
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 0 2 * * ?")
|
|
@Scheduled(cron = "0 0 2 * * ?")
|
|
-//@Scheduled(cron = "0 43 16 * * ?")
|
|
|
|
|
|
+//@Scheduled(cron = "0 35 8 * * ?")
|
|
@Async
|
|
@Async
|
|
public void leaveSheetTask(){
|
|
public void leaveSheetTask(){
|
|
if(isDev){return;}
|
|
if(isDev){return;}
|
|
@@ -415,19 +423,103 @@ public class DataCollectTask {
|
|
List<LeaveSheet> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
List<LeaveSheet> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
if(!CollectionUtils.isEmpty(realDataList)){
|
|
if(!CollectionUtils.isEmpty(realDataList)){
|
|
List<String> collect = realDataList.stream().map(LeaveSheet::getProcinstId).distinct().collect(Collectors.toList());
|
|
List<String> collect = realDataList.stream().map(LeaveSheet::getProcinstId).distinct().collect(Collectors.toList());
|
|
- List<String> existIds = leaveSheetMapper.getExistIds(collect,specialCompanyId);
|
|
|
|
- if(!CollectionUtils.isEmpty(existIds)){
|
|
|
|
- toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- }else{
|
|
|
|
- toAddList.addAll(realDataList);
|
|
|
|
|
|
+ List<LeaveSheet> existLeaveSheetList = leaveSheetMapper.selectList(new LambdaQueryWrapper<LeaveSheet>().in(LeaveSheet::getProcinstId, collect).eq(LeaveSheet::getCompanyId, specialCompanyId));
|
|
|
|
+ List<String> existIds = existLeaveSheetList.stream().map(LeaveSheet::getProcinstId).collect(Collectors.toList());
|
|
|
|
+// List<String> existIds = leaveSheetMapper.getExistIds(collect,specialCompanyId);
|
|
|
|
+ for (LeaveSheet tmp : realDataList) {
|
|
|
|
+ Optional<LeaveSheet> first = existLeaveSheetList.stream().filter(t -> t.getProcinstId().equals(tmp.getProcinstId())).findFirst();
|
|
|
|
+ if (first.isPresent()) {
|
|
|
|
+ tmp.setId(first.get().getId());
|
|
|
|
+ toUpdateList.add(tmp);
|
|
|
|
+ } else {
|
|
|
|
+ toAddList.add(tmp);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
leaveSheetMapper.batchInsert(toAddList);
|
|
leaveSheetMapper.batchInsert(toAddList);
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
- for (LeaveSheet tmp : toUpdateList) {
|
|
|
|
- leaveSheetMapper.updateById(tmp);
|
|
|
|
|
|
+ leaveSheetService.updateBatchById(toUpdateList);
|
|
|
|
+ }
|
|
|
|
+ //自动生成审核通过的请假工时日报
|
|
|
|
+ for (LeaveSheet tmp : realDataList) {
|
|
|
|
+ //获取某人每天请假的时长合计
|
|
|
|
+ String ownerId = tmp.getOwnerId();
|
|
|
|
+ User owner = userMapper.selectById(ownerId);
|
|
|
|
+ //停用的用户不生成日报
|
|
|
|
+ if (owner.getIsActive() == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Project project = projectMapper.selectOne(new QueryWrapper<Project>().eq("project_code", "HH-GG-0000001").eq("company_id", specialCompanyId));
|
|
|
|
+ TaskGroup leaveGroup = taskGroupMapper.selectOne(new LambdaQueryWrapper<TaskGroup>().eq(TaskGroup::getProjectId, project.getId()).eq(TaskGroup::getName, "请假工时"));
|
|
|
|
+ for (LocalDate date = tmp.getStartDate(); date.compareTo(tmp.getEndDate()) <= 0; date = date.plusDays(1)) {
|
|
|
|
+ //先计算每一天的请假工时数合计
|
|
|
|
+ List<LeaveSheet> leaveSheetList = leaveSheetMapper.selectList(new LambdaQueryWrapper<LeaveSheet>()
|
|
|
|
+ .eq(LeaveSheet::getOwnerId, ownerId)
|
|
|
|
+ .eq(LeaveSheet::getCompanyId, specialCompanyId)
|
|
|
|
+ .le(LeaveSheet::getStartDate, date).gt(LeaveSheet::getEndDate, date));
|
|
|
|
+ if (!CollectionUtils.isEmpty(leaveSheetList)) {
|
|
|
|
+ double leaveHours = leaveSheetList.stream().mapToDouble(LeaveSheet::getTimeHours).sum();
|
|
|
|
+ if (leaveHours > 0) {
|
|
|
|
+ //跨天请假的
|
|
|
|
+ if (leaveHours > 8.0) {
|
|
|
|
+ leaveHours = 8.0;
|
|
|
|
+ }
|
|
|
|
+ //检查当天是否已经生成了请假工时的日报
|
|
|
|
+ List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().eq("company_id", specialCompanyId).eq("project_id", project.getId()).eq("create_date", date).eq("creator_id", ownerId));
|
|
|
|
+ //取第一条
|
|
|
|
+ Report oneReport = reportList.size() > 0?reportList.get(0):new Report();
|
|
|
|
+
|
|
|
|
+ if (oneReport.getId() != null) {
|
|
|
|
+ if (!oneReport.getWorkingTime().equals(leaveHours)) {
|
|
|
|
+ //更新时长
|
|
|
|
+ reportMapper.updateById(new Report().setId(oneReport.getId()).setWorkingTime(leaveHours));
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //生成请假工时的日报
|
|
|
|
+ Report report = new Report();
|
|
|
|
+ report.setProjectId(project.getId());
|
|
|
|
+ report.setGroupId(leaveGroup.getId());
|
|
|
|
+ report.setReportTimeType(1);
|
|
|
|
+ report.setMultiWorktime(0);
|
|
|
|
+ report.setContent("请假");
|
|
|
|
+ report.setState(1);//自动生成的审核通过
|
|
|
|
+ report.setCompanyId(specialCompanyId);
|
|
|
|
+ report.setStage("-");
|
|
|
|
+ report.setCreateDate(date);
|
|
|
|
+ report.setCreatorId(ownerId);
|
|
|
|
+ report.setDeptId(owner.getDepartmentId());
|
|
|
|
+ report.setProjectAuditState(0);
|
|
|
|
+
|
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
|
+ DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ BigDecimal hourCost = null;
|
|
|
|
+ if (owner.getCostApplyDate() != null) {
|
|
|
|
+ //检查有效期
|
|
|
|
+ if (owner.getCostApplyDate().compareTo(dtf.format(now)) > 0) {
|
|
|
|
+ //取上一个历史成本
|
|
|
|
+ List<UserSalary> list = userSalaryService.list(new QueryWrapper<UserSalary>().eq("user_id", owner.getId()).orderByDesc("indate").last("limit 2"));
|
|
|
|
+ if (list.size() > 1) {
|
|
|
|
+ hourCost = list.get(1).getCost();
|
|
|
|
+ } else {
|
|
|
|
+ //没有记录,又没有达到预设的起效时间,则默认为0
|
|
|
|
+ hourCost = new BigDecimal(0);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ hourCost = owner.getCost();
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ hourCost = owner.getCost();
|
|
|
|
+ }
|
|
|
|
+ if (hourCost == null) {
|
|
|
|
+ hourCost = new BigDecimal(0);
|
|
|
|
+ }
|
|
|
|
+ //计算工时和成本
|
|
|
|
+ report.setCost(hourCost.multiply(new BigDecimal(leaveHours)));
|
|
|
|
+ reportMapper.insert(report);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -446,9 +538,9 @@ public class DataCollectTask {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "0 30 2 * * ?")
|
|
|
|
|
|
+// @Scheduled(cron = "0 30 2 * * ?")
|
|
//@Scheduled(cron = "0 46 15 * * ?")
|
|
//@Scheduled(cron = "0 46 15 * * ?")
|
|
- @Async
|
|
|
|
|
|
+// @Async
|
|
public void sqlServerProjectTypeTask() {
|
|
public void sqlServerProjectTypeTask() {
|
|
if(isDev){return;}
|
|
if(isDev){return;}
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
@@ -584,6 +676,9 @@ public class DataCollectTask {
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
for (Project project : toAddList) {
|
|
for (Project project : toAddList) {
|
|
|
|
+ //以项目编码前五为作为分类名称
|
|
|
|
+ String categoryName = project.getProjectCode().substring(0,5);
|
|
|
|
+ project.setCategoryName(categoryName);
|
|
ProjectCategory category = projectCategoryMapper.selectOne(new LambdaQueryWrapper<ProjectCategory>()
|
|
ProjectCategory category = projectCategoryMapper.selectOne(new LambdaQueryWrapper<ProjectCategory>()
|
|
.eq(ProjectCategory::getCompanyId, specialCompanyId)
|
|
.eq(ProjectCategory::getCompanyId, specialCompanyId)
|
|
.eq(ProjectCategory::getName, project.getCategoryName())
|
|
.eq(ProjectCategory::getName, project.getCategoryName())
|
|
@@ -703,7 +798,7 @@ public class DataCollectTask {
|
|
}
|
|
}
|
|
|
|
|
|
@Scheduled(cron = "0 0 3 * * ?")
|
|
@Scheduled(cron = "0 0 3 * * ?")
|
|
-//@Scheduled(cron = "0 20 17 * * ?")
|
|
|
|
|
|
+//@Scheduled(cron = "0 57 9 * * ?")
|
|
@Async
|
|
@Async
|
|
public void businessTripTask(){
|
|
public void businessTripTask(){
|
|
if(isDev){return;}
|
|
if(isDev){return;}
|
|
@@ -724,6 +819,7 @@ public class DataCollectTask {
|
|
} else {
|
|
} else {
|
|
System.out.println("请求失败,状态码: " + sumResponse.getStatusCode());
|
|
System.out.println("请求失败,状态码: " + sumResponse.getStatusCode());
|
|
}
|
|
}
|
|
|
|
+ System.out.println("出差数据:"+totalNum);
|
|
if(totalNum > 0){
|
|
if(totalNum > 0){
|
|
int pageSize = 1000;
|
|
int pageSize = 1000;
|
|
int offset = 0;
|
|
int offset = 0;
|
|
@@ -757,35 +853,72 @@ public class DataCollectTask {
|
|
List<BusinessTrip> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
List<BusinessTrip> realDataList = dataList.stream().filter(t -> StringUtils.isNotBlank(t.getOwnerId())).collect(Collectors.toList());
|
|
if(!CollectionUtils.isEmpty(realDataList)){
|
|
if(!CollectionUtils.isEmpty(realDataList)){
|
|
List<String> collect = realDataList.stream().map(BusinessTrip::getProcinstId).distinct().collect(Collectors.toList());
|
|
List<String> collect = realDataList.stream().map(BusinessTrip::getProcinstId).distinct().collect(Collectors.toList());
|
|
- List<String> existIds = businessTripMapper.getExistIds(collect,specialCompanyId);
|
|
|
|
- if(!CollectionUtils.isEmpty(existIds)){
|
|
|
|
- toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
- }else{
|
|
|
|
- toAddList.addAll(realDataList);
|
|
|
|
|
|
+ List<BusinessTrip> existBTripList = businessTripMapper.selectList(new QueryWrapper<BusinessTrip>().in("procinst_id", collect));
|
|
|
|
+ for (BusinessTrip businessTrip : realDataList) {
|
|
|
|
+ if (existBTripList.stream().anyMatch(t -> t.getProcinstId().equals(businessTrip.getProcinstId()))) {
|
|
|
|
+ businessTrip.setId(existBTripList.stream().filter(t -> t.getProcinstId().equals(businessTrip.getProcinstId())).findFirst().get().getId());
|
|
|
|
+ toUpdateList.add(businessTrip);
|
|
|
|
+ } else {
|
|
|
|
+ toAddList.add(businessTrip);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+// if(existBTripList.size() > 0){
|
|
|
|
+// toUpdateList.addAll(realDataList.stream().filter(t -> existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
+// toAddList.addAll(realDataList.stream().filter(t -> !existIds.contains(t.getProcinstId())).collect(Collectors.toList()));
|
|
|
|
+// }else{
|
|
|
|
+// toAddList.addAll(realDataList);
|
|
|
|
+// }
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
if(!CollectionUtils.isEmpty(toAddList)){
|
|
// businessTripMapper.batchInsert(toAddList);
|
|
// businessTripMapper.batchInsert(toAddList);
|
|
for (BusinessTrip businessTrip : toAddList) {
|
|
for (BusinessTrip businessTrip : toAddList) {
|
|
businessTripMapper.insert(businessTrip);
|
|
businessTripMapper.insert(businessTrip);
|
|
- BustripProject bustripProject = new BustripProject();
|
|
|
|
- bustripProject.setBustripId(businessTrip.getId());
|
|
|
|
- Project project = projectCodeMap.get(businessTrip.getCCcxmNo());
|
|
|
|
- bustripProject.setProjectId(null == project?null:project.getId());
|
|
|
|
- bustripProject.setStartDate(businessTrip.getStartDate());
|
|
|
|
- bustripProject.setEndDate(businessTrip.getEndDate());
|
|
|
|
- bustripProjectMapper.insert(bustripProject);
|
|
|
|
|
|
+ if (!StringUtils.isEmpty(businessTrip.getCCcxmNo())) {
|
|
|
|
+ String[] split = businessTrip.getCCcxmNo().split(",");
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ Project project = projectCodeMap.get(s);
|
|
|
|
+ if (project != null) {
|
|
|
|
+ BustripProject bustripProject = new BustripProject();
|
|
|
|
+ bustripProject.setBustripId(businessTrip.getId());
|
|
|
|
+ bustripProject.setProjectId(project.getId());
|
|
|
|
+ bustripProject.setStartDate(businessTrip.getStartDate());
|
|
|
|
+ bustripProject.setEndDate(businessTrip.getEndDate());
|
|
|
|
+ bustripProjectMapper.insert(bustripProject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
if(!CollectionUtils.isEmpty(toUpdateList)){
|
|
for (BusinessTrip tmp : toUpdateList) {
|
|
for (BusinessTrip tmp : toUpdateList) {
|
|
businessTripMapper.updateById(tmp);
|
|
businessTripMapper.updateById(tmp);
|
|
|
|
+ //检查出差项目
|
|
|
|
+ if (!StringUtils.isEmpty(tmp.getCCcxmNo())) {
|
|
|
|
+ String[] split = tmp.getCCcxmNo().split(",");
|
|
|
|
+ for (String s : split) {
|
|
|
|
+ Project project = projectCodeMap.get(s);
|
|
|
|
+ if (project != null) {
|
|
|
|
+ //查找是否已经存在
|
|
|
|
+ BustripProject existBustripProject = bustripProjectMapper.selectOne(
|
|
|
|
+ new LambdaQueryWrapper<BustripProject>().eq(BustripProject::getBustripId, tmp.getId()).eq(BustripProject::getProjectId, project.getId()).between(BustripProject::getStartDate, tmp.getStartDate(), tmp.getEndDate()));
|
|
|
|
+ if (existBustripProject == null) {
|
|
|
|
+ BustripProject bustripProject = new BustripProject();
|
|
|
|
+ bustripProject.setBustripId(tmp.getId());
|
|
|
|
+ bustripProject.setProjectId(project.getId());
|
|
|
|
+ bustripProject.setStartDate(tmp.getStartDate());
|
|
|
|
+ bustripProject.setEndDate(tmp.getEndDate());
|
|
|
|
+ bustripProjectMapper.insert(bustripProject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
toUpdateList.clear();
|
|
toUpdateList.clear();
|
|
toAddList.clear();
|
|
toAddList.clear();
|
|
|
|
+ } else {
|
|
|
|
+ System.out.println("出差数据为空");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|