Commit 018ee398 authored by chase's avatar chase

fixbug

parent 35e17785
...@@ -53,11 +53,11 @@ public class FileTypesServiceImpl { ...@@ -53,11 +53,11 @@ public class FileTypesServiceImpl {
fileTypes.setCreateTime(new Date()); fileTypes.setCreateTime(new Date());
fileTypes.setCreator(authUserHelper.getCurrentAuditor().get()); fileTypes.setCreator(authUserHelper.getCurrentAuditor().get());
fileTypes.setCreatorId(authUserHelper.getCurrentUserId()); fileTypes.setCreatorId(authUserHelper.getCurrentUserId());
Long id = fileTypesMapper.insert(fileTypes); int num = fileTypesMapper.insert(fileTypes);
if (id > 0) { if (num > 0) {
OperationLogFileType actionEntity = buildOperationLogFileType(); OperationLogFileType actionEntity = buildOperationLogFileType();
actionEntity.setOperationAction("新增"); actionEntity.setOperationAction("新增");
actionEntity.setId(id.toString()); actionEntity.setId(fileTypes.getId().toString());
actionEntity.setUpdateState(fileTypes.toString()); actionEntity.setUpdateState(fileTypes.toString());
boolean result = operationLogFileTypeService.addFileTypesList(actionEntity); boolean result = operationLogFileTypeService.addFileTypesList(actionEntity);
if (result) { if (result) {
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
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;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper; import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.TaxDocumentMapper; import pwc.taxtech.atms.dao.TaxDocumentMapper;
import pwc.taxtech.atms.dto.TaxDocumentDto; import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.entity.OperationLogTaxDocument; import pwc.taxtech.atms.entity.OperationLogTaxDocument;
import pwc.taxtech.atms.entity.TaxDocument; import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.TaxDocumentExample; import pwc.taxtech.atms.entity.TaxDocumentExample;
import pwc.taxtech.atms.vat.entity.FileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -19,9 +28,8 @@ import java.net.HttpURLConnection; ...@@ -19,9 +28,8 @@ import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Calendar; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
...@@ -41,14 +49,37 @@ public class TaxDocumentServiceImpl { ...@@ -41,14 +49,37 @@ public class TaxDocumentServiceImpl {
@Autowired @Autowired
private OperationLogTaxDocServiceImpl operationLogTaxDocService; private OperationLogTaxDocServiceImpl operationLogTaxDocService;
@Autowired
ReportFileUploadService reportFileUploadService;
@Autowired
DidiFileUploadService didiFileUploadService;
@Autowired @Autowired
private OrganizationServiceImpl organizationService; private OrganizationServiceImpl organizationService;
public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto) { public List<TaxDocument> selectTaxDocumentList(TaxDocumentDto taxDocumentDto) {
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(getExample(taxDocumentDto)); List<TaxDocument> dataList = taxDocumentMapper.selectByExample(getExample(taxDocumentDto));
return taxDocuments; DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(dataList.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList()));
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
Map<String,String> urlMap = null;
if(CollectionUtils.isNotEmpty(uploadDetail.getList())){
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
}
if(urlMap!=null){
for(TaxDocument data:dataList){
data.setFilePositionUrl(urlMap.get(data.getFileUploadId()));
}
} }
return dataList;
}
/** /**
* 根据条件查询 * 根据条件查询
* *
...@@ -134,8 +165,24 @@ public class TaxDocumentServiceImpl { ...@@ -134,8 +165,24 @@ public class TaxDocumentServiceImpl {
} }
@Transactional @Transactional
public synchronized boolean addTaxDocumentList(TaxDocument taxDocument) { public synchronized boolean addTaxDocumentList(MultipartFile file, TaxDocument taxDocument) {
try { try {
//上传文件
if(StringUtils.isBlank(taxDocument.getFileUploadId())){
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
if(ReportFileUploadEnum.ReportType.MAPPING.containsKey(taxDocument.getFileType())){
ReportFileUpload reportFileUpload = new ReportFileUpload();
reportFileUpload.setOrgId(taxDocument.getCompanyId());
reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name());
String period = String.valueOf(taxDocument.getOwnTime()).substring(0,6);
reportFileUpload.setPeriod(Integer.valueOf(period));
reportFileUpload.setFileUploadId(fileUpload.getUid());
reportFileUpload.setReportType(taxDocument.getFileType());
reportFileUploadService.saveData(file,reportFileUpload);
}
}
//设置创建人 创建时间信息 设置年份区分 //设置创建人 创建时间信息 设置年份区分
taxDocument.setCreateTime(new Date()); taxDocument.setCreateTime(new Date());
taxDocument.setUpdateTime(new Date()); taxDocument.setUpdateTime(new Date());
...@@ -143,12 +190,12 @@ public class TaxDocumentServiceImpl { ...@@ -143,12 +190,12 @@ public class TaxDocumentServiceImpl {
taxDocument.setCreatorId(authUserHelper.getCurrentUserId()); taxDocument.setCreatorId(authUserHelper.getCurrentUserId());
taxDocument.setUploadTime(new Date()); taxDocument.setUploadTime(new Date());
taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR)); taxDocument.setYearRedundancy(Calendar.getInstance().get(Calendar.YEAR));
int num = taxDocumentMapper.insert(taxDocument);
//根据公司Id 设置业务线 //根据公司Id 设置业务线
String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId()); String businessLine = organizationService.queryBusinessByCompanyId(taxDocument.getCompanyId());
if (StringUtils.isNotBlank(businessLine)) { if (StringUtils.isNotBlank(businessLine)) {
taxDocument.setBusinessLine(businessLine); taxDocument.setBusinessLine(businessLine);
} }
int num = taxDocumentMapper.insert(taxDocument);
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setId(taxDocument.getId().toString()); actionEntity.setId(taxDocument.getId().toString());
...@@ -232,8 +279,8 @@ public class TaxDocumentServiceImpl { ...@@ -232,8 +279,8 @@ public class TaxDocumentServiceImpl {
if (num > 0) { if (num > 0) {
OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument(); OperationLogTaxDocument actionEntity = buildOperationLogTaxDocument();
actionEntity.setOperationAction("修改"); actionEntity.setOperationAction("修改");
actionEntity.setId(taxDocument.getId().toString());
//设置更新值 //设置更新值
actionEntity.setOriginalState(taxDocumentMapper.selectByPrimaryKey(taxDocument.getId()).toString());
actionEntity.setUpdateState(taxDocument.toString()); actionEntity.setUpdateState(taxDocument.toString());
boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity); boolean result = operationLogTaxDocService.addTaxDocumentList(actionEntity);
if (result) { if (result) {
...@@ -298,7 +345,6 @@ public class TaxDocumentServiceImpl { ...@@ -298,7 +345,6 @@ public class TaxDocumentServiceImpl {
return false; return false;
} }
} }
public void downloadAllFile(HttpServletResponse response, List<Long> ids) { public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
String downloadName = "多选附件.zip"; String downloadName = "多选附件.zip";
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment