Commit 5d2c5dca authored by chase's avatar chase

优化历史版本报表展示

parent e75c9f24
...@@ -5,22 +5,22 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -5,22 +5,22 @@ 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.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper; import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.constant.enums.FileUploadEnum; import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum; import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.FileTypesMapper;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper; import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.UserMapper; import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult; import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadParam; import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadParam;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadResult; import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadResult;
import pwc.taxtech.atms.entity.Project; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.ReportFileUploadMapper; import pwc.taxtech.atms.vat.dao.ReportFileUploadMapper;
import pwc.taxtech.atms.vat.entity.FileUpload; import pwc.taxtech.atms.vat.entity.FileUpload;
...@@ -46,6 +46,11 @@ public class ReportFileUploadService extends BaseService { ...@@ -46,6 +46,11 @@ public class ReportFileUploadService extends BaseService {
@Resource @Resource
private ProjectMapper projectMapper; private ProjectMapper projectMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private FileTypesMapper fileTypesMapper;
@Autowired @Autowired
DidiFileUploadService didiFileUploadService; DidiFileUploadService didiFileUploadService;
...@@ -98,6 +103,7 @@ public class ReportFileUploadService extends BaseService { ...@@ -98,6 +103,7 @@ public class ReportFileUploadService extends BaseService {
return resultList; return resultList;
} }
@Transactional
public void saveData(MultipartFile file, ReportFileUpload data) { public void saveData(MultipartFile file, ReportFileUpload data) {
if (!ReportFileUploadEnum.ReportType.MAPPING.containsKey(data.getReportType())) { if (!ReportFileUploadEnum.ReportType.MAPPING.containsKey(data.getReportType())) {
throw new ServiceException(ErrorMessage.ParamError); throw new ServiceException(ErrorMessage.ParamError);
...@@ -108,8 +114,9 @@ public class ReportFileUploadService extends BaseService { ...@@ -108,8 +114,9 @@ public class ReportFileUploadService extends BaseService {
String uid = authUserHelper.getCurrentUserId(); String uid = authUserHelper.getCurrentUserId();
User user = userMapper.selectByPrimaryKey(uid); User user = userMapper.selectByPrimaryKey(uid);
data.setCreator(user.getUserName()); data.setCreator(user.getUserName());
ReportFileUploadExample example = new ReportFileUploadExample(); data.setUid(CommonUtils.getUUID());
example.createCriteria().andProjectIdEqualTo(data.getProjectId()).andPeriodEqualTo(data.getPeriod()).andReportTypeEqualTo(data.getReportType()); data.setCreateTime(new Date());
data.setReportFileName(file.getOriginalFilename());
if (StringUtils.isBlank(data.getFileUploadId())) { if (StringUtils.isBlank(data.getFileUploadId())) {
FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), FileUploadEnum.BizSource.REPORT_UPLOAD.name()); FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), FileUploadEnum.BizSource.REPORT_UPLOAD.name());
data.setFileUploadId(fileUpload.getUid()); data.setFileUploadId(fileUpload.getUid());
...@@ -120,22 +127,32 @@ public class ReportFileUploadService extends BaseService { ...@@ -120,22 +127,32 @@ public class ReportFileUploadService extends BaseService {
List<Project> projects = projectMapper.selectByExample(projectExample); List<Project> projects = projectMapper.selectByExample(projectExample);
if(CollectionUtils.isNotEmpty(projects)){ if(CollectionUtils.isNotEmpty(projects)){
data.setProjectId(projects.get(0).getId()); data.setProjectId(projects.get(0).getId());
TaxDocument taxDocument = new TaxDocument();
taxDocument.setCompanyId(projects.get(0).getOrganizationId());
taxDocument.setFileUploadId(data.getFileUploadId());
taxDocument.setEnable("T");
taxDocument.setOwnTime(data.getPeriod());
taxDocument.setFileType(data.getReportType());
taxDocumentService.addTaxDocumentList(file,taxDocument);
} }
}else { }else {
Project project = projectMapper.selectByPrimaryKey(data.getProjectId()); Project project = projectMapper.selectByPrimaryKey(data.getProjectId());
data.setOrgId(project.getOrganizationId()); data.setOrgId(project.getOrganizationId());
TaxDocument taxDocument = new TaxDocument();
taxDocument.setCompanyId(project.getOrganizationId());
Organization organization = organizationMapper.selectByPrimaryKey(project.getOrganizationId());
taxDocument.setCompanyName(organization.getName());
taxDocument.setFileUploadId(data.getFileUploadId());
taxDocument.setEnable("T");
taxDocument.setOwnTime(data.getPeriod());
taxDocument.setFileType(data.getReportType());
taxDocument.setFileName(data.getReportFileName());
FileTypesExample example = new FileTypesExample();
example.createCriteria().andFileTypeEqualTo(data.getReportType());
List<FileTypes> dataList = fileTypesMapper.selectByExample(example);
if(CollectionUtils.isNotEmpty(dataList)){
taxDocument.setFileAttr(dataList.get(0).getFileAttr());
taxDocument.setFileTypeId(dataList.get(0).getId());
}
taxDocumentService.addTaxDocumentList(file,taxDocument);
} }
data.setUid(CommonUtils.getUUID()); ReportFileUploadExample example = new ReportFileUploadExample();
data.setCreateTime(new Date()); example.createCriteria().andProjectIdEqualTo(data.getProjectId()).andPeriodEqualTo(data.getPeriod()).andReportTypeEqualTo(data.getReportType());
data.setReportFileName(file.getOriginalFilename());
int updateRow = reportFileUploadMapper.updateByExample(data, example); int updateRow = reportFileUploadMapper.updateByExample(data, example);
if (updateRow == 0) { if (updateRow == 0) {
reportFileUploadMapper.insert(data); reportFileUploadMapper.insert(data);
......
...@@ -152,10 +152,10 @@ public class TaxDocumentServiceImpl { ...@@ -152,10 +152,10 @@ public class TaxDocumentServiceImpl {
ReportFileUpload reportFileUpload = new ReportFileUpload(); ReportFileUpload reportFileUpload = new ReportFileUpload();
reportFileUpload.setOrgId(taxDocument.getCompanyId()); reportFileUpload.setOrgId(taxDocument.getCompanyId());
reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name()); reportFileUpload.setSourceType(ReportFileUploadEnum.SuorceType.RECORD.name());
reportFileUpload.setPeriod(taxDocument.getOwnTime()); reportFileUpload.setPeriod(taxDocument.getOwnTime()/100);
reportFileUpload.setFileUploadId(fileUpload.getUid()); reportFileUpload.setFileUploadId(fileUpload.getUid());
reportFileUpload.setReportType(taxDocument.getFileType()); reportFileUpload.setReportType(taxDocument.getFileType());
reportFileUploadService.saveData(file,reportFileUpload); // reportFileUploadService.saveData(file,reportFileUpload);
} }
} }
//设置创建人 创建时间信息 设置年份区分 //设置创建人 创建时间信息 设置年份区分
......
...@@ -42,7 +42,7 @@ public class TaxDocument implements Serializable { ...@@ -42,7 +42,7 @@ public class TaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
private Integer fileTypeId; private Long fileTypeId;
/** /**
* Database Column Remarks: * Database Column Remarks:
...@@ -424,7 +424,7 @@ public class TaxDocument implements Serializable { ...@@ -424,7 +424,7 @@ public class TaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public Integer getFileTypeId() { public Long getFileTypeId() {
return fileTypeId; return fileTypeId;
} }
...@@ -436,7 +436,7 @@ public class TaxDocument implements Serializable { ...@@ -436,7 +436,7 @@ public class TaxDocument implements Serializable {
* *
* @mbg.generated * @mbg.generated
*/ */
public void setFileTypeId(Integer fileTypeId) { public void setFileTypeId(Long fileTypeId) {
this.fileTypeId = fileTypeId; this.fileTypeId = fileTypeId;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
--> -->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="file_attr" jdbcType="VARCHAR" property="fileAttr" /> <result column="file_attr" jdbcType="VARCHAR" property="fileAttr" />
<result column="file_type_id" jdbcType="INTEGER" property="fileTypeId" /> <result column="file_type_id" jdbcType="BIGINT" property="fileTypeId" />
<result column="file_type" jdbcType="VARCHAR" property="fileType" /> <result column="file_type" jdbcType="VARCHAR" property="fileType" />
<result column="description" jdbcType="VARCHAR" property="description" /> <result column="description" jdbcType="VARCHAR" property="description" />
<result column="creator_id" jdbcType="VARCHAR" property="creatorId" /> <result column="creator_id" jdbcType="VARCHAR" property="creatorId" />
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
file_type, description, creator_id, file_type, description, creator_id,
creator, create_time, update_time, creator, create_time, update_time,
status, remarks,required_field_json) status, remarks,required_field_json)
values ( #{fileAttr,jdbcType=VARCHAR}, #{fileTypeId,jdbcType=INTEGER}, values ( #{fileAttr,jdbcType=VARCHAR}, #{fileTypeId,jdbcType=BIGINT},
#{fileType,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{creatorId,jdbcType=VARCHAR}, #{fileType,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{creatorId,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{status,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},#{requiredFieldJson}) #{status,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},#{requiredFieldJson})
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
file_attr = #{record.fileAttr,jdbcType=VARCHAR}, file_attr = #{record.fileAttr,jdbcType=VARCHAR},
</if> </if>
<if test="record.fileTypeId != null"> <if test="record.fileTypeId != null">
file_type_id = #{record.fileTypeId,jdbcType=INTEGER}, file_type_id = #{record.fileTypeId,jdbcType=BIGINT},
</if> </if>
<if test="record.fileType != null"> <if test="record.fileType != null">
file_type = #{record.fileType,jdbcType=VARCHAR}, file_type = #{record.fileType,jdbcType=VARCHAR},
...@@ -293,7 +293,7 @@ ...@@ -293,7 +293,7 @@
update file_types update file_types
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
file_attr = #{record.fileAttr,jdbcType=VARCHAR}, file_attr = #{record.fileAttr,jdbcType=VARCHAR},
file_type_id = #{record.fileTypeId,jdbcType=INTEGER}, file_type_id = #{record.fileTypeId,jdbcType=BIGINT},
file_type = #{record.fileType,jdbcType=VARCHAR}, file_type = #{record.fileType,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR}, description = #{record.description,jdbcType=VARCHAR},
creator_id = #{record.creatorId,jdbcType=VARCHAR}, creator_id = #{record.creatorId,jdbcType=VARCHAR},
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
file_attr = #{fileAttr,jdbcType=VARCHAR}, file_attr = #{fileAttr,jdbcType=VARCHAR},
</if> </if>
<if test="fileTypeId != null"> <if test="fileTypeId != null">
file_type_id = #{fileTypeId,jdbcType=INTEGER}, file_type_id = #{fileTypeId,jdbcType=BIGINT},
</if> </if>
<if test="fileType != null"> <if test="fileType != null">
file_type = #{fileType,jdbcType=VARCHAR}, file_type = #{fileType,jdbcType=VARCHAR},
...@@ -357,7 +357,7 @@ ...@@ -357,7 +357,7 @@
file_attr = #{fileAttr,jdbcType=VARCHAR}, file_attr = #{fileAttr,jdbcType=VARCHAR},
</if> </if>
<if test="fileTypeId != null and fileTypeId != ''"> <if test="fileTypeId != null and fileTypeId != ''">
file_type_id = #{fileTypeId,jdbcType=INTEGER}, file_type_id = #{fileTypeId,jdbcType=BIGINT},
</if> </if>
<if test="fileType != null and fileType != ''"> <if test="fileType != null and fileType != ''">
file_type = #{fileType,jdbcType=VARCHAR}, file_type = #{fileType,jdbcType=VARCHAR},
......
...@@ -117,9 +117,12 @@ ...@@ -117,9 +117,12 @@
try { try {
if (!options.data.sourceType || "VAT" == options.data.sourceType) { if (!options.data.sourceType || "VAT" == options.data.sourceType) {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () { $("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$('#uploadDiv' + options.data.reportType).click(function(event) {
event.stopPropagation();
});
$('#uploadBut' + options.data.reportType).click(); $('#uploadBut' + options.data.reportType).click();
}).appendTo(container); }).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () { $('<div id="uploadDiv' + options.data.reportType + '"><input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () {
uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType); uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType);
}).appendTo(container); }).appendTo(container);
} }
...@@ -214,9 +217,12 @@ ...@@ -214,9 +217,12 @@
try { try {
if (!options.data.sourceType || "VAT" == options.data.sourceType) { if (!options.data.sourceType || "VAT" == options.data.sourceType) {
$("<a href='javascript:void(0)'>上传</a>").on('click', function () { $("<a href='javascript:void(0)'>上传</a>").on('click', function () {
$('#uploadDiv' + options.data.reportType).click(function(event) {
event.stopPropagation();
});
$('#uploadBut' + options.data.reportType).click(); $('#uploadBut' + options.data.reportType).click();
}).appendTo(container); }).appendTo(container);
$('<input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () { $('<div id="uploadDiv' + options.data.reportType + '"><input type="file" style="display:none;" id="uploadBut' + options.data.reportType + '" />').on('change', function () {
uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType); uploadFile($('#uploadBut' + options.data.reportType)[0].files[0], options.data.reportType);
}).appendTo(container); }).appendTo(container);
} }
...@@ -313,10 +319,10 @@ ...@@ -313,10 +319,10 @@
$scope.reportTwoDataSource = []; $scope.reportTwoDataSource = [];
$scope.reportThreeDataSource = []; $scope.reportThreeDataSource = [];
angular.forEach(res, function (data) { angular.forEach(res, function (data) {
if ("NORMAL_DECLARATION" === data.reportType || "CORR_DECLARATION" === data.reportType) { if ("增值税纳税申报表" === data.reportType || "增值税更正申报表" === data.reportType) {
$scope.reportTwoDataSource.push(data); $scope.reportTwoDataSource.push(data);
} }
if ("NORMAL_TAX_RECEIPT" === data.reportType || "CORR_TAX_RECEIPT" === data.reportType) { if ("增值税纳税税票" === data.reportType || "增值税更正税票" === data.reportType) {
$scope.reportThreeDataSource.push(data); $scope.reportThreeDataSource.push(data);
} }
}); });
......
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