|
@@ -3,6 +3,7 @@ package org.springblade.business.service.impl;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -18,6 +19,7 @@ import org.springblade.business.entity.*;
|
|
import org.springblade.business.mapper.TaskMapper;
|
|
import org.springblade.business.mapper.TaskMapper;
|
|
import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
|
|
import org.springblade.business.mapper.TrialSelfInspectionRecordMapper;
|
|
import org.springblade.business.service.*;
|
|
import org.springblade.business.service.*;
|
|
|
|
+import org.springblade.business.sync.TaskSync;
|
|
import org.springblade.business.utils.FileUtils;
|
|
import org.springblade.business.utils.FileUtils;
|
|
import org.springblade.business.vo.*;
|
|
import org.springblade.business.vo.*;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
import org.springblade.common.constant.CommonConstant;
|
|
@@ -26,6 +28,7 @@ import org.springblade.common.utils.SnowFlakeUtil;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
|
+import org.springblade.core.redis.cache.BladeRedis;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
@@ -61,6 +64,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.core.SingleColumnRowMapper;
|
|
import org.springframework.jdbc.core.SingleColumnRowMapper;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -134,6 +138,13 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
StringRedisTemplate RedisTemplate;
|
|
StringRedisTemplate RedisTemplate;
|
|
|
|
+ @Autowired
|
|
|
|
+ private BladeRedis bladeRedis;
|
|
|
|
+ //异步类
|
|
|
|
+ @Autowired
|
|
|
|
+ private TaskSync taskSync;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
|
|
private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
|
|
|
|
|
|
@@ -1969,19 +1980,35 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
public R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception {
|
|
public R reSigningEVisaStatus0(List<reSigningEVisaStatus> dtos, String header) throws Exception {
|
|
R result= new R();
|
|
R result= new R();
|
|
if(dtos.size()>0){
|
|
if(dtos.size()>0){
|
|
- for (reSigningEVisaStatus dto : dtos) {
|
|
|
|
- InformationQuery iq = informationQueryService.getById(dto.getId());
|
|
|
|
- if(iq!=null){
|
|
|
|
- informationQueryService.update(new LambdaUpdateWrapper<InformationQuery>()
|
|
|
|
- .eq(InformationQuery::getId, dto.getId())
|
|
|
|
- .set(InformationQuery::getEVisaPdfUrl, null)
|
|
|
|
- .set(InformationQuery::getPdfUrl, null));
|
|
|
|
- result = this.saveNodePdf(iq.getClassify()+"", iq.getWbsId()+"", dto.getContractId()+"", dto.getProjectId()+"", header);
|
|
|
|
- if(result==null||(result!=null&&result.getCode()!=200)){
|
|
|
|
- return R.fail(iq.getName()+"重新保存PDF信息失败");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ //添加缓存
|
|
|
|
+ Set<Long> newIds = dtos.stream().map(reSigningEVisaStatus::getId).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ //随机id
|
|
|
|
+ String s = "sign-reSigningEVisaStatus0:" + SnowFlakeUtil.getId();
|
|
|
|
+
|
|
|
|
+ //数据效验
|
|
|
|
+ Set<Long> oldIds = new HashSet<>();
|
|
|
|
+ Set<String> keys = bladeRedis.keys("sign-reSigningEVisaStatus0*");
|
|
|
|
+ for (String key : keys) {
|
|
|
|
+ Set<Long> ids = bladeRedis.get(key);
|
|
|
|
+ if(ids !=null ){
|
|
|
|
+ oldIds.addAll(ids);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(CollectionUtils.isNotEmpty(oldIds)){
|
|
|
|
+ //如果旧的id中存在新的id,则不允许添加
|
|
|
|
+ long count = oldIds.stream().filter(f -> newIds.contains(f)).count();
|
|
|
|
+ if(count > 0){
|
|
|
|
+ return R.fail("当前提交数据中存在正在保存的数据,请勿重复提交");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //10分钟过期
|
|
|
|
+ bladeRedis.setEx(s,newIds, 600L);
|
|
|
|
+
|
|
|
|
+ //执行异步
|
|
|
|
+ taskSync.reSigningEVisaStatusSync(dtos,header,s);
|
|
}
|
|
}
|
|
return R.success("操作成功");
|
|
return R.success("操作成功");
|
|
}
|
|
}
|