Commit 7baee921 authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo2' into 'dev'

Dev neo2

See merge request root/atms!28
parents cebaf261 b9b317ba
...@@ -28,4 +28,9 @@ public final class Constant { ...@@ -28,4 +28,9 @@ public final class Constant {
public static final String CURRENT_USER_UPLOAD_FOLDER=CURRENT_USER_HOME+File.separator+UPLOAD_FOLDER_NAME; public static final String CURRENT_USER_UPLOAD_FOLDER=CURRENT_USER_HOME+File.separator+UPLOAD_FOLDER_NAME;
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 HEADER_ROW_INDEX=0;
public static final boolean DEFAULT_HAS_HEADER=true;
} }
\ No newline at end of file
package pwc.taxtech.atms.constant.enums;
public enum TbImportType {
UnImported (0),
TbImported (1),
ErpImported (2);
private Integer code;
TbImportType(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
...@@ -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));
}
} }
...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.controller; ...@@ -2,6 +2,7 @@ package pwc.taxtech.atms.controller;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -47,4 +48,11 @@ public class ProjectInfoController { ...@@ -47,4 +48,11 @@ public class ProjectInfoController {
queryImportType.getServiceTypeId() queryImportType.getServiceTypeId()
, identityService.getIdentityUser().getID()); , identityService.getIdentityUser().getID());
} }
@ApiOperation(value = "getImportType", notes = "")
@RequestMapping(value = "getImportType/{projectID}/{periodID}/{serviceType}", method = RequestMethod.GET)
public ResponseEntity getImportType(@PathVariable String projectID, @PathVariable Integer periodID,
@PathVariable Integer serviceType) {
return ResponseEntity.ok().body(projectInfoService.getImportType(projectID,periodID,serviceType));
}
} }
\ No newline at end of file
...@@ -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;
}
...@@ -11,4 +11,6 @@ public interface ProjectInfoService { ...@@ -11,4 +11,6 @@ public interface ProjectInfoService {
OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId); OperationResultDto<Boolean> isProjectImportedData(String projectId, Integer importTypeId);
OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id); OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id);
Integer getImportType(String projectID, Integer periodID, Integer serviceType);
} }
...@@ -4,6 +4,7 @@ import org.slf4j.Logger; ...@@ -4,6 +4,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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 pwc.taxtech.atms.constant.enums.TbImportType;
import pwc.taxtech.atms.dao.PeriodInfoMapper; import pwc.taxtech.atms.dao.PeriodInfoMapper;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto; import pwc.taxtech.atms.dto.taxadmin.PeriodInfoDto;
...@@ -11,8 +12,11 @@ import pwc.taxtech.atms.entitiy.PeriodInfo; ...@@ -11,8 +12,11 @@ import pwc.taxtech.atms.entitiy.PeriodInfo;
import pwc.taxtech.atms.entitiy.PeriodInfoExample; import pwc.taxtech.atms.entitiy.PeriodInfoExample;
import pwc.taxtech.atms.service.ProjectInfoService; import pwc.taxtech.atms.service.ProjectInfoService;
import java.util.Date;
import java.util.List; import java.util.List;
import static pwc.taxtech.atms.constant.Constant.FIRST_OR_DEFAULT;
@Service @Service
public class ProjectInfoServiceImpl implements ProjectInfoService { public class ProjectInfoServiceImpl implements ProjectInfoService {
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class);
...@@ -50,4 +54,28 @@ public class ProjectInfoServiceImpl implements ProjectInfoService { ...@@ -50,4 +54,28 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id) { public OperationResultDto<List<PeriodInfoDto>> getProjectImportType(String projectId, List<Integer> periods, Integer serviceTypeId, String id) {
return null; return null;
} }
@Override
public Integer getImportType(String projectID, Integer periodID, Integer serviceType) {
PeriodInfoExample example = new PeriodInfoExample();
example.createCriteria().andProjectIDEqualTo(projectID).andProjectIDEqualTo(projectID).andServiceTypeEqualTo(serviceType);
List<PeriodInfo> periodInfoList =periodInfoMapper.selectByExample(example);
if(periodInfoList==null || periodInfoList.size()==0){
PeriodInfo periodInfo = new PeriodInfo();
periodInfo.setProjectID(projectID);
periodInfo.setPeriod(periodID);
periodInfo.setStatus(0);
periodInfo.setImportType(TbImportType.UnImported.getCode());
periodInfo.setServiceType(serviceType);
periodInfo.setCreateTime(new Date());
periodInfo.setUpdateTime(new Date());
periodInfoMapper.insert(periodInfo);
return TbImportType.UnImported.getCode();
}else {
return periodInfoList.get(FIRST_OR_DEFAULT).getImportType();
}
}
} }
...@@ -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