Commit 2e1c2f4b authored by kevin's avatar kevin

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents fc5c7c68 1f403a54
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.common.message;
public class ErrorMessage {
public static final String SaveFileError = "SaveFileError";
public static final String ParamError = "Param Error";
public static final String SystemError = "SystemError";
public static final String NoFile = "NoFile";
public static final String DidntSelectedCompany = "Didn't Selected Company";
......
package pwc.taxtech.atms.constant.enums;
import java.util.HashMap;
import java.util.Map;
public class ReportFileUploadEnum {
/**
* 报表类型
*/
public enum ReportType {
NORMAL_DECLARATION("NORMAL_DECLARATION", "增值税纳税申报表"),
CORR_DECLARATION("CORR_DECLARATION", "增值税更正申报表"),
NORMAL_TAX_RECEIPT("NORMAL_TAX_RECEIPT", "增值税纳税税票"),
CORR_TAX_RECEIPT("CORR_TAX_RECEIPT", "增值税更正税票");
private String code;
private String name;
public static final Map<String, String> MAPPING = new HashMap<>();
ReportType(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (ReportFileUploadEnum.ReportType reportType : ReportFileUploadEnum.ReportType.values()) {
MAPPING.put(reportType.getCode(), reportType.getName());
}
}
}
/**
* 来源类型
*/
public enum SuorceType {
VAT("VAT", "VAT"),
RECORD("RECORD", "档案");
private String code;
private String name;
public static final Map<String, String> MAPPING = new HashMap<>();
SuorceType(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
static {
for (ReportFileUploadEnum.SuorceType suorceType : ReportFileUploadEnum.SuorceType.values()) {
MAPPING.put(suorceType.getCode(), suorceType.getName());
}
}
}
}
package pwc.taxtech.atms.controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.input.CamelPagingResultDto;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadParam;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadResult;
import pwc.taxtech.atms.dto.reportUpload.ReportUploadParam;
import pwc.taxtech.atms.dto.reportUpload.ReportUploadResult;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.impl.ReportFileUploadService;
import pwc.taxtech.atms.service.impl.ReportUploadService;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "api/v1/reportUploadDetail")
......@@ -18,10 +24,36 @@ public class ReportUploadDetailController extends BaseController {
@Resource
private ReportUploadService reportUploadService;
@Resource
private ReportFileUploadService reportFileUploadService;
@PostMapping("queryPage")
public CamelPagingResultDto<ReportUploadResult> queryPage(@RequestBody ReportUploadParam param) {
return new CamelPagingResultDto<>(reportUploadService.queryPage(param));
}
@PostMapping("queryFileUpload")
public List<ReportFileUploadResult> queryFileUpload(@RequestBody ReportFileUploadParam param) {
return reportFileUploadService.queryData(param);
}
@ResponseBody
@PostMapping("saveFileUpload")
public OperationResultDto saveFileUpload(@RequestParam MultipartFile file, @RequestParam String sourceType,@RequestParam String reportType,@RequestParam String projectId, @RequestParam Integer period) {
try {
ReportFileUpload data = new ReportFileUpload();
data.setPeriod(period);
data.setProjectId(projectId);
data.setReportType(reportType);
data.setSourceType(sourceType);
reportFileUploadService.saveData(file,data);
return OperationResultDto.success();
} catch (ServiceException e) {
return OperationResultDto.error(e.getMessage());
} catch (Exception e) {
logger.error("upload file error.", e);
return OperationResultDto.error(ErrorMessage.SystemError);
}
}
}
package pwc.taxtech.atms.dto.reportFileUpload;
import java.io.Serializable;
public class ReportFileUploadParam implements Serializable {
private static final long serialVersionUID = -7632137418761276513L;
private String projectId;
private Integer period;
public String getProjectId() {
return projectId;
}
public Integer getPeriod() {
return period;
}
}
package pwc.taxtech.atms.dto.reportFileUpload;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
public class ReportFileUploadResult extends ReportFileUpload {
private static final long serialVersionUID = 6015878245854661752L;
public String getReportTypeStr() {
return ReportFileUploadEnum.ReportType.MAPPING.get(this.getReportType());
}
public String getSourceTypeStr() {
return ReportFileUploadEnum.SuorceType.MAPPING.get(this.getSourceType());
}
private String fileUrl;
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
}
package pwc.taxtech.atms.service.impl;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.constant.enums.ReportFileUploadEnum;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dao.UserMapper;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileIUploadParam;
import pwc.taxtech.atms.dto.didiFileUpload.DidiFileUploadDetailResult;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadParam;
import pwc.taxtech.atms.dto.reportFileUpload.ReportFileUploadResult;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.ReportFileUploadMapper;
import pwc.taxtech.atms.vat.entity.FileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUploadExample;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class ReportFileUploadService extends BaseService {
@Resource
private ReportFileUploadMapper reportFileUploadMapper;
@Autowired
protected AuthUserHelper authUserHelper;
@Resource
private UserMapper userMapper;
@Resource
private ProjectMapper projectMapper;
@Autowired
DidiFileUploadService didiFileUploadService;
public List<ReportFileUploadResult> queryData(ReportFileUploadParam param) {
ReportFileUploadExample example = new ReportFileUploadExample();
example.createCriteria().andProjectIdEqualTo(param.getProjectId()).andPeriodEqualTo(param.getPeriod());
List<ReportFileUpload> dataList = reportFileUploadMapper.selectByExample(example);
List<String> fileUploadUids = dataList.stream()
.map(o -> o.getFileUploadId()).collect(Collectors.toList());
Map<String, String> urlMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(fileUploadUids)) {
DidiFileIUploadParam fileParam = new DidiFileIUploadParam();
fileParam.setUuids(fileUploadUids);
PageInfo<DidiFileUploadDetailResult> uploadDetail = didiFileUploadService.queryPage(fileParam);
if (CollectionUtils.isNotEmpty(uploadDetail.getList())) {
urlMap = uploadDetail.getList().stream().collect(Collectors.toMap(DidiFileUploadDetailResult::getUid, didiFileUploadDetailResult -> didiFileUploadDetailResult.getViewHttpUrl()));
}
}
List<String> reportTypeList = dataList.stream()
.map(o -> o.getReportType()).collect(Collectors.toList());
if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION.getCode())) {
ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_DECLARATION.getCode());
dataList.add(upload);
}
if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_DECLARATION.getCode())) {
ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.CORR_DECLARATION.getCode());
dataList.add(upload);
}
if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT.getCode())) {
ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.NORMAL_TAX_RECEIPT.getCode());
dataList.add(upload);
}
if (!reportTypeList.contains(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT.getCode())) {
ReportFileUpload upload = new ReportFileUpload();
upload.setReportType(ReportFileUploadEnum.ReportType.CORR_TAX_RECEIPT.getCode());
dataList.add(upload);
}
List<ReportFileUploadResult> resultList = new ArrayList<ReportFileUploadResult>();
for (ReportFileUpload data : dataList) {
ReportFileUploadResult result = beanUtil.copyProperties(data, new ReportFileUploadResult());
result.setFileUrl(urlMap.get(data.getFileUploadId()));
resultList.add(result);
}
return resultList;
}
public void saveData(MultipartFile file, ReportFileUpload data) {
if (!ReportFileUploadEnum.ReportType.MAPPING.containsKey(data.getReportType())) {
throw new ServiceException(ErrorMessage.ParamError);
}
if (!ReportFileUploadEnum.SuorceType.MAPPING.containsKey(data.getSourceType())) {
throw new ServiceException(ErrorMessage.ParamError);
}
String uid = authUserHelper.getCurrentUserId();
User user = userMapper.selectByPrimaryKey(uid);
data.setCreator(user.getUserName());
Project project = projectMapper.selectByPrimaryKey(data.getProjectId());
data.setOrgId(project.getOrganizationId());
ReportFileUploadExample example = new ReportFileUploadExample();
example.createCriteria().andProjectIdEqualTo(data.getProjectId()).andPeriodEqualTo(data.getPeriod()).andReportTypeEqualTo(data.getReportType());
FileUpload fileUpload = didiFileUploadService.uploadFile(file, file.getOriginalFilename(), "ReportUpload");
data.setFileUploadId(fileUpload.getUid());
data.setUid(CommonUtils.getUUID());
data.setCreateTime(new Date());
data.setReportFileName(file.getOriginalFilename());
int updateRow = reportFileUploadMapper.updateByExample(data, example);
if (updateRow == 0) {
reportFileUploadMapper.insert(data);
}
}
}
package pwc.taxtech.atms.vat.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.vat.entity.ReportFileUpload;
import pwc.taxtech.atms.vat.entity.ReportFileUploadExample;
@Mapper
public interface ReportFileUploadMapper extends MyVatMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
long countByExample(ReportFileUploadExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
int deleteByExample(ReportFileUploadExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
int insert(ReportFileUpload record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
int insertSelective(ReportFileUpload record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
List<ReportFileUpload> selectByExampleWithRowbounds(ReportFileUploadExample example, RowBounds rowBounds);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
List<ReportFileUpload> selectByExample(ReportFileUploadExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") ReportFileUpload record, @Param("example") ReportFileUploadExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table report_file_upload
*
* @mbg.generated
*/
int updateByExample(@Param("record") ReportFileUpload record, @Param("example") ReportFileUploadExample example);
}
\ No newline at end of file
......@@ -2221,5 +2221,9 @@
"RepUploadDtlColCreator": "存档用户",
"RepUploadDtlColFileName": "计算表名称-系统生成",
"RepUploadDtlColDownload": "下载",
"RepUploadDtlColUpload": "上传",
"RepUploadDtlColReportType": "申报表类型",
"RepUploadDtlColTaxType": "税票类型",
"RepUploadDtlColSourceType": "来源",
"~MustBeEndOneApp": "我必须是最后一个!"
}
......@@ -9,7 +9,8 @@ controller('ackPaginationController', ['SweetAlert', '$scope', '$log', '$transla
totalPages: $scope.pageOptions.totalPages || 0,//总页数
maxSize: $scope.pageOptions.maxSize || 10, //分页数字的限制。
pageSize: $scope.pageOptions.pageSize || constant.page.pageSizeArrary[1], //每页多少条数据
pageSizeString: constant.page.pageSizeArrary[1].toString(),
pageSizeString: $scope.pageOptions.pageSizeString||constant.page.pageSizeArrary[1].toString(),
pagingSelection: $scope.pageOptions.pagingSelection||[],
firstPage: '<<', //$translate.instant('PagingFirstPage'),
previousPage: '<', //$translate.instant('PagingPreviousPage'),
nextPage:'>',// $translate.instant('PagingNextPage'),
......@@ -31,13 +32,15 @@ controller('ackPaginationController', ['SweetAlert', '$scope', '$log', '$transla
$scope.pagingService = {
//分页下拉组装
populatePagingSelection: function () {
var pagingSelection = [];
var pageArray = constant.page.pageSizeArrary;
for (var i = 0 ; i < pageArray.length; i++) {
var selection = { id: pageArray[i], value: pageArray[i] };
pagingSelection.push(selection);
if($scope.pageOptions.pagingSelection.length==0){
var pagingSelection = [];
var pageArray = constant.page.pageSizeArrary;
for (var i = 0 ; i < pageArray.length; i++) {
var selection = { id: pageArray[i], value: pageArray[i] };
pagingSelection.push(selection);
}
$scope.pageOptions.pagingSelection = pagingSelection;
}
$scope.pageOptions.pagingSelection = pagingSelection;
},
//分页的时候改变数字
......
vatModule.directive('vatReportUploadDetail', ['$log', 'browserService', '$translate', 'region', '$timeout',
commonModule.directive('vatReportUploadDetail', ['$log', 'browserService', '$translate', 'region', '$timeout',
function ($log, browserService, $translate, region, $timeout) {
$log.debug('vatReportUploadDetail.ctor()...');
......
......@@ -315,6 +315,70 @@
}
}
.content-container-other {
height: calc(~'100% - 40px');
position: relative;
.body {
.buttom-row {
padding: 15px;
display: inline-block;
width: 100%;
.left-side {
display: inline-block;
/*padding-left:5px;*/
.select-title {
margin-left: 20px;
}
.select-number {
padding: 0 1px;
color: red;
}
}
.right-side {
float: right;
display: inline-block;
/*padding-right:5px;*/
.btn {
margin-left: 20px;
}
}
}
.grid-container {
padding: 0px 15px;
/*height: 350px;*/
/*height:100%;*/
#invoiceGridContainer {
max-height: 100%;
}
.dx-datagrid-rowsview .dx-row > .dx-master-detail-cell {
padding: 0px !important;
}
.dx-datagrid-nowrap.dx-datagrid-headers .dx-header-row > td > .dx-datagrid-text-content {
white-space: normal !important;
}
.internal-grid-container {
padding: 10px 10px 10px 0;
& > div:first-child {
padding: 0 0 5px 10px;
font-size: 13px;
/*font-weight: bold;*/
}
}
}
}
}
.importVerifyInvoiceModal {
.modal-dialog {
height: 200px;
......
......@@ -2,12 +2,12 @@
<div class="header-title">
<div style="display:inline-block"><span class="title-name">{{'ReportUploadDetail' | translate }}</span></div>
</div>
<div class="content-container">
<div class="content-container" style="height: 60%">
<div class="body">
<div class="grid-container">
<div id="invoiceGridContainer" dx-data-grid="revenueGridOptions">
<div id="invoiceGridContainer" dx-data-grid="reportOneGridOptions">
<div data-options="dxTemplate:{ name:'editCellTemplate' }">
</div>
......@@ -22,6 +22,41 @@
</div>
<div style="height: 40%">
<div class="content-container-other" style="float:left;width:49%;">
<div class="body">
<div class="grid-container">
<div id="invoiceGridContainer1" dx-data-grid="reportTwoGridOptions">
<div data-options="dxTemplate:{ name:'editCellTemplate' }">
</div>
</div>
</div>
</div>
</div>
<div class="content-container-other" style="float:right;width:49%;">
<div class="body">
<div class="grid-container">
<div id="invoiceGridContainer2" dx-data-grid="reportThreeGridOptions">
<div data-options="dxTemplate:{ name:'editCellTemplate' }">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
......
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