Commit 89fcee22 authored by sherlock's avatar sherlock

Merge branch 'dev_oracle_sherlock' into 'dev_oracle'

Dev oracle sherlock

See merge request root/atms!184
parents 3b897680 027c0b45
package pwc.taxtech.atms.controller;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.vatdto.ImportInputInvoiceDto;
import pwc.taxtech.atms.dto.vatdto.ImportInputInvoiceItemDto;
import pwc.taxtech.atms.dto.vatdto.InputVATInvoiceBaseDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.service.impl.IdentityServiceImpl;
import pwc.taxtech.atms.thirdparty.ExcelSheet;
import pwc.taxtech.atms.thirdparty.ExcelUtil;
......@@ -76,11 +76,38 @@ public class InputInvoiceImportController {
return ResponseEntity.ok().body(inputInvoiceDataImportService.getInputInvoiceItemList(fpid));
}
private String getFplx(String fplx){
if(StringUtils.isBlank(fplx)) return "";
switch (fplx){
case "004":
return "增值税专票";
case "007":
return "普票";
case "026":
return "电子发票";
default:
return fplx;
}
}
private int getDownloadFilePath(InputInvoicePreviewQueryParam paras, OutputStream outputStream, String projectId) {
List<InputInvoice> list = inputInvoiceDataImportService.getInputInvoiceTreeViewData(paras, projectId).getList();
if (list.size() == 0) {
return 0;
}
List<InputInvoiceExportDto> inputInvoiceExportDtos = Lists.newArrayList();
for(InputInvoice inputInvoice : list){
InputInvoiceExportDto inputInvoiceExportDto = new InputInvoiceExportDto();
inputInvoiceExportDto.setAmount(inputInvoice.getHJJE());
inputInvoiceExportDto.setCertificationDate(inputInvoice.getRZSJ());
inputInvoiceExportDto.setInvoiceCode(inputInvoice.getFPDM());
inputInvoiceExportDto.setInvoiceDate(inputInvoice.getKPRQ());
inputInvoiceExportDto.setInvoiceNumber(inputInvoice.getFPHM());
inputInvoiceExportDto.setInvoiceTypeName(getFplx(inputInvoice.getFPLX()));
inputInvoiceExportDto.setPeriodId(Integer.parseInt(inputInvoice.getRZSJ().substring(5, 7)));
inputInvoiceExportDto.setSellerTaxNumber(inputInvoice.getXFSH());
inputInvoiceExportDto.setTaxAmount(inputInvoice.getHJSE());
inputInvoiceExportDtos.add(inputInvoiceExportDto);
}
Map<String, String> header = new HashMap<>();
header.put("PeriodId", "期间");
header.put("InvoiceDate", "开票日期");
......@@ -94,7 +121,7 @@ public class InputInvoiceImportController {
ExcelSheet excelSheetA = new ExcelSheet<>();
excelSheetA.setHeaders(header);
excelSheetA.setDataset(list);
excelSheetA.setDataset(inputInvoiceExportDtos);
excelSheetA.setSheetName("sheetA");
......@@ -111,9 +138,20 @@ public class InputInvoiceImportController {
excelSheetB.setHeaders(header2);
excelSheetB.setSheetName("sheetB");
List<InputInvoiceDetail> inputInvoiceItemList = new ArrayList<>();
List<InputInvoiceDetailExportDto> inputInvoiceItemList = new ArrayList<>();
for (InputInvoice item : list) {
inputInvoiceItemList.addAll(inputInvoiceDataImportService.getInputInvoiceItemList(item.getID()));
List<InputInvoiceDetail> inputInvoiceDetailList = inputInvoiceDataImportService.getInputInvoiceItemList(item.getID());
for(InputInvoiceDetail inputInvoiceDetail : inputInvoiceDetailList){
InputInvoiceDetailExportDto inputInvoiceDetailExportDto = new InputInvoiceDetailExportDto();
inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE());
inputInvoiceDetailExportDto.setInvoiceCode(inputInvoiceDetail.getFPDM());
inputInvoiceDetailExportDto.setInvoiceNumber(inputInvoiceDetail.getFPHM());
inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSJ().substring(5, 7)));
inputInvoiceDetailExportDto.setProductionName(inputInvoiceDetail.getSPMC());
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE());
inputInvoiceDetailExportDto.setTaxRate(inputInvoiceDetail.getSLV());
inputInvoiceItemList.add(inputInvoiceDetailExportDto);
}
}
excelSheetB.setDataset(inputInvoiceItemList);
List<ExcelSheet<InputVATInvoiceBaseDto>> sheets = new ArrayList<>();
......
package pwc.taxtech.atms.controller;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
......@@ -16,11 +17,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.CellBriefDto;
import pwc.taxtech.atms.dto.DeleteTemplateParam;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.UpateNameParam;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.exception.ApplicationException;
......@@ -182,4 +179,17 @@ public class TemplateController extends BaseController {
}
return templateService.getByGroupId(templateGroupId, projectId);
}
@RequestMapping(value = "addExistTemplate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<Boolean> addExistTemplate(@RequestBody TemplateAddExistDto templateAddExistDto){
OperationResultDto resultDto = new OperationResultDto();
if(templateAddExistDto.getTemplateGroupId() == null || CollectionUtils.isEmpty(templateAddExistDto.getTemplateIdList())){
resultDto.setResult(false);
return resultDto;
}
templateService.addExistTemplate(templateAddExistDto);
resultDto.setResult(true);
return resultDto;
}
}
package pwc.taxtech.atms.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public class TemplateAddExistDto {
private String reportType;
@JsonProperty("templateGroupID")
private Long templateGroupId;
private List<Long> templateIdList;
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public Long getTemplateGroupId() {
return templateGroupId;
}
public void setTemplateGroupId(Long templateGroupId) {
this.templateGroupId = templateGroupId;
}
public List<Long> getTemplateIdList() {
return templateIdList;
}
public void setTemplateIdList(List<Long> templateIdList) {
this.templateIdList = templateIdList;
}
}
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable;
public class InputInvoiceDetailExportDto implements Serializable {
@ExcelCell(index=5)
private Integer periodId;
@ExcelCell(index=4)
private String invoiceCode;
@ExcelCell(index=6)
private String invoiceNumber;
@ExcelCell(index=2)
private String amount;
@ExcelCell(index=1)
private String taxAmount;
@ExcelCell(index=3)
private String taxRate;
@ExcelCell(index=7)
private String productionName;
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
public String getInvoiceCode() {
return invoiceCode;
}
public void setInvoiceCode(String invoiceCode) {
this.invoiceCode = invoiceCode;
}
public String getInvoiceNumber() {
return invoiceNumber;
}
public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
this.taxAmount = taxAmount;
}
public String getTaxRate() {
return taxRate;
}
public void setTaxRate(String taxRate) {
this.taxRate = taxRate;
}
public String getProductionName() {
return productionName;
}
public void setProductionName(String productionName) {
this.productionName = productionName;
}
}
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.thirdparty.ExcelCell;
import java.io.Serializable;
public class InputInvoiceExportDto implements Serializable {
@ExcelCell(index=6)
private int periodId;
@ExcelCell(index=7)
private String invoiceDate;
@ExcelCell(index=5)
private String invoiceCode;
@ExcelCell(index=8)
private String invoiceNumber;
@ExcelCell(index=9)
private String sellerTaxNumber;
@ExcelCell(index=3)
private String invoiceTypeName;
@ExcelCell(index=4)
private String amount;
@ExcelCell(index=1)
private String taxAmount;
@ExcelCell(index=2)
private String certificationDate;
public int getPeriodId() {
return periodId;
}
public void setPeriodId(int periodId) {
this.periodId = periodId;
}
public String getInvoiceDate() {
return invoiceDate;
}
public void setInvoiceDate(String invoiceDate) {
this.invoiceDate = invoiceDate;
}
public String getInvoiceCode() {
return invoiceCode;
}
public void setInvoiceCode(String invoiceCode) {
this.invoiceCode = invoiceCode;
}
public String getInvoiceNumber() {
return invoiceNumber;
}
public void setInvoiceNumber(String invoiceNumber) {
this.invoiceNumber = invoiceNumber;
}
public String getSellerTaxNumber() {
return sellerTaxNumber;
}
public void setSellerTaxNumber(String sellerTaxNumber) {
this.sellerTaxNumber = sellerTaxNumber;
}
public String getInvoiceTypeName() {
return invoiceTypeName;
}
public void setInvoiceTypeName(String invoiceTypeName) {
this.invoiceTypeName = invoiceTypeName;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getTaxAmount() {
return taxAmount;
}
public void setTaxAmount(String taxAmount) {
this.taxAmount = taxAmount;
}
public String getCertificationDate() {
return certificationDate;
}
public void setCertificationDate(String certificationDate) {
this.certificationDate = certificationDate;
}
@Override
public String toString() {
return "InputInvoice{" +
"periodId=" + periodId +
", invoiceDate='" + invoiceDate + '\'' +
", invoiceCode='" + invoiceCode + '\'' +
", invoiceNumber='" + invoiceNumber + '\'' +
", sellerTaxNumber='" + sellerTaxNumber + '\'' +
", invoiceTypeName='" + invoiceTypeName + '\'' +
", amount='" + amount + '\'' +
", taxAmount='" + taxAmount + '\'' +
", certificationDate='" + certificationDate + '\'' +
'}';
}
}
\ No newline at end of file
package pwc.taxtech.atms.service.impl;
import com.google.common.collect.Lists;
import com.grapecity.documents.excel.C;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
......@@ -8,28 +12,13 @@ import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.TemplateGroupType;
import pwc.taxtech.atms.dpo.TemplateAndGroupDbDto;
import pwc.taxtech.atms.dpo.TemplateUniqDto;
import pwc.taxtech.atms.dto.CellBriefDto;
import pwc.taxtech.atms.dto.DeleteTemplateParam;
import pwc.taxtech.atms.dto.NameDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateDto;
import pwc.taxtech.atms.dto.UpateNameParam;
import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.vatdto.TemplateByGroupDto;
import pwc.taxtech.atms.entity.CellTemplate;
import pwc.taxtech.atms.entity.CellTemplateExample;
import pwc.taxtech.atms.entity.Project;
import pwc.taxtech.atms.entity.ProjectExample;
import pwc.taxtech.atms.entity.Template;
import pwc.taxtech.atms.entity.TemplateExample;
import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.entity.TemplateGroupExample;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
import pwc.taxtech.atms.vat.entity.PeriodTemplateExample;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.groupingBy;
......@@ -37,6 +26,55 @@ import static java.util.stream.Collectors.groupingBy;
@Service
public class TemplateServiceImpl extends AbstractService {
@Autowired
private PeriodTemplateMapper periodTemplateMapper;
public void addExistTemplate(TemplateAddExistDto templateAddExistDto){
TemplateExample t = new TemplateExample();
t.createCriteria().andTemplateGroupIdEqualTo(templateAddExistDto.getTemplateGroupId());
List<Template> selfTemplates = templateMapper.selectByExample(t);
int orderIndex = selfTemplates.size();
TemplateExample templateExample = new TemplateExample();
templateExample.createCriteria().andIdIn(templateAddExistDto.getTemplateIdList());
List<Template> templates = templateMapper.selectByExample(templateExample);
List<CellTemplateConfig> cellTemplateConfigList = Lists.newArrayList();
for(Template x : templates){
// 复制添加template
Long originTemplateId = x.getId();
x.setId(distributedIdService.nextId());
x.setTemplateGroupId(templateAddExistDto.getTemplateGroupId());
x.setOrderIndex(++orderIndex);
templateMapper.insertSelective(x);
// 复制添加cellTemplate
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(originTemplateId);
List<CellTemplate> cellTemplates = cellTemplateMapper.selectByExample(cellTemplateExample);
if(cellTemplates.isEmpty()) return;
cellTemplates.forEach(cellTemplate -> {
// 复制添加cellTemplateConfig
CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample();
cellTemplateConfigExample.createCriteria().andCellTemplateIdEqualTo(cellTemplate.getId())
.andReportTemplateIdEqualTo(originTemplateId);
List<CellTemplateConfig> cellTemplateConfigs = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
cellTemplate.setId(distributedIdService.nextId());
cellTemplate.setReportTemplateId(x.getId());
if(CollectionUtils.isNotEmpty(cellTemplateConfigs)){
CellTemplateConfig cellTemplateConfig = cellTemplateConfigs.get(0);
cellTemplateConfig.setId(distributedIdService.nextId());
cellTemplateConfig.setCellTemplateId(cellTemplate.getId());
cellTemplateConfig.setReportTemplateId(cellTemplate.getReportTemplateId());
cellTemplateConfigList.add(cellTemplateConfig);
}
});
cellTemplateMapper.batchInsert2(cellTemplates);
}
if(cellTemplateConfigList.isEmpty()) return ;
cellTemplateConfigMapper.batchInsert2(cellTemplateConfigList);
}
public List<TemplateDto> get(Long templateGroupId, Integer reportType) {
TemplateExample example = new TemplateExample();
......@@ -269,7 +307,12 @@ public class TemplateServiceImpl extends AbstractService {
taxReturnGroup.setId(templateGroupId);
taxReturnGroup.setName(TemplateGroupType.TaxReturn.name());
List<TemplateDto> templateDtos2 = new ArrayList<>();
templates.stream().filter(x -> x.getTemplateGroupId().equals(templateGroupId)).collect(Collectors.toList()).forEach(a -> {
templates.stream().filter(x -> {
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andTemplateGroupIdEqualTo(templateGroupId)
.andTemplateIdEqualTo(x.getId());
return x.getTemplateGroupId().equals(templateGroupId) && periodTemplateMapper.selectByExample(periodTemplateExample).size() > 0;
}).collect(Collectors.toList()).forEach(a -> {
TemplateDto templateDto = new TemplateDto();
CommonUtils.copyProperties(a, templateDto);
templateDtos2.add(templateDto);
......
......@@ -266,7 +266,8 @@ public class OutputInvoiceServiceImpl {
OutputInvoiceExample e = new OutputInvoiceExample();
e.createCriteria().andXFSHEqualTo(organization.getTaxPayerNumber());
List<String> fpqqlshList = outputInvoiceMapper.selectByExample(e).stream().map(OutputInvoice::getFPQQLSH).collect(Collectors.toList());
rList.stream().filter(a -> fpqqlshList.contains(a.getFpqqlsh())).forEach(x -> {
rList = rList.stream().filter(a -> fpqqlshList.contains(a.getFpqqlsh())).collect(Collectors.toList());
rList.forEach(x -> {
CAL.setTime(x.getInvoiceDate());
x.setPeriodId(CAL.get(Calendar.MONTH) + 1);
});
......
......@@ -108,7 +108,7 @@
<if test="productName!=null and productName!=''">
AND OI.SPMC LIKE concat (
'%',
#{ productName,jdbcType=VARCHAR,'%'}
#{productName,jdbcType=VARCHAR,'%'}
)
</if>
</select>
......
......@@ -8,7 +8,7 @@
$('#busy-indicator-container').show();
var defer = $q.defer();
var octetStreamMime = 'application/octet-stream';
var octetStreamMime = 'application/vnd.ms-excel';
var success = false;
// Get the headers
......
......@@ -5,7 +5,7 @@
$log.debug('VatReportLayoutController.ctor()...');
$scope.$on('refreshGenerateReport', function (event, data) {
//$scope.selectedTemplateId = data.templateId;
// $scope.selectedTemplateId = data.templateId;
loadTemplateMenu();
});
var loadTemplateMenu = function () {
......@@ -18,7 +18,7 @@
//房地产
//projectID = '0cf0945f-d41c-4df3-8235-ae693d5e724d';
$q.all([
templateGroupService.getGroupTemplateByGroupID(6390933830635520, projectID),
templateGroupService.getGroupTemplateByGroupID(48372654336679936, projectID),
vatReportService.getTemplate(vatSessionService.project.id, constant.serviceType.VAT, vatSessionService.month)
]).then(function (result) {
if (!_.isEmpty(result[0]) && !_.isEmpty(result[0].data) && !_.isEmpty(result[0].data.data)
......
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