1.技术监督附件上传调整
This commit is contained in:
@@ -24,7 +24,13 @@ public interface ISupvFileService extends IService<SupvFile> {
|
||||
* @author cdf
|
||||
* @date 2023/6/25
|
||||
*/
|
||||
boolean planUpload(MultipartFile file,String planId, Integer type,String attachmentType,String uploadTime);
|
||||
boolean planUpload(MultipartFile file,
|
||||
String planId,
|
||||
Integer type,
|
||||
String uploaderId,
|
||||
String uploaderName,
|
||||
String attachmentType,
|
||||
String uploadTime);
|
||||
|
||||
List<SupvFile> listFile(SupvFileParam param);
|
||||
|
||||
|
||||
@@ -53,8 +53,14 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean planUpload(MultipartFile file, String planId, Integer type,String attachmentType,String uploadTime) {
|
||||
Boolean fly=false;
|
||||
public boolean planUpload(MultipartFile file,
|
||||
String planId,
|
||||
Integer type,
|
||||
String uploaderId,
|
||||
String uploaderName,
|
||||
String attachmentType,
|
||||
String uploadTime) {
|
||||
Boolean fly;
|
||||
SupvFile supvFile = this.getOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId,planId).eq(SupvFile::getType,type).eq(SupvFile::getAttachmentType,attachmentType));
|
||||
String url = fileStorageUtil.uploadMultipart(file, OssPath.SURVEY_RESULT);
|
||||
SupvFile supvFilePO = new SupvFile();
|
||||
@@ -63,9 +69,9 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
|
||||
supvFilePO.setAttachmentType(attachmentType);
|
||||
supvFilePO.setBusiId(planId);
|
||||
supvFilePO.setType(type);
|
||||
supvFilePO.setUploaderId(RequestUtil.getUserIndex());
|
||||
supvFilePO.setUploaderId(uploaderId);
|
||||
supvFilePO.setUploadTime(DateUtil.parseLocalDateTime(uploadTime));
|
||||
supvFilePO.setUploaderName(RequestUtil.getUsername());
|
||||
supvFilePO.setUploaderName(uploaderName);
|
||||
if(Objects.nonNull(supvFile)){
|
||||
fileStorageUtil.deleteFile(supvFile.getFileUrl());
|
||||
supvFilePO.setUuid(supvFile.getUuid());
|
||||
@@ -83,7 +89,10 @@ public class SupvFileServiceImpl extends ServiceImpl<SupvFileMapper, SupvFile> i
|
||||
|
||||
@Override
|
||||
public List<SupvFile> listFile(SupvFileParam param) {
|
||||
return this.baseMapper.selectFile(param);
|
||||
if (param.getType()==0){
|
||||
return this.baseMapper.selectPlanFile(param);
|
||||
}
|
||||
return this.baseMapper.selecProblemtFile(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -322,10 +322,10 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
item.setPlanOrgName(mapCode.get(item.getPlanOrgId()).getName());
|
||||
}
|
||||
|
||||
SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0));
|
||||
if (Objects.nonNull(supvFile)) {
|
||||
item.setAttachmentName(supvFile.getAttachmentName());
|
||||
}
|
||||
// SupvFile supvFile = supvFileMapper.selectOne(new LambdaQueryWrapper<SupvFile>().eq(SupvFile::getBusiId, item.getPlanId()).eq(SupvFile::getType, 0));
|
||||
// if (Objects.nonNull(supvFile)) {
|
||||
// item.setAttachmentName(supvFile.getAttachmentName());
|
||||
// }
|
||||
|
||||
List<User> userList = userFeignClient.getUserByIdList(userIds).getData();
|
||||
Map<String, User> map = userList.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||
|
||||
@@ -233,7 +233,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口数据:" + s + "结束----!");
|
||||
Map<String, String> send = send(param, getUrl(1), "pqPlanCreate");
|
||||
// Map<String, String> send = new HashMap<>();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督工作计划数据接口响应结果:" + send + "结束----!");
|
||||
if (send.containsKey("succeed")) {
|
||||
String succeed = send.get("succeed");
|
||||
@@ -314,8 +313,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
send = send(param, getUrl(3), "pqProblemUpdate");
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 接收电能质量技术监督实施问题整改数据接口响应结果:" + send + "结束----!");
|
||||
}
|
||||
// Map<String, String> send = new HashMap<>();
|
||||
|
||||
if (send.containsKey("succeed")) {
|
||||
String succeed = send.get("succeed");
|
||||
if (succeed.indexOf("\\\"") != -1) {
|
||||
@@ -345,7 +342,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
public String pushFile(List<String> busIds) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
LambdaQueryWrapper<SupvFile> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SupvFile::getBusiId, busIds);
|
||||
lambdaQueryWrapper.in(SupvFile::getUuid, busIds);
|
||||
List<SupvFile> supvFiles = supvFileService.list(lambdaQueryWrapper);
|
||||
if (supvFiles.size() > 100) {
|
||||
throw new BusinessException("一次最多上送100条数据");
|
||||
@@ -353,7 +350,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
JSONArray objects = new JSONArray(Collections.singletonList(supvFiles));
|
||||
String s = objects.toString();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 推送附件接口:" + s + "结束----!");
|
||||
List<DictData> fileList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.file_type.getCode()).getData();
|
||||
List<DictData> fileList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.file_type.getCode().trim()).getData();
|
||||
Map<String, DictData> mapFile = fileList.stream().collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||
DictData dictData ;
|
||||
//TODO 调用上送接口
|
||||
@@ -362,7 +359,7 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
dictData = mapFile.get(supvFiles.get(i).getAttachmentType());
|
||||
supvFiles.get(i).setAttachmentType(dictData.getValue());
|
||||
}else{
|
||||
stringBuilder.append("第" + i + "次操作失败: 请检查上送附件类型是否正确");
|
||||
stringBuilder.append("第" + (i+1) + "行文件上送失败: 请检查上送附件类型是否正确;</br>");
|
||||
continue;
|
||||
}
|
||||
Map<String, String> sendFile = sendFile(getUrl(4), supvFiles.get(i));
|
||||
@@ -382,13 +379,13 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
String result = map.get("result").toString();
|
||||
Map mapCount = JSON.parseObject(result, Map.class);
|
||||
String count = mapCount.get("count").toString();
|
||||
stringBuilder.append("第" + i + "次操作成功:成功数据" + count + "条");
|
||||
stringBuilder.append("第" + (i+1) + "行文件上送失败:成功数据" + count + "条;</br>");
|
||||
} else {
|
||||
String errors = map.get("errors").toString();
|
||||
stringBuilder.append("第" + i + "次操作失败:" + status + "_" + errors);
|
||||
stringBuilder.append("第" + (i+1) + "次行文件上送失败:" + status + "_" + errors+";</br>");
|
||||
}
|
||||
} else {
|
||||
stringBuilder.append("第" + i + "次当前时间段国网上送请求过多,请稍后再试");
|
||||
stringBuilder.append("第" + (i+1)+ "行文件上送失败:当前时间段国网上送请求过多,请稍后再试;</br>");
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
@@ -410,7 +407,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口数据:" + s + "结束----!");
|
||||
Map<String, String> send = send(param, getUrl(5), "pqMonthReportCreate");
|
||||
// Map<String, String> send = new HashMap<>();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 取消电能质量技术监督工作计划接口响应结果:" + send + "结束----!");
|
||||
if (send.containsKey("succeed")) {
|
||||
String succeed = send.get("succeed");
|
||||
@@ -461,7 +457,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
String s = JSONObject.toJSONStringWithDateFormat(param, JSON.DEFFAULT_DATE_FORMAT);
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口数据:" + s + "结束----!");
|
||||
Map<String, String> send = send(param, getUrl(6), "pqPlanDelete");
|
||||
// Map<String, String> send = new HashMap<>();
|
||||
log.info(Thread.currentThread().getName() + "获取返回体 删除电能质量技术监督工作计划接口响应结果:" + send + "结束----!");
|
||||
if (send.containsKey("succeed")) {
|
||||
String succeed = send.get("succeed");
|
||||
@@ -753,9 +748,9 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
|
||||
String uploadTime = supvFile.getUploadTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||
// 设置form请求参数
|
||||
builder.putParamsMap("uuid", supvFile.getFileUrl())
|
||||
.putParamsMap("attachmentName", supvFile.getAttachmentName())
|
||||
builder.putParamsMap("uuid", supvFile.getUuid())
|
||||
.putParamsMap("provinceId", code)
|
||||
.putParamsMap("attachmentName", supvFile.getAttachmentName())
|
||||
.putParamsMap("attachmentType", supvFile.getAttachmentType())
|
||||
.putParamsMap("busiId", supvFile.getBusiId())
|
||||
.putParamsMap("uploaderName", supvFile.getUploaderName())
|
||||
|
||||
Reference in New Issue
Block a user