Commit 24f65265 authored by neo's avatar neo

[dev] custmons invoice get data for display impl

parent bc625ef9
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.vat.entity.CustomsInvoice;
import java.math.BigDecimal;
import java.util.Date;
......@@ -113,4 +115,17 @@ public class CustomsInvoiceDto {
public void setSeqNo(int seqNo) {
this.seqNo = seqNo;
}
public CustomsInvoiceDto extractFromEntity(CustomsInvoice entity){
setCustomsId(entity.getCustomsId());
setPayNum(entity.getPayNum());
setIssueDate(entity.getIssueDate());
setInvoiceTaxAmount(entity.getInvoiceTaxAmount());
setInvoiceAmount(entity.getInvoiceAmount());
setAuditResult(entity.getAuditResult());
setCreateTime(entity.getCreateTime());
setCreatorID(entity.getCreatorID());
setPeriodId(entity.getPeriodId());
return this;
}
}
package pwc.taxtech.atms.dto.vatdto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class JsonCustomsInvoice {
@JsonProperty(value = "recordNumber", required = false)
public String RecordNumber;
@JsonProperty(value = "customsId", required = false)
public String CustomsId;
@JsonProperty(value = "payNum", required = false)
public String PayNum;
@JsonProperty(value = "issueDate", required = false)
public String IssueDate;
@JsonProperty(value = "invoiceTaxAmount", required = false)
public String InvoiceTaxAmount;
@JsonProperty(value = "invoiceAmount", required = false)
public String InvoiceAmount;
@JsonProperty(value = "auditResult", required = false)
public String AuditResult;
@JsonProperty(value = "createTime", required = false)
public String CreateTime;
@JsonProperty(value = "creatorID", required = false)
public String CreatorID;
@JsonProperty(value = "periodId", required = false)
public Integer PeriodId;
}
......@@ -6,6 +6,7 @@ import java.util.List;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.customer.CustomerDto;
import pwc.taxtech.atms.dto.customer.CustomerValidateInfoDto;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
public interface CustomerService {
......@@ -20,4 +21,6 @@ public interface CustomerService {
List<OperationResultDto<CustomerDto>> updateRange(List<CustomerDto> customerDtoList);
Object upload(InputStream inputStream, String fileName, String action, String enterpriseAccountID);
List<CustomsInvoiceDto> GetCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod);
}
......@@ -4,6 +4,7 @@ import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -19,6 +20,7 @@ import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import pwc.taxtech.atms.dto.vatdto.CustomsInvoiceDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.CommonConstants;
......@@ -41,8 +43,13 @@ import pwc.taxtech.atms.entitiy.CustomerExample.Criteria;
import pwc.taxtech.atms.entitiy.EnterpriseAccountSet;
import pwc.taxtech.atms.service.CustomerService;
import pwc.taxtech.atms.service.OperationLogService;
import pwc.taxtech.atms.vat.dao.CustomsInvoiceMapper;
import pwc.taxtech.atms.vat.entity.CustomsInvoice;
import pwc.taxtech.atms.vat.entity.CustomsInvoiceExample;
/** @see PwC.Tax.Tech.Atms.Admin.Application.Services.Impl.CustomerService.cs */
/**
* @see PwC.Tax.Tech.Atms.Admin.Application.Services.Impl.CustomerService.cs
*/
@Service
public class CustomerServiceImpl implements CustomerService {
......@@ -62,6 +69,8 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
private FileService fileService;
@Autowired
private CustomsInvoiceMapper customsInvoiceMapper;
@Override
public List<OperationResultDto<CustomerDto>> addRange(List<CustomerDto> customerDtoList) {
......@@ -249,8 +258,32 @@ public class CustomerServiceImpl implements CustomerService {
return finalResult;
}
@Override
public List<CustomsInvoiceDto> GetCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.createCriteria().andPeriodIdGreaterThanOrEqualTo(fromPeriod).andPeriodIdLessThanOrEqualTo(toPeriod);
List<CustomsInvoice> reuslt = customsInvoiceMapper.selectByExample(example);
reuslt.stream().sorted(Comparator.comparing(CustomsInvoice::getPayNum));
List<CustomsInvoiceDto> returnResult = new ArrayList<>();
int seqNo = 1;
for (CustomsInvoice r : reuslt) {
CustomsInvoiceDto dto = new CustomsInvoiceDto();
dto.setSeqNo(seqNo++);
if (r.getInvoiceAmount() != null) {
r.setInvoiceAmount(r.getInvoiceAmount().setScale(2));
}
if (r.getInvoiceTaxAmount() != null) {
r.setInvoiceTaxAmount(r.getInvoiceTaxAmount().setScale(2));
}
returnResult.add(dto.extractFromEntity(r));
}
return returnResult;
}
private List<OperationResultDto<CustomerDto>> saveData(String enterpriseAccountID,
List<CustomerDto> customerDtoList, String action) {
List<CustomerDto> customerDtoList, String action) {
logger.debug("enter customerDtoList, enterpriseAccountID:{}, customerDtoList.size:{}, action:{}",
enterpriseAccountID, customerDtoList.size(), action);
List<OperationResultDto<CustomerDto>> errList = new ArrayList<OperationResultDto<CustomerDto>>();
......
......@@ -61,7 +61,6 @@ import static pwc.taxtech.atms.constant.Constant.*;
@Service
public class ProjectServiceImpl implements ProjectService {
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\ProjectService.cs
*/
private static final int FIRST_OR_DEFAULT = 0;
private static Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class);
......
......@@ -43,7 +43,6 @@ import pwc.taxtech.atms.service.DimensionService;
import pwc.taxtech.atms.service.StatisticAttributeService;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\StatisticAttributeService.cs
*/
@Service
public class StatisticAttributeServiceImpl extends AbstractService implements StatisticAttributeService {
......
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