Commit b0d55663 authored by neo's avatar neo

[dev] delete TB Journal finace Customs voucher Import Controller And Service

parent 5011ee91
...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.vat.entity.CellComment; import pwc.taxtech.atms.vat.entity.CellComment;
import pwc.taxtech.atms.vat.service.CellCommentService; import pwc.taxtech.atms.vat.service.impl.CellCommentServiceImpl;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -17,7 +17,7 @@ import java.util.Optional; ...@@ -17,7 +17,7 @@ import java.util.Optional;
@RequestMapping(value = "api/v1/CellComment") @RequestMapping(value = "api/v1/CellComment")
public class CellCommentController { public class CellCommentController {
@Autowired @Autowired
CellCommentService cellCommentService; CellCommentServiceImpl cellCommentService;
@RequestMapping(value = "List", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "List", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<CellComment>> getCellComments(@RequestParam("cellDataId") Optional<Long> cellDataId) { public OperationResultDto<List<CellComment>> getCellComments(@RequestParam("cellDataId") Optional<Long> cellDataId) {
......
package pwc.taxtech.atms.controller;
import com.google.errorprone.annotations.FormatString;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.ImportVoucherDto;
import pwc.taxtech.atms.dto.vatdto.QueryJeDto;
import pwc.taxtech.atms.service.IdentityService;
import pwc.taxtech.atms.vat.service.impl.JournalEntryImportServiceImpl;
@RestController
@RequestMapping(value = "/api/v1/journalEntryImport")
public class JournalEntryImportController {
@Autowired
private JournalEntryImportServiceImpl journalEntryDataImportService;
@Autowired
private IdentityService identityService;
@ApiOperation(value = "queryJournalEntryData", notes = "")
@RequestMapping(value = "/queryJournalEntryData", method = RequestMethod.POST)
public ResponseEntity queryJournalEntryData(@RequestBody QueryJeDto 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));
}
@RequestMapping(value = "importJournalEntry", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity ImportJournalEntryData(@RequestBody ImportVoucherDto importParam) {
journalEntryDataImportService.ImportJournalEntryData(importParam.VoucherList, importParam.ImportType,
identityService.getIdentityUser().getId());
return ResponseEntity.ok().build();
}
@RequestMapping(value = "importAuditAdjust/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity ImportAuditAdjust(@RequestBody ImportVoucherDto importParam, @PathVariable Integer period) {
return ResponseEntity.ok().body(journalEntryDataImportService.ImportAuditAdjust(importParam.VoucherList,
period, importParam.ImportType, identityService.getIdentityUser().getId()));
}
@RequestMapping(value = "getAuditAdjust/{period}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity GetAuditAdjust(@PathVariable Integer period) {
return ResponseEntity.ok().body(journalEntryDataImportService.GetAuditAdjust(period));
}
@RequestMapping(value = "queryAuditAdjust", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity QueryAuditAdjust(QueryJeDto queryDto) {
return ResponseEntity.ok().body(journalEntryDataImportService.QueryAuditAdjust(queryDto));
}
}
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
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.constant.enums.VoucherSearchEnum;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.QueryVoucherParmDto;
import pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountDto;
import pwc.taxtech.atms.vat.service.TBDataImportService;
import pwc.taxtech.atms.vat.service.VoucherService;
import java.util.List;
@RequestMapping(value = "api/v1/voucher")
@RestController
public class VoucherController {
@Autowired
VoucherService voucherService;
@Autowired
TBDataImportService tbDataImportService;
private static final Logger logger = LoggerFactory.getLogger(VoucherController.class);
@RequestMapping(value = "voucherSelectAdvancedByEntry", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<Object> voucherSelectAdvancedByEntry(@RequestBody QueryVoucherParmDto parmDto) {
try {
return voucherService.voucherSelectAdvancedByEntry(parmDto.getListQueryCondition(), VoucherSearchEnum.values()[parmDto.getMainRelation()], parmDto.isAllJe(), parmDto.getPagingInfo());
} catch (Exception ex) {
logger.error("voucherSelectAdvancedByEntryError", ex);
}
OperationResultDto<Object> result = new OperationResultDto<>();
result.setResult(false);
return result;
}
@RequestMapping(value = "voucherSelectAdvancedCount", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<Object> voucherSelectAdvancedCount(@RequestBody QueryVoucherParmDto parmDto) {
try {
return voucherService.voucherSelectAdvancedCount(parmDto.getListQueryCondition(), VoucherSearchEnum.values()[parmDto.getMainRelation()], parmDto.isEntryShow(), parmDto.isAllJe());
} catch (Exception ex) {
logger.error("voucherSelectAdvancedCountError", ex);
}
OperationResultDto<Object> result = new OperationResultDto<>();
result.setResult(false);
return result;
}
@RequestMapping(value = "getEnterpriseAccount",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public List<VatEnterpriseAccountDto> getEnterpriseAccount(){
return tbDataImportService.getEnterpriseAccount();
}
@RequestMapping(value = "voucherSelectAdvancedByVoucher", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<Object> voucherSelectAdvancedByVoucher(QueryVoucherParmDto parmDto)
{
try {
return voucherService.voucherSelectAdvancedByVoucher(parmDto.getListQueryCondition(), VoucherSearchEnum.values()[parmDto.getMainRelation()], parmDto.isAllJe(), parmDto.getPagingInfo());
} catch (Exception ex) {
logger.error("voucherSelectAdvancedByVoucherError", ex);
}
OperationResultDto<Object> result = new OperationResultDto<>();
result.setResult(false);
return result;
}
}
package pwc.taxtech.atms.dto.vatdto;
import java.util.List;
public class ImportVoucherDto {
public List<VoucherDtoOnlyForImport> VoucherList;
public Integer ImportType;
}
package pwc.taxtech.atms.dto.vatdto;
import java.math.BigDecimal;
import java.util.List;
public class QueryVoucherDto {
private List<VoucherDto> voucherList;
//凭证总数
private int vidCount;
//分录总数
private int itemIdCount;
private BigDecimal debitSum;
private BigDecimal creditSum;
public List<VoucherDto> getVoucherList() {
return voucherList;
}
public void setVoucherList(List<VoucherDto> voucherList) {
this.voucherList = voucherList;
}
public int getVidCount() {
return vidCount;
}
public void setVidCount(int vidCount) {
this.vidCount = vidCount;
}
public int getItemIdCount() {
return itemIdCount;
}
public void setItemIdCount(int itemIdCount) {
this.itemIdCount = itemIdCount;
}
public BigDecimal getDebitSum() {
return debitSum;
}
public void setDebitSum(BigDecimal debitSum) {
this.debitSum = debitSum;
}
public BigDecimal getCreditSum() {
return creditSum;
}
public void setCreditSum(BigDecimal creditSum) {
this.creditSum = creditSum;
}
}
package pwc.taxtech.atms.dto.vatdto;
import org.thymeleaf.util.StringUtils;
import pwc.taxtech.atms.vat.entity.Voucher;
import java.math.BigDecimal;
import java.util.Date;
public class VoucherDto {
private String voucherId;
private String vid;
private Date date;
//private String GroupNum ;
private String group;
private Integer period;
private String customerCode;
private String customerName;
private String summary;
private String acctCode;
private BigDecimal debit;
private BigDecimal credit;
private BigDecimal debitQty;
private BigDecimal creditQty;
private Long attach;
private Long itemId;
private Integer status;
private Date createdTime;
private Integer isManual;
private Integer manualUser;
private Date manualTime;
private String stdCode;
private String mappingReason;
private Integer mappingUser;
private Date mappingTime;
private String manualReason;
private String foreignCurrency;
private BigDecimal foreignDebit;
private BigDecimal foreignCredit;
private String checkedBy;
private String issuedBy;
private String bookedBy;
private String cashier;
/**
* 是否被凭证重分类过
*/
private Boolean isRecate;
private Integer originalPeriod;
private String acctCodeAndNameShow; //界面显示
private String customerCodeAndNameShow; //界面显示
private String stdCodeAndNameShow; //界面显示
private String groupShow; //界面显示
private int vIdCount;//凭证总数
private int itemIdCount;//分录总数
private BigDecimal debitSum;
private BigDecimal creditSum;
private int auditCount;//审计调整总数
public String getVoucherId() {
return voucherId;
}
public void setVoucherId(String voucherId) {
this.voucherId = voucherId;
}
public String getvId() {
return vid;
}
public void setvId(String vid) {
this.vid = vid;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getSummary() {
return summary;
}
public void setSummary(String summary) {
this.summary = summary;
}
public String getAcctCode() {
return acctCode;
}
public void setAcctCode(String acctCode) {
this.acctCode = acctCode;
}
public BigDecimal getDebit() {
return debit;
}
public void setDebit(BigDecimal debit) {
this.debit = debit;
}
public BigDecimal getCredit() {
return credit;
}
public void setCredit(BigDecimal credit) {
this.credit = credit;
}
public BigDecimal getDebitQty() {
return debitQty;
}
public void setDebitQty(BigDecimal debitQty) {
this.debitQty = debitQty;
}
public BigDecimal getCreditQty() {
return creditQty;
}
public void setCreditQty(BigDecimal creditQty) {
this.creditQty = creditQty;
}
public Long getAttach() {
return attach;
}
public void setAttach(Long attach) {
this.attach = attach;
}
public Long getItemId() {
return itemId;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreatedTime() {
return createdTime;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Integer getIsManual() {
return isManual;
}
public void setIsManual(Integer isManual) {
this.isManual = isManual;
}
public Integer getManualUser() {
return manualUser;
}
public void setManualUser(Integer manualUser) {
this.manualUser = manualUser;
}
public Date getManualTime() {
return manualTime;
}
public void setManualTime(Date manualTime) {
this.manualTime = manualTime;
}
public String getStdCode() {
return stdCode;
}
public void setStdCode(String stdCode) {
this.stdCode = stdCode;
}
public String getMappingReason() {
return mappingReason;
}
public void setMappingReason(String mappingReason) {
this.mappingReason = mappingReason;
}
public Integer getMappingUser() {
return mappingUser;
}
public void setMappingUser(Integer mappingUser) {
this.mappingUser = mappingUser;
}
public Date getMappingTime() {
return mappingTime;
}
public void setMappingTime(Date mappingTime) {
this.mappingTime = mappingTime;
}
public String getManualReason() {
return manualReason;
}
public void setManualReason(String manualReason) {
this.manualReason = manualReason;
}
public String getForeignCurrency() {
return foreignCurrency;
}
public void setForeignCurrency(String foreignCurrency) {
this.foreignCurrency = foreignCurrency;
}
public BigDecimal getForeignDebit() {
return foreignDebit;
}
public void setForeignDebit(BigDecimal foreignDebit) {
this.foreignDebit = foreignDebit;
}
public BigDecimal getForeignCredit() {
return foreignCredit;
}
public void setForeignCredit(BigDecimal foreignCredit) {
this.foreignCredit = foreignCredit;
}
public String getCheckedBy() {
return checkedBy;
}
public void setCheckedBy(String checkedBy) {
this.checkedBy = checkedBy;
}
public String getIssuedBy() {
return issuedBy;
}
public void setIssuedBy(String issuedBy) {
this.issuedBy = issuedBy;
}
public String getBookedBy() {
return bookedBy;
}
public void setBookedBy(String bookedBy) {
this.bookedBy = bookedBy;
}
public String getCashier() {
return cashier;
}
public void setCashier(String cashier) {
this.cashier = cashier;
}
public Boolean getRecate() {
return isRecate;
}
public void setRecate(Boolean recate) {
isRecate = recate;
}
public Integer getOriginalPeriod() {
return originalPeriod;
}
public void setOriginalPeriod(Integer originalPeriod) {
this.originalPeriod = originalPeriod;
}
public String getAcctCodeAndNameShow() {
return acctCodeAndNameShow;
}
public void setAcctCodeAndNameShow(String acctCodeAndNameShow) {
this.acctCodeAndNameShow = acctCodeAndNameShow;
}
public String getCustomerCodeAndNameShow() {
return customerCodeAndNameShow;
}
public void setCustomerCodeAndNameShow(String customerCodeAndNameShow) {
this.customerCodeAndNameShow = customerCodeAndNameShow;
}
public String getStdCodeAndNameShow() {
return stdCodeAndNameShow;
}
public void setStdCodeAndNameShow(String stdCodeAndNameShow) {
this.stdCodeAndNameShow = stdCodeAndNameShow;
}
public String getGroupShow() {
return groupShow;
}
public void setGroupShow(String groupShow) {
this.groupShow = groupShow;
}
public int getvIdCount() {
return vIdCount;
}
public void setvIdCount(int vIdCount) {
this.vIdCount = vIdCount;
}
public int getItemIdCount() {
return itemIdCount;
}
public void setItemIdCount(int itemIdCount) {
this.itemIdCount = itemIdCount;
}
public BigDecimal getDebitSum() {
return debitSum;
}
public void setDebitSum(BigDecimal debitSum) {
this.debitSum = debitSum;
}
public BigDecimal getCreditSum() {
return creditSum;
}
public void setCreditSum(BigDecimal creditSum) {
this.creditSum = creditSum;
}
public int getAuditCount() {
return auditCount;
}
public void setAuditCount(int auditCount) {
this.auditCount = auditCount;
}
public VoucherDto extractFromVoucher(Voucher v) {
setVoucherId(v.getVoucherId());
setvId(v.getVid());
setDate(v.getDate());
setGroup(v.getGroup());
setPeriod(v.getPeriod());
setCustomerCode(v.getCustomerCode());
setCustomerName(v.getCustomerName());
setSummary(v.getSummary());
setAcctCode(v.getAcctCode());
setDebit(v.getDebit());
setCredit(v.getCredit());
setAttach(v.getAttach());
if (v.getItemId() != null)
setItemId(Long.parseLong(v.getItemId()));
setCreatedTime(v.getCreateTime());
setOriginalPeriod(v.getOriginalPeriod());
setStatus(v.getStatus());
setStdCode(v.getStdCode());
setMappingReason(v.getMappingReason());
if (!StringUtils.isEmpty(v.getMappingReason()))
setMappingUser(Integer.valueOf(v.getMappingUser()));
setMappingTime(v.getMappingTime());
return this;
}
}
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.vat.entity.Voucher;
import java.math.BigDecimal;
import java.util.Date;
public class VoucherDtoOnlyForImport {
public String VoucherId;
public String vid;
public Date date;
public String Group;
public Integer Period;
public String CustomerCode;
public String CustomerName;
public String Summary;
public String AcctCode;
public BigDecimal Debit;
public BigDecimal Credit;
public Long Attach;
public String ItemId;
public Date CreateTime;
public Integer ImportType;
public String CreatorId;
public Integer MonthId;
public Integer OriginalPeriod;
public Integer Status;
public Integer PartBilledPeriod;
public Integer BilledPeriod;
public Integer getPeriod() {
return Period;
}
public Voucher extractVoucher() {
Voucher voucher = new Voucher();
voucher.setVoucherId(VoucherId);
voucher.setVid(vid);
voucher.setDate(date);
voucher.setGroup(Group);
voucher.setPeriod(Period);
voucher.setCustomerCode(CustomerCode);
voucher.setCustomerName(CustomerName);
voucher.setSummary(Summary);
voucher.setAcctCode(AcctCode);
voucher.setDebit(Debit);
voucher.setCredit(Credit);
voucher.setAttach(Attach);
voucher.setItemId(ItemId);
voucher.setCreateTime(CreateTime);
voucher.setImportType(ImportType);
voucher.setCreatorId(CreatorId);
voucher.setMonthId(MonthId);
voucher.setOriginalPeriod(OriginalPeriod);
voucher.setStatus(Status);
voucher.setPartBilledPeriod(PartBilledPeriod);
voucher.setBilledPeriod(BilledPeriod);
return voucher;
}
}
package pwc.taxtech.atms.vat.dao;
import java.util.List;
public class DataImportModel {
private List<String> sheetNameList;
private List<List<String>> dataList;
private List<String> mappingResult;
private int selectedSheetIndex;
private int lastRowIndex;
private Boolean result;
private String resultMsg;
public List<String> getSheetNameList() {
return sheetNameList;
}
public void setSheetNameList(List<String> sheetNameList) {
this.sheetNameList = sheetNameList;
}
public List<List<String>> getDataList() {
return dataList;
}
public void setDataList(List<List<String>> dataList) {
this.dataList = dataList;
}
public List<String> getMappingResult() {
return mappingResult;
}
public void setMappingResult(List<String> mappingResult) {
this.mappingResult = mappingResult;
}
public int getSelectedSheetIndex() {
return selectedSheetIndex;
}
public void setSelectedSheetIndex(int selectedSheetIndex) {
this.selectedSheetIndex = selectedSheetIndex;
}
public int getLastRowIndex() {
return lastRowIndex;
}
public void setLastRowIndex(int lastRowIndex) {
this.lastRowIndex = lastRowIndex;
}
public Boolean getResult() {
return result;
}
public void setResult(Boolean result) {
this.result = result;
}
public String getResultMsg() {
return resultMsg;
}
public void setResultMsg(String resultMsg) {
this.resultMsg = resultMsg;
}
}
package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.vat.entity.CellComment;
import java.util.List;
import java.util.Optional;
public interface CellCommentService {
OperationResultDto<List<CellComment>> getCellComments(Optional<Long> cellDataId);
}
package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.dto.vatdto.VatEnterpriseAccountDto;
import pwc.taxtech.atms.vat.dpo.TrialBalanceDto;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import java.util.List;
public interface TBDataImportService {
List<TrialBalanceDto> getTrialBalanceData(int fromPeriod, int toPeriod);
List<TrialBalanceDto> getTrialBalanceStdData(int fromPeriod, int toPeriod);
List<VatEnterpriseAccountDto> getEnterpriseAccount();
List<VatEnterpriseAccountDto> getStandardAccount();
}
package pwc.taxtech.atms.vat.service;
import pwc.taxtech.atms.constant.enums.VoucherSearchEnum;
import pwc.taxtech.atms.dpo.PagingDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.vatdto.QueryConditionDto;
import java.util.List;
public interface VoucherService {
/**
* 按分录显示查询
*
* @param listQueryCondition 查询条件模板
* @param mainRelation 查询条件之间的逻辑关系
* @param allJe 显示全部凭证
* @param pagingInfo 分页信息
* @return 分录信息
*/
OperationResultDto<Object> voucherSelectAdvancedByEntry(List<QueryConditionDto> listQueryCondition, VoucherSearchEnum mainRelation, boolean allJe, PagingDto pagingInfo) throws Exception;
/**
* 根据满足查询条件返回总数
*
* @param listQueryCondition 查询条件模板
* @param mainRelation 查询条件之间的逻辑关系
* @param isEntryShow 是否为分录显示
* @param allJe 显示全部凭证
* @return 满足条件的总条数
*/
OperationResultDto<Object> voucherSelectAdvancedCount(List<QueryConditionDto> listQueryCondition, VoucherSearchEnum mainRelation, boolean isEntryShow, boolean allJe) throws Exception;
/**
* 按凭证显示查询
*
* @param listQueryCondition 查询条件模板
* @param mainRelation 查询条件之间的逻辑关系
* @param allJe 显示全部凭证
* @param pagingInfo 分页信息
* @return 凭证信息
*/
OperationResultDto<Object> voucherSelectAdvancedByVoucher(List<QueryConditionDto> listQueryCondition, VoucherSearchEnum voucherSearchEnum, boolean allJe, PagingDto pagingInfo) throws Exception;
}
...@@ -4,14 +4,12 @@ import org.springframework.stereotype.Service; ...@@ -4,14 +4,12 @@ import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.vat.entity.CellComment; import pwc.taxtech.atms.vat.entity.CellComment;
import pwc.taxtech.atms.vat.entity.CellCommentExample; import pwc.taxtech.atms.vat.entity.CellCommentExample;
import pwc.taxtech.atms.vat.service.CellCommentService;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@Service @Service
public class CellCommentServiceImpl extends VatAbstractService implements CellCommentService { public class CellCommentServiceImpl extends VatAbstractService {
@Override
public OperationResultDto<List<CellComment>> getCellComments(Optional<Long> cellDataId) { public OperationResultDto<List<CellComment>> getCellComments(Optional<Long> cellDataId) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
try { try {
......
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.EnumTbImportType;
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.entity.ValidationInfo;
import pwc.taxtech.atms.vat.entity.ValidationInfoExample;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
@Service
public class CustomsInvoiceServiceImpl extends VatAbstractService {
@Autowired
private ValidationInfoMapper validationInfoMapper;
public List<CustomsInvoiceDto> getCustomsInvoicesByPeriodIds(int fromPeriod, int toPeriod) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.setOrderByClause(" PayNum");
example.createCriteria().andPeriodIdBetween(fromPeriod, toPeriod);
List<CustomsInvoiceDto> result = new ArrayList<>();
customsInvoiceMapper.selectByExample(example).forEach(a -> {
CustomsInvoiceDto dto = new CustomsInvoiceDto();
CommonUtils.copyProperties(a, dto);
result.add(dto);
});
int seqNo = 1;
DecimalFormat df = new DecimalFormat("#.00");
for (CustomsInvoiceDto dto : result) {
dto.setSeqNo(seqNo++);
if (dto.getInvoiceAmount() != null) {
dto.setInvoiceAmount(new BigDecimal(df.format(dto.getInvoiceAmount())));
}
if (dto.getInvoiceTaxAmount() != null) {
dto.setInvoiceTaxAmount(new BigDecimal(df.format(dto.getInvoiceTaxAmount())));
}
}
return result;
}
public List<CustomsInvoiceDto> getCustomsInvoicesByPeriodId(Integer periodId) {
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.createCriteria().andPeriodIdEqualTo(periodId);
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) {
CustomsInvoiceDto dto = new CustomsInvoiceDto();
try {
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));
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
return dtos;
}
public OperationResultDto<List<ValidationInfo>> getCustomsInvoicesValidates(Integer periodId) {
ValidationInfoExample example = new ValidationInfoExample();
List<ValidationInfo> result = new ArrayList<>();
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;
}
public OperationResultDto ImportCustomsInvoice(List<CustomsInvoice> custList, int importType, String userId) {
try {
int periodId = 0;
if (importType == EnumTbImportType.CoverImport.getCode()) {
periodId = custList.get(0).getPeriodId().intValue();
CustomsInvoiceExample example = new CustomsInvoiceExample();
example.createCriteria().andPeriodIdEqualTo(periodId);
customsInvoiceMapper.deleteByExample(example);
}
custList.forEach(c -> {
c.setCreatorId(userId);
});
custList.forEach(m -> customsInvoiceMapper.insert(m));
// UpdateCustomsInvoiceValidation(userId, periodId);//todo:[validation] to be continue (neo)
return new OperationResultDto(true, "");
} catch (Exception ex) {
return new OperationResultDto(false, ex.getMessage());
}
}
}
...@@ -905,9 +905,6 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -905,9 +905,6 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
CellDataSourceType cellDataSourceType = CellDataSourceType.getDSType(dataSourceType); CellDataSourceType cellDataSourceType = CellDataSourceType.getDSType(dataSourceType);
String result = StringUtils.EMPTY; String result = StringUtils.EMPTY;
switch (cellDataSourceType) { switch (cellDataSourceType) {
case Voucher:
result = JSON.toJSONString(voucherMapper.selectVoucherWithEnterpriseAccount());
break;
case OutputInvoice: case OutputInvoice:
result = JSON.toJSONString(outputVATInvoiceMapper.selectOutputInvoiceAndItem()); result = JSON.toJSONString(outputVATInvoiceMapper.selectOutputInvoiceAndItem());
break; break;
...@@ -1013,18 +1010,6 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -1013,18 +1010,6 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
} }
} }
itemStrValue = JSON.toJSONString(inputVATInvoiceItemExtendDtos); itemStrValue = JSON.toJSONString(inputVATInvoiceItemExtendDtos);
} else if (dataSource.getType().equals(FormulaDataSourceType.Voucher.getCode())) {
DataSourceDetailExample dataSourceDetailExample = new DataSourceDetailExample();
dataSourceDetailExample.createCriteria().andDataSourceIdEqualTo(datasSourceId).andDataSourceTypeEqualTo(CellDataSourceType.Voucher.getCode());
List<DataSourceDetail> dataSourceDetails = dataSourceDetailMapper.selectByExample(dataSourceDetailExample);
List<Voucher> vouchers = new ArrayList<>();
for (DataSourceDetail dataSourceDetail : dataSourceDetails) {
if (StringUtils.isNotBlank(dataSourceDetail.getItemValue())) {
Voucher voucher = voucherMapper.selectByPrimaryKey(dataSourceDetail.getItemValue());
vouchers.add(voucher);
}
}
itemStrValue = JSON.toJSONString(vouchers);
} else { } else {
itemStrValue = StringUtils.EMPTY; itemStrValue = StringUtils.EMPTY;
} }
......
...@@ -85,7 +85,5 @@ public class VatAbstractService { ...@@ -85,7 +85,5 @@ public class VatAbstractService {
public FtpService ftpService; public FtpService ftpService;
@Autowired @Autowired
public CellDataSourceMapper cellDataSourceMapper; public CellDataSourceMapper cellDataSourceMapper;
@Autowired
public VoucherMapper voucherMapper;
} }
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