Commit 69d2626e authored by chase's avatar chase

fix bug

parent ee24fd66
......@@ -19,10 +19,13 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.PageResultVo;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.FileUploadEnum;
import pwc.taxtech.atms.dto.TaxDocumentDto;
import pwc.taxtech.atms.entity.TaxDocument;
import pwc.taxtech.atms.service.impl.DidiFileUploadService;
import pwc.taxtech.atms.service.impl.TaxDocumentServiceImpl;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.entity.FileUpload;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
......@@ -39,6 +42,8 @@ public class TaxDocumentController {
@Autowired
private TaxDocumentServiceImpl taxDocumentService;
@Autowired
private DidiFileUploadService didiFileUploadService;
@PostMapping("selectList")
@ResponseBody
public PageResultVo<TaxDocument> selectTaxDocumentList(@RequestBody TaxDocumentDto taxDocumentDto) {
......@@ -51,7 +56,7 @@ public class TaxDocumentController {
@PostMapping("/queryWhetherData")
@ResponseBody
public boolean queryWhetherData(@RequestBody TaxDocument taxDocument) {
public TaxDocument queryWhetherData(@RequestBody TaxDocument taxDocument) {
return taxDocumentService.queryWhetherData(taxDocument);
}
......@@ -76,11 +81,17 @@ public class TaxDocumentController {
@PostMapping("edit")
@ResponseBody
public boolean editTaxDocument( TaxDocument taxDocument) {
public boolean editTaxDocument(TaxDocument taxDocument,
@RequestParam("file") MultipartFile file,
@RequestParam(required = false) String modual) {
//TODO 判断file是否为null 为null则不做上传和设置新url地址值 若不为null 则上传文件并设置文件url地址值
if(file!=null&&!file.isEmpty()){
FileUpload fileUpload = didiFileUploadService.uploadFile(file,file.getOriginalFilename(), FileUploadEnum.BizSource.RECORD_UPLOAD.name());
taxDocument.setFileUploadId(fileUpload.getUid());
taxDocument.setFilePositionUrl(fileUpload.getViewHttpUrl());
}
return taxDocumentService.editFilesType(taxDocument);
}
@RequestMapping("exportExcel")
@ResponseBody
public void exportExcelFile(HttpServletResponse response, @RequestBody TaxDocumentDto taxDocumentDto) {
......
......@@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.dpo.OrgCodeIdDto;
import pwc.taxtech.atms.dpo.OrgSelectDto;
import pwc.taxtech.atms.dto.revenuconf.RevTypeAddDto;
......@@ -108,9 +109,10 @@ public class RevenueTypeMappingService extends BaseService {
Sheet sheet = workbook.getSheetAt(0);
List<RevenueTypeMapping> list = new ArrayList<>();
List<OrgCodeIdDto> orgDtoList = organizationService.getMyOrgCodeList();
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
List<String> orgIds = new ArrayList<>();
for (int r = sheet.getFirstRowNum()+1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
String orgCode = row.getCell(0).getStringCellValue();
String orgCode = String.valueOf(new BigDecimal(POIUtil.getCellFormulaString(row.getCell(0))).intValue());
Optional<OrgCodeIdDto> optional = orgDtoList.stream().filter(o -> StringUtils.equals(o.getCode(), orgCode)).findFirst();
if (!optional.isPresent()) {
continue;
......@@ -118,16 +120,24 @@ public class RevenueTypeMappingService extends BaseService {
RevenueTypeMapping mapping = new RevenueTypeMapping();
mapping.setId(idService.nextId());
mapping.setOrgId(optional.get().getId());
mapping.setOuName(StringUtils.defaultString(row.getCell(1).getStringCellValue()));
mapping.setContent(StringUtils.defaultString(row.getCell(2).getStringCellValue()));
mapping.setTaxRate(new BigDecimal(row.getCell(3).getNumericCellValue()));
mapping.setRevenueTypeName(StringUtils.defaultString(row.getCell(4).getStringCellValue()));
mapping.setStartDate(StringUtils.defaultString(row.getCell(5).getStringCellValue()));
mapping.setEndDate(StringUtils.defaultString(row.getCell(6).getStringCellValue(), DEFAULT_END_DATE));
orgIds.add(optional.get().getId());
mapping.setOuName(POIUtil.getCellFormulaString(row.getCell(1)));
mapping.setContent(POIUtil.getCellFormulaString(row.getCell(2)));
mapping.setTaxRate(new BigDecimal(POIUtil.getCellFormulaString(row.getCell(3))));
mapping.setRevenueTypeName(POIUtil.getCellFormulaString(row.getCell(4)));
mapping.setStartDate(POIUtil.getCellFormulaString(row.getCell(5)));
mapping.setEndDate(StringUtils.defaultString(POIUtil.getCellFormulaString(row.getCell(6)), DEFAULT_END_DATE));
mapping.setStatus(0);
mapping.setCreateBy("Admin");
mapping.setUpdateBy("Admin");
list.add(mapping);
}
if (1 == type) {
//todo 覆盖导入 具体覆盖哪些
if(CollectionUtils.isNotEmpty(orgIds)){
RevenueTypeMappingExample delExample = new RevenueTypeMappingExample();
delExample.createCriteria().andOrgIdIn(orgIds);
typeMappingMapper.deleteByExample(delExample);
}
}
if (!CollectionUtils.isEmpty(list)) {
List<List<RevenueTypeMapping>> batchList = CommonUtils.subListWithLen(list, CommonUtils.BATCH_NUM_2000);
......
......@@ -161,6 +161,7 @@ public class TaxDocumentServiceImpl {
if (StringUtils.isNotBlank(taxDocumentDto.getCreator())) {
criteria.andCreatorLike("%" + taxDocumentDto.getCreator() + "%");
}
example.setOrderByClause("create_time DESC");
return example;
}
......@@ -331,7 +332,7 @@ public class TaxDocumentServiceImpl {
* @param taxDocument
* @return
*/
public boolean queryWhetherData(TaxDocument taxDocument) {
public TaxDocument queryWhetherData(TaxDocument taxDocument) {
try {
//简单参数校验
/* if (StringUtils.isAnyBlank(taxDocumentDto.getFileAttr(), taxDocumentDto.getFileName(),
......@@ -347,12 +348,12 @@ public class TaxDocumentServiceImpl {
criteria.andOwnTimeEqualTo(taxDocument.getOwnTime());
List<TaxDocument> taxDocuments = taxDocumentMapper.selectByExample(taxDocumentExample);
if (null != taxDocuments && taxDocuments.size() > 0) {
return false;
return taxDocuments.get(0);
}
return true;
return new TaxDocument();
} catch (Exception e) {
// log.error("TaxDocumentServiceImpl queryWhetherData error :" + e.getMessage());
return false;
return new TaxDocument();
}
}
public void downloadAllFile(HttpServletResponse response, List<Long> ids) {
......
package pwc.taxtech.atms.vat.entity;
import pwc.taxtech.atms.entity.BaseEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import pwc.taxtech.atms.entity.BaseEntity;
/**
*
......@@ -110,41 +110,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
*/
private Integer status;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.create_by
*
* @mbg.generated
*/
private String createBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.update_by
*
* @mbg.generated
*/
private String updateBy;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.create_time
*
* @mbg.generated
*/
private Date createTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column revenue_type_mapping.update_time
*
* @mbg.generated
*/
private Date updateTime;
/**
* This field was generated by MyBatis Generator.
......@@ -370,101 +335,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.create_by
*
* @return the value of revenue_type_mapping.create_by
*
* @mbg.generated
*/
public String getCreateBy() {
return createBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.create_by
*
* @param createBy the value for revenue_type_mapping.create_by
*
* @mbg.generated
*/
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.update_by
*
* @return the value of revenue_type_mapping.update_by
*
* @mbg.generated
*/
public String getUpdateBy() {
return updateBy;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.update_by
*
* @param updateBy the value for revenue_type_mapping.update_by
*
* @mbg.generated
*/
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.create_time
*
* @return the value of revenue_type_mapping.create_time
*
* @mbg.generated
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.create_time
*
* @param createTime the value for revenue_type_mapping.create_time
*
* @mbg.generated
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column revenue_type_mapping.update_time
*
* @return the value of revenue_type_mapping.update_time
*
* @mbg.generated
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column revenue_type_mapping.update_time
*
* @param updateTime the value for revenue_type_mapping.update_time
*
* @mbg.generated
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
......@@ -487,10 +357,6 @@ public class RevenueTypeMapping extends BaseEntity implements Serializable {
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", status=").append(status);
sb.append(", createBy=").append(createBy);
sb.append(", updateBy=").append(updateBy);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
......
......@@ -403,7 +403,6 @@
SELECT
id,file_attr, file_type
FROM file_types
WHERE status = 1
ORDER BY file_attr
</select>
</mapper>
\ No newline at end of file
......@@ -414,38 +414,23 @@
</if>
</select>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.RevenueTypeMapping">
insert into revenue_type_mapping (id, org_id, ou_name,
content, tax_rate, revenue_type_name,
start_date, end_date, `status`
<if test="createBy != null">
,create_by
</if>
<if test="updateBy != null">
,update_by
</if>
<if test="createTime != null">
,create_time
</if>
<if test="updateTime != null">
,update_time
</if>) values
<foreach collection="list" item="item" index="index" separator=",">
(#{id,jdbcType=BIGINT}, #{orgId,jdbcType=VARCHAR}, #{ouName,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{taxRate,jdbcType=DECIMAL}, #{revenueTypeName,jdbcType=VARCHAR},
#{startDate,jdbcType=VARCHAR}, #{endDate,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT}
<if test="createBy != null">
,create_by = #{createBy,jdbcType=VARCHAR}
</if>
<if test="updateBy != null">
,update_by = #{updateBy,jdbcType=VARCHAR}
</if>
<if test="createTime != null">
,create_time = #{createTime,jdbcType=TIMESTAMP}
</if>
<if test="updateTime != null">
,update_time = #{updateTime,jdbcType=TIMESTAMP}
</if>)
<insert id="batchInsert">
insert into revenue_type_mapping
(id, org_id, ou_name, content, tax_rate, revenue_type_name, start_date, end_date, status, create_by, update_by, create_time, update_time) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id},
#{item.orgId},
#{item.ouName},
#{item.content},
#{item.taxRate},
#{item.revenueTypeName},
#{item.startDate},
#{item.endDate},
#{item.status,jdbcType=TINYINT},
#{item.createBy},
#{item.updateBy},
#{item.createTime},
#{item.updateTime})
</foreach>
</insert>
......
......@@ -71,6 +71,7 @@
"AssignRoleCol" : "分配角色",
"SequenceNoCol":"序号",
"DocumentID":"Doc ID",
"Document":"Document",
"TaxGroup":"税种",
"ReportTemplate":"Report Template",
......@@ -78,6 +79,7 @@
"NoOrganizationData":"The current system does not have any organization",
"TaxpayerIdentificationNumber":"TaxpayerIdentificationNumber",
"AddOrganization":"Add Organization",
"IsRequired": "Is Required",
"EditOrganization":"Edit Organization",
"OrganizationName":"Entity Name",
"OrganizationNameRequired":"Entity Name Required",
......
......@@ -2,6 +2,8 @@
"DocumentAttr":"DocumentAttr",
"DocumentType":"DocumentType",
"DocumentName":"DocumentName",
"IsRequired":"Is Required",
"PleaseChecksRequired":"Please Checks Required",
"BusinessLine":"BusinessLine",
"CorporationName":"CorporationName",
"AvailabilityDate":"AvailabilityDate",
......@@ -45,6 +47,7 @@
"NoData":"NoData",
"PleaseSelected":"PleaseSelected",
"PleaseType":"PleaseType",
"Tips":"Tips",
"EntityStorageDescription":"EntityStorageDescription",
"multiUpload":"multiUpload",
"UploadAttach":"UploadAttach",
......
{
"DocumentAttr":"档案属性",
"Document":"档案",
"IsRequired":"为必填字段,不能为空,请检查",
"PleaseChecksRequired":"请检查必填字段",
"DocumentType":"档案类型",
"DocumentName":"档案名称",
"BusinessLine":"业务线",
......@@ -45,6 +48,7 @@
"NoData":"当前无数据可下载",
"PleaseSelected":"请选择",
"PleaseType":"请输入",
"Tips":"提示讯息",
"EntityStorageDescription":"请将实物档案存放地址精确到某个档案柜",
"multiUpload":"批量上传",
"UploadAttach":"上传附件",
......
......@@ -250,7 +250,14 @@
rowAlternationEnabled: true, //单双行颜色
};
};
$scope.getTableHeight=function(){
var row_height=$("table").find("tr").height();
if(row_height){
return {
height:(row_height*12+100)+"px"
}
}
};
$scope.exportEventTrigger = function(){
$(".dx-datagrid-export-button").click();
};
......
......@@ -41,7 +41,7 @@
</div>
<div style="padding:0 1rem;background:#fff">
<div class="dx-viewport demo-container">
<div id="gridContainer" dx-data-grid="dataGridOptions"></div>
<div id="gridContainer" dx-data-grid="dataGridOptions" ng-style="getTableHeight()"></div>
</div>
<!--<div class="form-group page-form-group">-->
......
......@@ -157,47 +157,45 @@
})
}
$scope.upload = function() {
$scope.upload = function(uploadType) {
if (!$scope.uploadFile || !$scope.uploadFile.file.name) {
SweetAlert.warning($translate.instant('SelectUploadFileRequired'));
return;
}
$('#busy-indicator-container').show();
var deferred = $q.defer();
Upload.upload({
url: '/revenueConfMapping/upload',
url: apiInterceptor.webApiHostUrl + '/revenueConfMapping/upload',
data: {
type: $scope.uploadType,
type: uploadType,
},
file: $scope.uploadFile.file,
// resumeChunkSize: resumable ? $scope.chunkSize : null,
headers: {
'Access-Control-Allow-Origin': '*',
Authorization: apiInterceptor.tokenType + ' ' + apiInterceptor.apiToken(),
__RequestVerificationToken: token,
withCredentials: true
},
__RequestVerificationToken: token,
withCredentials: true
}).then(function(res) {
$('#busy-indicator-container').hide();
deferred.resolve();
if (res && 0 === res.code) {
if (res && res.data && 0 === res.data.code) {
SweetAlert.success($translate.instant('ImportSuccess'));
$scope.refreshConfigGrid();
} else {
SweetAlert.error($translate.instant('SystemError'));
}
}, function(resp) {
deferred.resolve();
if (resp.statusText === 'HttpRequestValidationException') {
SweetAlert.warning($translate.instant('HttpRequestValidationException'));
} else {
SweetAlert.warning($translate.instant('SaveFail'));
}
console.log('Error status: ' + resp.status);
$('#busy-indicator-container').hide();
}, function(evt) {
deferred.resolve();
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
......
......@@ -11,9 +11,9 @@
<label class="control-label">文件:</label>
<input class="form-control" type="text" name="fileName" ng-model="uploadFile.file.name" readonly placeholder=""/>
<button type="button" type="file" ngf-select ng-model="uploadFile.file" accept=".xls,.xlsx" class="btn btn-secondary browse">{{'SelectFile' | translate }}</button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-secondary" translate="CoverImportBtn" ng-click="upload(1)"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload()"></button>
<button type="button" class="btn btn-secondary" translate="AddImportBtn" ng-click="upload(2)"></button>
<button type="button" class="btn btn-in-grid inline-div" ng-click="downloadTemplate()"><i
class="fa fa-download" aria-hidden="true"></i>下载模板
</button>
......
......@@ -633,7 +633,7 @@
</div>
<div style="padding:0 1rem;background:#fff">
<div class="TDL-data-grid-container dx-viewport demo-container">
<div id="gridContainer" dx-data-grid="dataGridOptions"></div>
<div id="gridContainer" dx-data-grid="dataGridOptions" ng-style="getTableHeight()"></div>
</div>
<div class="form-group page-form-group">
<div class="page-footer">
......
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