Commit b9b317ba authored by neo's avatar neo

[DEV] journal entry validation

parent a33d964a
...@@ -30,4 +30,7 @@ public final class Constant { ...@@ -30,4 +30,7 @@ public final class Constant {
public static final boolean DEFAULT_RESULT=true; public static final boolean DEFAULT_RESULT=true;
public static final int FIRST_OR_DEFAULT=0; public static final int FIRST_OR_DEFAULT=0;
public static final int HEADER_ROW_INDEX=0;
public static final boolean DEFAULT_HAS_HEADER=true;
} }
\ No newline at end of file
...@@ -23,5 +23,11 @@ public class JournalEntryImportController { ...@@ -23,5 +23,11 @@ public class JournalEntryImportController {
public ResponseEntity queryJournalEntryData(@RequestBody QueryJeDto queryJeDto) { public ResponseEntity queryJournalEntryData(@RequestBody QueryJeDto queryJeDto) {
return ResponseEntity.ok( journalEntryDataImportService.qeryJournalEntryData(queryJeDto)); return ResponseEntity.ok( journalEntryDataImportService.qeryJournalEntryData(queryJeDto));
} }
@ApiOperation(value = "getValidationInfo", notes = "")
@RequestMapping(value = "getValidationInfo/{type}/{period}", method = RequestMethod.GET)
public ResponseEntity getValidationInfo(@PathVariable Integer type, @PathVariable Integer period) {
return ResponseEntity.ok( journalEntryDataImportService.getValidationInfoList(type,period));
}
} }
...@@ -30,6 +30,9 @@ import java.math.BigDecimal; ...@@ -30,6 +30,9 @@ import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static pwc.taxtech.atms.constant.Constant.DEFAULT_HAS_HEADER;
import static pwc.taxtech.atms.constant.Constant.HEADER_ROW_INDEX;
@RequestMapping(value = "api/v1/DataImport") @RequestMapping(value = "api/v1/DataImport")
@RestController @RestController
public class TBDataImportController { public class TBDataImportController {
...@@ -455,7 +458,8 @@ public class TBDataImportController { ...@@ -455,7 +458,8 @@ public class TBDataImportController {
String fullFilePath = fileUploadAdapter.getLastFilePathByFileName(tempFileName); String fullFilePath = fileUploadAdapter.getLastFilePathByFileName(tempFileName);
if (fullFilePath != null) { if (fullFilePath != null) {
try(FileInputStream fis = new FileInputStream(new File(fullFilePath));) { try(FileInputStream fis = new FileInputStream(new File(fullFilePath));) {
dataImportModel = NPOIHelper.renderTBDataTableFromExcel(fis, selectedSheetIndex, 0, true, topRowNumber); dataImportModel = NPOIHelper.renderTBDataTableFromExcel(fis, selectedSheetIndex, HEADER_ROW_INDEX,
DEFAULT_HAS_HEADER, topRowNumber);
dataImportModel.setSelectedSheetIndex(selectedSheetIndex); dataImportModel.setSelectedSheetIndex(selectedSheetIndex);
return ResponseEntity.ok(dataImportModel); return ResponseEntity.ok(dataImportModel);
} catch (FileNotFoundException e) {//TODO: replace exception filter (neo) } catch (FileNotFoundException e) {//TODO: replace exception filter (neo)
......
package pwc.taxtech.atms.dto.vatdto;
import java.util.Date;
public class ValidationInfoDto {
private String ID;
private Integer importTypeId;
private String validationResult;
private String validationDetails;
private String validationTips;
private Integer number;
private String creatorId;
private Date createTime;
private Integer periodId;
private Integer erpCheckTypeId;
private Integer errorLevel;
public String getID() {
return ID;
}
public void setID(String ID) {
this.ID = ID;
}
public Integer getImportTypeId() {
return importTypeId;
}
public void setImportTypeId(Integer importTypeId) {
this.importTypeId = importTypeId;
}
public String getValidationResult() {
return validationResult;
}
public void setValidationResult(String validationResult) {
this.validationResult = validationResult;
}
public String getValidationDetails() {
return validationDetails;
}
public void setValidationDetails(String validationDetails) {
this.validationDetails = validationDetails;
}
public String getValidationTips() {
return validationTips;
}
public void setValidationTips(String validationTips) {
this.validationTips = validationTips;
}
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
public Integer getErpCheckTypeId() {
return erpCheckTypeId;
}
public void setErpCheckTypeId(Integer erpCheckTypeId) {
this.erpCheckTypeId = erpCheckTypeId;
}
public Integer getErrorLevel() {
return errorLevel;
}
public void setErrorLevel(Integer errorLevel) {
this.errorLevel = errorLevel;
}
public Integer getIsShowDetail() {
return isShowDetail;
}
public void setIsShowDetail(Integer isShowDetail) {
this.isShowDetail = isShowDetail;
}
private Integer isShowDetail;
}
...@@ -80,7 +80,10 @@ public class NPOIHelper { ...@@ -80,7 +80,10 @@ public class NPOIHelper {
if (topRowNumber > 0) { if (topRowNumber > 0) {
//第一行为列头的话就多输出一行 //第一行为列头的话就多输出一行
int topNum = haveHeader ? topRowNumber + 1 : topRowNumber; int topNum = haveHeader ? topRowNumber + 1 : topRowNumber;
if(topNum<dataImportModel.getDataList().size())
dataImportModel.setDataList(dataImportModel.getDataList().subList(0,topNum)); dataImportModel.setDataList(dataImportModel.getDataList().subList(0,topNum));
// dataImportModel.setDataList(dataImportModel.getDataList().subList(0,topRowNumber));
} }
return dataImportModel; return dataImportModel;
......
...@@ -2,8 +2,13 @@ package pwc.taxtech.atms.vat.service; ...@@ -2,8 +2,13 @@ package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.PagingResultDto; import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.QueryJeDto; import pwc.taxtech.atms.dto.vatdto.QueryJeDto;
import pwc.taxtech.atms.dto.vatdto.ValidationInfoDto;
import pwc.taxtech.atms.dto.vatdto.VoucherDto; import pwc.taxtech.atms.dto.vatdto.VoucherDto;
import java.util.List;
public interface JournalEntryImportService { public interface JournalEntryImportService {
PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto); PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto);
List<ValidationInfoDto> getValidationInfoList(Integer type, Integer period);
} }
...@@ -6,8 +6,12 @@ import pwc.taxtech.atms.constant.enums.VatImportType; ...@@ -6,8 +6,12 @@ import pwc.taxtech.atms.constant.enums.VatImportType;
import pwc.taxtech.atms.dto.FieldsMapper; import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.PagingResultDto; import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.QueryJeDto; import pwc.taxtech.atms.dto.vatdto.QueryJeDto;
import pwc.taxtech.atms.dto.vatdto.ValidationInfoDto;
import pwc.taxtech.atms.dto.vatdto.VoucherDto; import pwc.taxtech.atms.dto.vatdto.VoucherDto;
import pwc.taxtech.atms.vat.dao.JournalEntryImportMapper; import pwc.taxtech.atms.vat.dao.JournalEntryImportMapper;
import pwc.taxtech.atms.vat.dao.ValidationInfoMapper;
import pwc.taxtech.atms.vat.entity.ValidationInfo;
import pwc.taxtech.atms.vat.entity.ValidationInfoExample;
import pwc.taxtech.atms.vat.entity.Voucher; import pwc.taxtech.atms.vat.entity.Voucher;
import pwc.taxtech.atms.vat.service.JournalEntryImportService; import pwc.taxtech.atms.vat.service.JournalEntryImportService;
...@@ -15,11 +19,16 @@ import java.math.BigDecimal; ...@@ -15,11 +19,16 @@ import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static pwc.taxtech.atms.constant.Constant.WholeYear;
@Service @Service
public class JournalEntryImportServiceImpl implements JournalEntryImportService { public class JournalEntryImportServiceImpl implements JournalEntryImportService {
@Autowired @Autowired
JournalEntryImportMapper journalEntryImportMapper; JournalEntryImportMapper journalEntryImportMapper;
@Autowired
ValidationInfoMapper validationInfoMapper;
@Override @Override
public PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto) { public PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto) {
PagingResultDto<VoucherDto> qResult = new PagingResultDto<VoucherDto>(); PagingResultDto<VoucherDto> qResult = new PagingResultDto<VoucherDto>();
...@@ -28,7 +37,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService ...@@ -28,7 +37,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
qResult.setCalculateData(new VoucherDto()); qResult.setCalculateData(new VoucherDto());
List<Voucher> pageResultList = journalEntryImportMapper.pageQuery(VatImportType.JournalEntry.getCode(), List<Voucher> pageResultList = journalEntryImportMapper.pageQuery(VatImportType.JournalEntry.getCode(),
queryJeDto.getPeriodId(), queryJeDto.getPageInfo().getPageIndex()*queryJeDto.getPageInfo().getPageSize(), queryJeDto.getPeriodId(), queryJeDto.getPageInfo().getPageIndex() * queryJeDto.getPageInfo().getPageSize(),
queryJeDto.getPageInfo().getPageSize()); queryJeDto.getPageInfo().getPageSize());
Integer pageCount = journalEntryImportMapper.pageQueryCount(VatImportType.JournalEntry.getCode(), Integer pageCount = journalEntryImportMapper.pageQueryCount(VatImportType.JournalEntry.getCode(),
...@@ -41,9 +50,9 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService ...@@ -41,9 +50,9 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
//查询结果总数 //查询结果总数
qResult.getPageInfo().setTotalCount(pageCount); qResult.getPageInfo().setTotalCount(pageCount);
//分录总数 //分录总数
qResult.getCalculateData().setItemIDCount(pageCount==null?0:pageCount); qResult.getCalculateData().setItemIDCount(pageCount == null ? 0 : pageCount);
//凭证总数 //凭证总数
qResult.getCalculateData().setvIDCount(vIDCount==null?0:vIDCount); qResult.getCalculateData().setvIDCount(vIDCount == null ? 0 : vIDCount);
//所有凭证的借贷方sum //所有凭证的借贷方sum
BigDecimal debitSum = new BigDecimal(0); BigDecimal debitSum = new BigDecimal(0);
BigDecimal creditSum = new BigDecimal(0); BigDecimal creditSum = new BigDecimal(0);
...@@ -63,7 +72,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService ...@@ -63,7 +72,7 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
VoucherDto voucherDto = new VoucherDto(); VoucherDto voucherDto = new VoucherDto();
try { try {
FieldsMapper.map(voucher,voucherDto); FieldsMapper.map(voucher, voucherDto);
} catch (ClassNotFoundException e) {//TODO replace exception filter (neo) } catch (ClassNotFoundException e) {//TODO replace exception filter (neo)
e.printStackTrace(); e.printStackTrace();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
...@@ -74,4 +83,29 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService ...@@ -74,4 +83,29 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
return qResult; return qResult;
} }
@Override
public List<ValidationInfoDto> getValidationInfoList(Integer type, Integer period) {
ValidationInfoExample validationInfoExample = new ValidationInfoExample();
if (period.intValue() != WholeYear)
validationInfoExample.createCriteria().andImportTypeIdEqualTo(type).andPeriodIdEqualTo(period);
else validationInfoExample.createCriteria().andImportTypeIdEqualTo(type);
List<ValidationInfo> result= validationInfoMapper.selectByExample(validationInfoExample);
List<ValidationInfoDto> validationInfoDtos = new ArrayList<>(result.size());
result.forEach(m->{
ValidationInfoDto dto = new ValidationInfoDto();
try {
FieldsMapper.map(result,dto);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
});
return validationInfoDtos;
}
} }
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