Commit 068a0753 authored by neo's avatar neo

[DEV] getCustomsInvoicesValidates impl

parent 0bf47e57
......@@ -16,24 +16,26 @@ import pwc.taxtech.atms.dto.PagingDto;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceFilter;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoice;
import pwc.taxtech.atms.dto.vatdto.JsonCustomsInvoiceDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
import pwc.taxtech.atms.vat.service.CustomsInvoiceService;
import pwc.taxtech.atms.vat.service.impl.CustomsInvoiceServiceImpl;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.text.DateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
@RestController
@RequestMapping(value = "api/v1/CustomsInvoice")
public class CustomsInvoiceController {
@Autowired
CustomsInvoiceService customsInvoiceService;
CustomsInvoiceServiceImpl customsInvoiceService;
@RequestMapping(value = "GetCustomsInvoiceDataForDisplay", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String getCustomsInvoiceDataForDisplay(@RequestParam int fromPeriod, @RequestParam int toPeriod, @RequestParam String criteria, @RequestParam String pagination) {
......@@ -58,6 +60,11 @@ public class CustomsInvoiceController {
return ResponseEntity.ok().body(customsInvoiceService.getCustomsInvoicesByPeriodId(periodId));
}
@RequestMapping(value = "getCustomsInvoicesValidates/{periodId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity getCustomsInvoicesValidates(@PathVariable Integer periodId) {
return ResponseEntity.ok().body(customsInvoiceService.getCustomsInvoicesValidates(periodId));
}
@RequestMapping(value = "ExportQueryData/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void exportQueryData(@RequestParam String criteria, HttpServletResponse response) {
CustomsInvoiceFilter filter = new CustomsInvoiceFilter();
......
......@@ -9,25 +9,25 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.vatdto.QueryJeDto;
import pwc.taxtech.atms.vat.service.JournalEntryImportService;
import pwc.taxtech.atms.vat.service.impl.JournalEntryImportServiceImpl;
@RestController
@RequestMapping(value = "/api/v1/journalEntryImport")
public class JournalEntryImportController {
@Autowired
private JournalEntryImportService journalEntryDataImportService;
private JournalEntryImportServiceImpl journalEntryDataImportService;
@ApiOperation(value = "queryJournalEntryData", notes = "")
@RequestMapping(value = "/queryJournalEntryData", method = RequestMethod.POST)
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));
return ResponseEntity.ok(journalEntryDataImportService.getValidationInfoList(type, period));
}
}
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;
}
package pwc.taxtech.atms.vat.service;
import org.springframework.http.ResponseEntity;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import java.util.List;
public interface CustomsInvoiceService {
/**
*
* @param fromPeriod
* @param toPeriod
* @return
*/
List<CustomsInvoiceDto> getCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod);
List<CustomsInvoiceDto> getCustomsInvoicesByPeriodId(Integer periodId);
}
package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.PagingResultDto;
import pwc.taxtech.atms.dto.vatdto.QueryJeDto;
import pwc.taxtech.atms.dto.vatdto.ValidationInfoDto;
import pwc.taxtech.atms.dto.vatdto.VoucherDto;
import java.util.List;
public interface JournalEntryImportService {
PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto);
List<ValidationInfoDto> getValidationInfoList(Integer type, Integer period);
}
package pwc.taxtech.atms.vat.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.enums.EnumValidationType;
import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import pwc.taxtech.atms.vat.dao.ValidationInfoMapper;
import pwc.taxtech.atms.vat.entity.CustomsInvoice;
import pwc.taxtech.atms.vat.entity.CustomsInvoiceExample;
import pwc.taxtech.atms.vat.service.CustomsInvoiceService;
import pwc.taxtech.atms.vat.entity.ValidationInfo;
import pwc.taxtech.atms.vat.entity.ValidationInfoExample;
import java.math.BigDecimal;
import java.text.DecimalFormat;
......@@ -15,8 +20,10 @@ import java.util.Comparator;
import java.util.List;
@Service
public class CustomsInvoiceServiceImpl extends VatAbstractService implements CustomsInvoiceService {
@Override
public class CustomsInvoiceServiceImpl extends VatAbstractService {
@Autowired
private ValidationInfoMapper validationInfoMapper;
public List<CustomsInvoiceDto> getCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.setOrderByClause(" PayNum");
......@@ -43,24 +50,23 @@ public class CustomsInvoiceServiceImpl extends VatAbstractService implements Cus
return result;
}
@Override
public List<CustomsInvoiceDto> getCustomsInvoicesByPeriodId(Integer periodId) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.createCriteria().andPeriodIdEqualTo(periodId);
List<CustomsInvoice> result=customsInvoiceMapper.selectByExample(example);
List<CustomsInvoice> result = customsInvoiceMapper.selectByExample(example);
result.sort(Comparator.comparing(CustomsInvoice::getPayNum));
int seqNo = 1;
List<CustomsInvoiceDto> dtos = new ArrayList<>(result.size());
for(CustomsInvoice ci:result){
for (CustomsInvoice ci : result) {
CustomsInvoiceDto dto = new CustomsInvoiceDto();
try {
FieldsMapper.map(ci,dto);
FieldsMapper.map(ci, dto);
dto.setSeqNo(seqNo++);
dto.setInvoiceAmount(ci.getInvoiceAmount().setScale(2,BigDecimal.ROUND_HALF_UP));
dto.setInvoiceTaxAmount(ci.getInvoiceTaxAmount().setScale(2,BigDecimal.ROUND_HALF_UP));
dto.setInvoiceAmount(ci.getInvoiceAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
dto.setInvoiceTaxAmount(ci.getInvoiceTaxAmount().setScale(2, BigDecimal.ROUND_HALF_UP));
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
......@@ -71,4 +77,25 @@ public class CustomsInvoiceServiceImpl extends VatAbstractService implements Cus
return dtos;
}
public OperationResultDto<List<ValidationInfo>> getCustomsInvoicesValidates(Integer periodId) {
ValidationInfoExample example = new ValidationInfoExample();
List<ValidationInfo> result = null;
if (periodId == null) {
example.createCriteria().andImportTypeIdEqualTo(EnumValidationType.CustomInvoice.getCode());
result = validationInfoMapper.selectByExample(example);
} else {
example.createCriteria().andImportTypeIdEqualTo(EnumValidationType.CustomInvoice.getCode()).andPeriodIdEqualTo(periodId);
result.addAll(validationInfoMapper.selectByExample(example));
example.createCriteria().andImportTypeIdEqualTo(EnumValidationType.CustomInvoice.getCode()).andPeriodIdIsNull();
result.addAll(validationInfoMapper.selectByExample(example));
}
OperationResultDto<List<ValidationInfo>> resultOpt = new OperationResultDto<>();
resultOpt.setResult(true);
resultOpt.setResultMsg("");
resultOpt.setData(result);
return resultOpt;
}
}
......@@ -9,7 +9,6 @@ import pwc.taxtech.atms.constant.enums.ImageType;
import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.DataCheckDto;
import pwc.taxtech.atms.dto.vatdto.ValidationInfoDto;
import pwc.taxtech.atms.dto.vatdto.VoucherAccountMto;
import pwc.taxtech.atms.dto.vatdto.VoucherBalanceDto;
import pwc.taxtech.atms.dto.vatdto.VoucherDto;
......@@ -54,7 +53,7 @@ public class FinanceDataImportServiceImpl implements FinanceDataImportService {
List<DataCheckDto> results = new ArrayList<>();
OperationResultDto<List<DataCheckDto>> operationResult = new OperationResultDto<>();
List<ValidationInfoDto> dtos = getValidationData(ErpBasicCheck.getCode());
List<ValidationInfo> dtos = getValidationData(ErpBasicCheck.getCode());
if (dtos != null && dtos.size() > 0) {
dtos.forEach(b -> {
DataCheckDto dataCheckDto = new DataCheckDto();
......@@ -312,34 +311,17 @@ public class FinanceDataImportServiceImpl implements FinanceDataImportService {
}
//判断ValidationInfo中是否存在typeId的数据
private List<ValidationInfoDto> getValidationData(Integer typeId, Integer periodId) {
private List<ValidationInfo> getValidationData(Integer typeId, Integer periodId) {
ValidationInfoExample example = new ValidationInfoExample();
if (periodId != null && periodId > 0) {
example.createCriteria().andImportTypeIdEqualTo(typeId.intValue()).andPeriodIdEqualTo(periodId.intValue());
} else example.createCriteria().andImportTypeIdEqualTo(typeId.intValue());
List<ValidationInfo> infos = validationInfoMapper.selectByExample(example);
List<ValidationInfoDto> dots = new ArrayList<>(infos.size());
infos.forEach(m -> {
ValidationInfoDto dto = new ValidationInfoDto();
try {
FieldsMapper.map(m, dto);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
dots.add(dto);
});
return dots;
return validationInfoMapper.selectByExample(example);
}
private List<ValidationInfoDto> getValidationData(Integer typeId) {
private List<ValidationInfo> getValidationData(Integer typeId) {
return getValidationData(typeId, null);
}
}
......@@ -6,14 +6,12 @@ import pwc.taxtech.atms.constant.enums.VatImportType;
import pwc.taxtech.atms.dto.FieldsMapper;
import pwc.taxtech.atms.dto.PagingResultDto;
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.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.service.JournalEntryImportService;
import java.math.BigDecimal;
import java.util.ArrayList;
......@@ -22,14 +20,13 @@ import java.util.List;
import static pwc.taxtech.atms.constant.Constant.WholeYear;
@Service
public class JournalEntryImportServiceImpl implements JournalEntryImportService {
public class JournalEntryImportServiceImpl {
@Autowired
JournalEntryImportMapper journalEntryImportMapper;
@Autowired
ValidationInfoMapper validationInfoMapper;
@Override
public PagingResultDto<VoucherDto> qeryJournalEntryData(QueryJeDto queryJeDto) {
PagingResultDto<VoucherDto> qResult = new PagingResultDto<VoucherDto>();
qResult.setPageInfo(queryJeDto.getPageInfo());
......@@ -84,28 +81,13 @@ public class JournalEntryImportServiceImpl implements JournalEntryImportService
return qResult;
}
@Override
public List<ValidationInfoDto> getValidationInfoList(Integer type, Integer period) {
public List<ValidationInfo> 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;
return validationInfoMapper.selectByExample(validationInfoExample);
}
}
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