提交 67f773fb authored 作者: zhoushaopan's avatar zhoushaopan

feat(配发模块): 业务完结,修改业务文件,新增日志

业务完结,修改业务文件,新增日志
上级 0286b350
......@@ -1034,6 +1034,12 @@ public class AllotBillController {
return ResponseEntity.ok(allotBillService.getFileList(taskId));
}
@PostMapping("/updateFiles")
@ApiOperation("修改业务中的文件")
public ResponseEntity updateFiles(@RequestBody UpdateFilesVO updateFilesVO){
return ResponseEntity.ok(allotBillService.updateFiles(updateFilesVO));
}
//递归取出最大目录
......
......@@ -2,6 +2,7 @@ package com.tykj.dev.device.allot.service;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.allot.subject.vo.UpdateFilesVO;
import com.tykj.dev.device.file.entity.FileRet;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -66,4 +67,11 @@ public interface AllotBillService {
* @return
*/
Map<String,List<FileRet>> getFileList(Integer taskId);
/**
* 修改业务中的文件
* @param updateFilesVO
* @return
*/
AllotBill updateFiles(UpdateFilesVO updateFilesVO);
}
......@@ -10,13 +10,19 @@ import com.tykj.dev.device.allot.repository.AllotBillDao;
import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.allot.subject.vo.UpdateFilesVO;
import com.tykj.dev.device.file.entity.FileRet;
import com.tykj.dev.device.file.service.FilesUtil;
import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.vo.TaskFileRet;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.aspectj.util.FileUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
......@@ -24,12 +30,10 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
import java.util.concurrent.CompletableFuture;
/**
......@@ -53,6 +57,9 @@ public class AllotBillServiceImpl implements AllotBillService {
@Autowired
TaskService taskService;
@Resource
private TaskLogService taskLogService;
@Override
public AllotBill addEntity(AllotBill allotBillEntity) {
AllotBill allotBill = allotBillDao.save(allotBillEntity);
......@@ -151,6 +158,76 @@ public class AllotBillServiceImpl implements AllotBillService {
return map;
}
@Override
public AllotBill updateFiles(UpdateFilesVO updateFilesVO) {
//操作人
Integer currentUserId = userUtils.getCurrentUserId();
Integer taskId = updateFilesVO.getTaskId();
//查询任务对象
TaskBto taskBto = taskService.get(taskId);
//拿到业务对象
Integer billId = taskBto.getBillId();
AllotBill allotBill = getOne(billId);
//存储单据
//发件方单据
FileRet sendFile = updateFilesVO.getSendFile();
TaskLogBto taskLogBto = new TaskLogBto();
String remark = "";
if (sendFile != null){
//先拿到之前的单据
String sendFiles = allotBill.getSendFiles();
//从数据库拿到的单据
List<FileRet> fileRets = FilesUtil.stringFileToList(sendFiles);
//应该拿到最新的 如 a->b->c 此时应该拿c
FileRet fileRet = fileRets.get(fileRets.size() - 1);
TaskFileRet taskFileRet = new TaskFileRet();
BeanUtils.copyProperties(fileRet,taskFileRet);
taskLogBto.setTaskFileRet(taskFileRet);
//和现在的单据进行合并
fileRets.add(sendFile);
TaskFileRet updateFile = new TaskFileRet();
BeanUtils.copyProperties(sendFile,updateFile);
taskLogBto.setUpdateTaskFile(updateFile);
//在存储
allotBill.setSendFiles(FilesUtil.stringFileToList(fileRets));
//日志描述
remark= "修改回执单";
}
//收件方单据
FileRet receiveFile = updateFilesVO.getReceiveFile();
if (receiveFile != null){
//先拿到之前的单据
String receiveFiles = allotBill.getReceiveFiles();
//从数据库拿到的单据
List<FileRet> fileRets = FilesUtil.stringFileToList(receiveFiles);
//应该拿到最新的 如 a->b->c 此时应该拿c
FileRet fileRet = fileRets.get(fileRets.size() - 1);
TaskFileRet taskFileRet = new TaskFileRet();
BeanUtils.copyProperties(fileRet,taskFileRet);
taskLogBto.setTaskFileRet(taskFileRet);
//和现在的单据进行合并
fileRets.add(receiveFile);
TaskFileRet updateFile = new TaskFileRet();
BeanUtils.copyProperties(receiveFile,updateFile);
taskLogBto.setUpdateTaskFile(updateFile);
//在存储
allotBill.setReceiveFiles(FilesUtil.stringFileToList(fileRets));
//日志描述
remark= "修改签收单";
}
//保存业务
AllotBill update = update(allotBill);
//保存日志
taskLogBto.setCreateUserId(currentUserId);
taskLogBto.setOldStatus(taskBto.getBillStatus());
taskLogBto.setRemark(remark);
taskLogBto.setCreateTime(new Date());
taskLogBto.setOldStatus(taskBto.getBillStatus());
taskLogBto.setTaskId(taskId);
taskLogService.addLog(taskLogBto);
return update;
}
/**
* @param allotBillSelectVo 查询vo
* 查询统一筛选器
......
package com.tykj.dev.device.allot.subject.vo;
import com.tykj.dev.device.file.entity.FileRet;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author zsp
*/
@Data
@ApiModel("修改文件通用vo")
public class UpdateFilesVO {
@ApiModelProperty(value = "任务id")
private Integer taskId;
@ApiModelProperty(value = "发件方回执单")
private FileRet sendFile;
@ApiModelProperty(value = "收件方签收单")
private FileRet receiveFile;
@ApiModelProperty(value = "业务类型")
private Integer businessType;
}
package com.tykj.dev.device.task.subject.bto;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.library.subject.vo.ScriptSaveVo;
import com.tykj.dev.device.task.subject.domin.TaskLog;
import com.tykj.dev.device.task.subject.vo.TaskFileRet;
import com.tykj.dev.device.task.subject.vo.TaskLogUserVo;
import com.tykj.dev.device.user.subject.entity.User;
import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.JacksonUtil;
import com.tykj.dev.misc.utils.SpringUtils;
import io.swagger.annotations.ApiModelProperty;
import jdk.internal.org.objectweb.asm.TypeReference;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
......@@ -25,6 +30,7 @@ import java.util.Objects;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TaskLogBto {
@ApiModelProperty(name = "主键id")
......@@ -48,6 +54,12 @@ public class TaskLogBto {
@ApiModelProperty(value = "存放旧状态")
private Integer oldStatus;
@ApiModelProperty(value = "源文件")
private TaskFileRet taskFileRet;
@ApiModelProperty(value = "修改后的文件")
private TaskFileRet updateTaskFile;
public TaskLogBto(Integer taskId, String remark, List<FileVo> fileVoList) {
......@@ -96,6 +108,9 @@ public class TaskLogBto {
}
}
taskLog.setFileDetail(stringBuffer.toString());
//处理文件
taskLog.setTaskFileRets(JacksonUtil.toJSon(this.getTaskFileRet()));
taskLog.setUpdateTaskFile(JacksonUtil.toJSon(this.getUpdateTaskFile()));
return taskLog;
}
......
package com.tykj.dev.device.task.subject.domin;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tykj.dev.device.library.subject.vo.FileVo;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.task.subject.vo.TaskFileRet;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.utils.JacksonUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -90,6 +93,12 @@ public class TaskLog {
@ApiModelProperty(value = "存放旧状态")
private Integer oldStatus;
@ApiModelProperty(value = "源文件")
private String taskFileRets;
@ApiModelProperty(value = "修改后的文件")
private String updateTaskFile;
/**
* do类转化为bto类
*/
......@@ -122,6 +131,17 @@ public class TaskLog {
}
}
taskLogBto.setFileVoList(fileVos);
//处理文件
if (this.getTaskFileRets() != null){
TaskFileRet taskFileRet = JacksonUtil.readValue(this.getTaskFileRets(), new TypeReference<TaskFileRet>() {
});
taskLogBto.setTaskFileRet(taskFileRet);
}
if (this.getUpdateTaskFile() != null){
TaskFileRet taskFileRet = JacksonUtil.readValue(this.getUpdateTaskFile(), new TypeReference<TaskFileRet>() {
});
taskLogBto.setUpdateTaskFile(taskFileRet);
}
return taskLogBto;
}
......
package com.tykj.dev.device.task.subject.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName FileRet.java
* @Description TODO
* @createTime 2020年08月03日 18:03:00
*/
@AllArgsConstructor
@NoArgsConstructor
@Data
@ApiModel(value = "任务文件上传返回对象", description = "任务文件上传返回对象")
public class TaskFileRet {
/**
* 上传文件名称
*/
private String name;
/**
* 文件路径
*/
private String filePath;
/**
* 预览地址
*/
private String previewPath;
}
......@@ -41,4 +41,10 @@ public class TaskLogUserVo {
@ApiModelProperty(value = "存放旧状态")
private Integer oldStatus;
@ApiModelProperty(value = "源文件")
private TaskFileRet taskFileRet;
@ApiModelProperty(value = "修改后的文件")
private TaskFileRet updateTaskFile;
}
......@@ -114,6 +114,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/packageVersion/getVersion","/equip/packageVersion/getVersion").permitAll()//
.antMatchers("/equip/file/llq/**").permitAll()
.antMatchers("/code/**","/equip/code/**").permitAll()
.antMatchers("/upload").permitAll()
.antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
// .withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>() {
// @Override
......
......@@ -57,9 +57,6 @@ public class QRCodeUtils {
zxingTaskVo = new ZxingTaskVo(task.getParentTaskId(), task.getId());
}
return zxingTaskVo;
// System.out.println("图片中内容: ");
// System.out.println("content: " + result.getText());
// content = result.getText();
} catch (IOException e) {
e.printStackTrace();
} catch (NotFoundException e) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论