Commit b4f3bdf6 authored by gary's avatar gary

1、fixbug

2、分析数据导入的导出
parent ed3867cb
...@@ -51,12 +51,19 @@ public class AnalysisController extends BaseController { ...@@ -51,12 +51,19 @@ public class AnalysisController extends BaseController {
} }
@RequestMapping(value = "downloadDomesticFile/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "downloadDomesticFile/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadCILQueryData(@RequestBody AnalysisDomesticlParam param, HttpServletResponse response) { public void downloadDomesticFile(@RequestBody AnalysisDomesticlParam param, HttpServletResponse response) {
logger.debug("enter downloadDomesticFile"); logger.debug("enter downloadDomesticFile");
String fileName="testFile"; String fileName="testFile";
analysisServiceImpl.downloadDomesticFile(response, param, fileName); analysisServiceImpl.downloadDomesticFile(response, param, fileName);
} }
@RequestMapping(value = "downloadInternationalFile/get", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadInternationalFile(@RequestBody AnalysisInternationlParam param, HttpServletResponse response) {
logger.debug("enter downloadInternationalFile");
String fileName="testFile";
analysisServiceImpl.downloadInternationalFile(response, param, fileName);
}
@ResponseBody @ResponseBody
@RequestMapping(value = "getAnalysisInternationalCompanyList", method = RequestMethod.GET) @RequestMapping(value = "getAnalysisInternationalCompanyList", method = RequestMethod.GET)
......
...@@ -9,5 +9,7 @@ public class ErrorMessageCN { ...@@ -9,5 +9,7 @@ public class ErrorMessageCN {
public static final String DoNotSelectCompany = "非选定主体"; public static final String DoNotSelectCompany = "非选定主体";
public static final String StrctureRepeat = "层级重复!"; public static final String StrctureRepeat = "层级重复!";
public static final String BusinssUnitRepeat = "事业部重复!"; public static final String BusinssUnitRepeat = "事业部重复!";
public static final String BusinssUnitUpdateFailed = "未对事业部名称或状态进行修改!";
public static final String OrgStructureFailed = "未对事业部名称或状态进行修改!";
} }
package pwc.taxtech.atms.constant.enums;
public enum EnumAnalysisExpTempPath {
EachTaxAmount(0, "/analysis_excel_template/tax_data.xlsx"),
ActualReturnTax(1, "/analysis_excel_template/actual_tax_return.xlsx"),
GMVSubsidy(2, "/analysis_excel_template/gmv_subsidy.xlsx"),
EmployeeNum(3, "/analysis_excel_template/employ_num.xlsx"),
DriverNum(4, "/analysis_excel_template/driver_num.xlsx"),
BUData(100, "/analysis_excel_template/international_bu_data.xlsx"),
TaxData(101, "/analysis_excel_template/international_tax_data.xlsx"),
;
private Integer code;
private String path;
EnumAnalysisExpTempPath(Integer code, String path) {
this.code = code;
this.path = path;
}
public Integer getCode() {
return code;
}
public String getPath() {
return path;
}
public static EnumAnalysisExpTempPath fromCode(Integer code){
for(EnumAnalysisExpTempPath enu: EnumAnalysisExpTempPath.values()){
if(enu.getCode().intValue()==code.intValue())return enu;
}
return null;
}
public static String getPath(Integer code){
for(EnumAnalysisExpTempPath eaetp: EnumAnalysisExpTempPath.values()){
if(eaetp.getCode().intValue()==code.intValue())return eaetp.path;
}
return null;
}
}
...@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.BusinessUnitDto; import pwc.taxtech.atms.dto.BusinessUnitDto;
import pwc.taxtech.atms.dto.BusinessUnitInputDto; import pwc.taxtech.atms.dto.BusinessUnitInputDto;
import pwc.taxtech.atms.dto.IdModel; import pwc.taxtech.atms.dto.IdModel;
...@@ -36,9 +37,9 @@ public class BusinessUnitController { ...@@ -36,9 +37,9 @@ public class BusinessUnitController {
// @ApiOperation(value = "主数据事业部增加", notes = "根据Request Body的信息添加一个或多个新的事业部数据") // @ApiOperation(value = "主数据事业部增加", notes = "根据Request Body的信息添加一个或多个新的事业部数据")
@RequestMapping(value = "/add", method = RequestMethod.POST) @RequestMapping(value = "/add", method = RequestMethod.POST)
public void addBusinessUnits(@RequestBody List<BusinessUnitInputDto> businessUnitDtoList) { public ApiResultDto addBusinessUnits(@RequestBody List<BusinessUnitInputDto> businessUnitDtoList) {
logger.debug("BusinessUnitController addBusinessUnits"); logger.debug("BusinessUnitController addBusinessUnits");
businessUnitService.addBusinessUnits(businessUnitDtoList); return businessUnitService.addBusinessUnits(businessUnitDtoList);
} }
// @ApiOperation(value = "主数据事业部删除", notes = "根据给定的id删除一条事业部数据") // @ApiOperation(value = "主数据事业部删除", notes = "根据给定的id删除一条事业部数据")
...@@ -52,7 +53,7 @@ public class BusinessUnitController { ...@@ -52,7 +53,7 @@ public class BusinessUnitController {
// @ApiOperation(value = "主数据事业部修改", notes = "根据Request Body的信息修改一个或多个事业部数据") // @ApiOperation(value = "主数据事业部修改", notes = "根据Request Body的信息修改一个或多个事业部数据")
@RequestMapping(method = RequestMethod.PUT) @RequestMapping(method = RequestMethod.PUT)
public @ResponseBody public @ResponseBody
Boolean updateBusinessUnits(@RequestBody List<BusinessUnitDto> businessUnitDtoList) { ApiResultDto updateBusinessUnits(@RequestBody List<BusinessUnitDto> businessUnitDtoList) {
logger.debug("BusinessUnitController updateBusinessUnit"); logger.debug("BusinessUnitController updateBusinessUnit");
return businessUnitService.updateBusinessUnits(businessUnitDtoList); return businessUnitService.updateBusinessUnits(businessUnitDtoList);
} }
......
...@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.IdModel; import pwc.taxtech.atms.dto.IdModel;
import pwc.taxtech.atms.dto.OrganizationStructureDto; import pwc.taxtech.atms.dto.OrganizationStructureDto;
import pwc.taxtech.atms.dto.OrganizationStructureInputDto; import pwc.taxtech.atms.dto.OrganizationStructureInputDto;
...@@ -35,9 +36,9 @@ public class OrganizationStructureController { ...@@ -35,9 +36,9 @@ public class OrganizationStructureController {
// @ApiOperation(value = "主数据机构层级增加") // @ApiOperation(value = "主数据机构层级增加")
// @ApiImplicitParam(name = "organizationStructureDtoList", value = "organizationStructureDto List", required = true, dataType = "List<OrganizationStructureDto>") // @ApiImplicitParam(name = "organizationStructureDtoList", value = "organizationStructureDto List", required = true, dataType = "List<OrganizationStructureDto>")
@RequestMapping(value = "/add", method = RequestMethod.POST) @RequestMapping(value = "/add", method = RequestMethod.POST)
public void addOrganizationStructures(@RequestBody List<OrganizationStructureInputDto> organizationStructureDtoList) { public ApiResultDto addOrganizationStructures(@RequestBody List<OrganizationStructureInputDto> organizationStructureDtoList) {
logger.debug("OrganizationStructureController /add"); logger.debug("OrganizationStructureController /add");
organizationStructureService.addOrganizationStructures(organizationStructureDtoList); return organizationStructureService.addOrganizationStructures(organizationStructureDtoList);
} }
// @ApiOperation(value = "主数据机构层级删除") // @ApiOperation(value = "主数据机构层级删除")
...@@ -53,7 +54,7 @@ public class OrganizationStructureController { ...@@ -53,7 +54,7 @@ public class OrganizationStructureController {
// @ApiImplicitParam(name = "organizationStructureDtoList", value = "organizationStructureDto List", required = true, dataType = "List<OrganizationStructureDto>") // @ApiImplicitParam(name = "organizationStructureDtoList", value = "organizationStructureDto List", required = true, dataType = "List<OrganizationStructureDto>")
@RequestMapping(method = RequestMethod.PUT) @RequestMapping(method = RequestMethod.PUT)
public @ResponseBody public @ResponseBody
Boolean updateOrganizationStructure(@RequestBody List<OrganizationStructureInputDto> organizationStructureDtoList) { ApiResultDto updateOrganizationStructure(@RequestBody List<OrganizationStructureInputDto> organizationStructureDtoList) {
logger.debug("OrganizationStructureController update"); logger.debug("OrganizationStructureController update");
return organizationStructureService.updateOrganizationStructures(organizationStructureDtoList); return organizationStructureService.updateOrganizationStructures(organizationStructureDtoList);
} }
......
package pwc.taxtech.atms.dto.analysis;
import java.math.BigDecimal;
/**
* @Auther: Gary J Li
* @Date: 15/03/2019 00:30
* @Description:
*/
public class AnalysisDriverNumDto {
private String driverType;
private BigDecimal driverNum;
public String getDriverType() {
return driverType;
}
public void setDriverType(String driverType) {
this.driverType = driverType;
}
public BigDecimal getDriverNum() {
return driverNum;
}
public void setDriverNum(BigDecimal driverNum) {
this.driverNum = driverNum;
}
}
...@@ -7,8 +7,11 @@ import org.springframework.stereotype.Service; ...@@ -7,8 +7,11 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.analysis.dao.*; import pwc.taxtech.atms.analysis.dao.*;
import pwc.taxtech.atms.analysis.entity.*; import pwc.taxtech.atms.analysis.entity.*;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.message.ErrorMessageCN; import pwc.taxtech.atms.common.message.ErrorMessageCN;
import pwc.taxtech.atms.common.util.DateUtils; import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.constant.enums.EnumAnalysisExpTempPath;
import pwc.taxtech.atms.constant.enums.EnumAnalysisImportType;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.analysis.*; import pwc.taxtech.atms.dto.analysis.*;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
...@@ -16,6 +19,7 @@ import pwc.taxtech.atms.exception.ServiceException; ...@@ -16,6 +19,7 @@ import pwc.taxtech.atms.exception.ServiceException;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.NumberFormat; import java.text.NumberFormat;
...@@ -70,7 +74,7 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -70,7 +74,7 @@ public class AnalysisServiceImpl extends BaseService {
Map<String, List<AnalysisTax>> actrs = Map<String, List<AnalysisTax>> actrs =
list.stream().collect(Collectors.groupingBy(AnalysisTax::getCompanyName)); list.stream().collect(Collectors.groupingBy(AnalysisTax::getCompanyName));
actrs.forEach((k, v) -> processAts(k, v,dtos)); actrs.forEach((k, v) -> processAts(k, v,dtos));
objects.add(dtos); objects.addAll(dtos);
break; break;
case 1: case 1:
AnalysisActualTaxReturnExample analysisActualTaxReturnExample = new AnalysisActualTaxReturnExample(); AnalysisActualTaxReturnExample analysisActualTaxReturnExample = new AnalysisActualTaxReturnExample();
...@@ -80,13 +84,13 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -80,13 +84,13 @@ public class AnalysisServiceImpl extends BaseService {
Map<String, List<AnalysisActualTaxReturn>> actrs2 = Map<String, List<AnalysisActualTaxReturn>> actrs2 =
list2.stream().collect(Collectors.groupingBy(AnalysisActualTaxReturn::getCompanyName)); list2.stream().collect(Collectors.groupingBy(AnalysisActualTaxReturn::getCompanyName));
actrs2.forEach((k, v) -> processActrs(k, v,dtos2)); actrs2.forEach((k, v) -> processActrs(k, v,dtos2));
objects.add(dtos2); objects.addAll(dtos2);
return objects; return objects;
case 2: case 2:
AnalysisGmvSubsidyExample analysisGmvSubsidyExample = new AnalysisGmvSubsidyExample(); AnalysisGmvSubsidyExample analysisGmvSubsidyExample = new AnalysisGmvSubsidyExample();
analysisGmvSubsidyExample.createCriteria().andPeriodEqualTo(period); analysisGmvSubsidyExample.createCriteria().andPeriodEqualTo(period);
List<AnalysisGMVSubsidyDto> dtos3 = generalDtos(analysisGmvSubsidyMapper.selectByExample(analysisGmvSubsidyExample)); List<AnalysisGMVSubsidyDto> dtos3 = generalDtos(analysisGmvSubsidyMapper.selectByExample(analysisGmvSubsidyExample));
objects.add(dtos3); objects.addAll(dtos3);
break; break;
case 3: case 3:
AnalysisEmployeeNumExample analysisEmployeeNumExample = new AnalysisEmployeeNumExample(); AnalysisEmployeeNumExample analysisEmployeeNumExample = new AnalysisEmployeeNumExample();
...@@ -96,7 +100,8 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -96,7 +100,8 @@ public class AnalysisServiceImpl extends BaseService {
case 4: case 4:
AnalysisDriverNumExample analysisDriverNumExample = new AnalysisDriverNumExample(); AnalysisDriverNumExample analysisDriverNumExample = new AnalysisDriverNumExample();
analysisDriverNumExample.createCriteria().andPeriodEqualTo(period); analysisDriverNumExample.createCriteria().andPeriodEqualTo(period);
objects.addAll(analysisDriverNumMapper.selectByExample(analysisDriverNumExample)); List<AnalysisDriverNumDto> dtos4 = processDns(analysisDriverNumMapper.selectByExample(analysisDriverNumExample));
objects.addAll(dtos4);
break; break;
default: default:
break; break;
...@@ -144,6 +149,29 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -144,6 +149,29 @@ public class AnalysisServiceImpl extends BaseService {
dtos.add(dto); dtos.add(dto);
} }
private List<AnalysisDriverNumDto> processDns(List<AnalysisDriverNum> list) {
List<AnalysisDriverNumDto> dtos = Lists.newArrayList();
list.forEach(l->{
AnalysisDriverNumDto dto1 = new AnalysisDriverNumDto();
dto1.setDriverType("加盟");
dto1.setDriverNum(l.getJoinInAmount());
AnalysisDriverNumDto dto2 = new AnalysisDriverNumDto();
dto2.setDriverType("自营");
dto2.setDriverNum(l.getSelfSupportAmount());
AnalysisDriverNumDto dto3 = new AnalysisDriverNumDto();
dto3.setDriverType("直营");
dto3.setDriverNum(l.getDirectSaleAmount());
AnalysisDriverNumDto dto4 = new AnalysisDriverNumDto();
dto4.setDriverType("对公");
dto4.setDriverNum(l.getRightPublicAmount());
dtos.add(dto1);
dtos.add(dto2);
dtos.add(dto3);
dtos.add(dto4);
});
return dtos;
}
private BigDecimal getTaxAmountByGroup(List<AnalysisActualTaxReturn> v, String group) { private BigDecimal getTaxAmountByGroup(List<AnalysisActualTaxReturn> v, String group) {
List<AnalysisActualTaxReturn> filterRes = v.stream().filter(o-> group.equals(o.getTaxReturnGroup())).collect(Collectors.toList()); List<AnalysisActualTaxReturn> filterRes = v.stream().filter(o-> group.equals(o.getTaxReturnGroup())).collect(Collectors.toList());
BigDecimal res = filterRes.size()>0?filterRes.get(0).getTaxReturnAmount():BigDecimal.ZERO; BigDecimal res = filterRes.size()>0?filterRes.get(0).getTaxReturnAmount():BigDecimal.ZERO;
...@@ -553,7 +581,7 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -553,7 +581,7 @@ public class AnalysisServiceImpl extends BaseService {
} }
} }
public Object displayAnalysisInternationalImportData(AnalysisInternationlParam param) { public List<Object> displayAnalysisInternationalImportData(AnalysisInternationlParam param) {
List<Object> objects = new ArrayList<>(); List<Object> objects = new ArrayList<>();
Integer period = DateUtils.strToPeriod(param.getPeriod()); Integer period = DateUtils.strToPeriod(param.getPeriod());
String country = param.getCountry(); String country = param.getCountry();
...@@ -614,31 +642,45 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -614,31 +642,45 @@ public class AnalysisServiceImpl extends BaseService {
return objects; return objects;
} }
public void downloadDomesticFile(HttpServletResponse response, AnalysisDomesticlParam param, String fileName) { public HttpServletResponse downloadDomesticFile(HttpServletResponse response, AnalysisDomesticlParam param, String fileName) {
/*String excelTemplatePathInClassPath = ExportTemplatePathConstant.CERTIFIED_INVOICES_LIST; String excelTemplatePathInClassPath = EnumAnalysisExpTempPath.getPath(param.getType());
CertifiedInvoicesListCondition condition = beanUtil.copyProperties(param, new CertifiedInvoicesListCondition()); List<Object> datas = displayAnalysisImportData(param.getType(),param.getPeriod());
List<CertifiedInvoicesList> datas = certifiedInvoicesListMapper.selectByCondition(condition);
if(datas.size()<1){ if(datas.size()<1){
throw new ServiceException(ErrorMessage.ExportFailed); throw new ServiceException(ErrorMessage.ExportFailed);
} }
CertifiedInvoicesListHeader header = new CertifiedInvoicesListHeader(); OutputStream outputStream = commonDocumentHelper.toXlsxFileUsingJxls(datas, excelTemplatePathInClassPath);
Organization org = organizationMapper.selectByPrimaryKey(param.getOrgId());
header.setTaxPayerNumber(org.getTaxPayerNumber());
header.setPeriod(param.getPeriodStart());
header.setUnit(datas.get(0).getUnit());
List<CertifiedInvoicesListDto> dtoList = Lists.newArrayList();
datas.forEach(cil -> {
CertifiedInvoicesListDto dto = beanUtil.copyProperties(cil, new CertifiedInvoicesListDto());
dtoList.add(dto);
});
OutputStream outputStream = commonDocumentHelper.toXlsxFileUsingJxls(header,dtoList, excelTemplatePathInClassPath);
try { try {
return responseMessageBuilder.getDownloadTmpResponseMessage(response, outputStream, fileName); return responseMessageBuilder.getDownloadTmpResponseMessage(response, outputStream, fileName);
} catch (Exception e) { } catch (Exception e) {
logger.error(String.format("导出已认证发票清单异常:%s",e.getMessage())); logger.error(String.format("导出国内税数据异常:%s",e.getMessage()));
} }
return null;*/ return null;
}
public HttpServletResponse downloadInternationalFile(HttpServletResponse response, AnalysisInternationlParam param, String fileName) {
String excelTemplatePathInClassPath = EnumAnalysisExpTempPath.getPath(param.getType());
List<Object> datas = Lists.newArrayList();
if(param.getType().equals(EnumAnalysisImportType.InternationalBuData.getCode())){
Integer period = DateUtils.strToPeriod(param.getPeriod());
String country = param.getCountry();
String companyName = param.getCompanyName();
AnalysisInternationalBusinessDataExample analysisInternationalBusinessDataExample = new AnalysisInternationalBusinessDataExample();
analysisInternationalBusinessDataExample.createCriteria().andPeriodEqualTo(period).andCompanyNameEqualTo(companyName).andCountryEqualTo(country);
List<AnalysisInternationalBusinessData> list = analysisInternationalBusinessDataMapper.selectByExample(analysisInternationalBusinessDataExample);
datas.addAll(list);
}else{
datas = displayAnalysisInternationalImportData(param);
}
if(datas.size()<1){
throw new ServiceException(ErrorMessage.ExportFailed);
}
OutputStream outputStream = commonDocumentHelper.toXlsxFileUsingJxls(datas, excelTemplatePathInClassPath);
try {
return responseMessageBuilder.getDownloadTmpResponseMessage(response, outputStream, fileName);
} catch (Exception e) {
logger.error(String.format("导出国际税数据异常:%s",e.getMessage()));
}
return null;
} }
public List<String> getAnalysisInternationalCompanyList(Integer type, String periodStr) { public List<String> getAnalysisInternationalCompanyList(Integer type, String periodStr) {
...@@ -673,8 +715,6 @@ public class AnalysisServiceImpl extends BaseService { ...@@ -673,8 +715,6 @@ public class AnalysisServiceImpl extends BaseService {
return countryList; return countryList;
} }
private String getCellStringValue(Cell cell) { private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) { if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return cell.getStringCellValue(); return cell.getStringCellValue();
......
...@@ -23,9 +23,9 @@ public class BaseService { ...@@ -23,9 +23,9 @@ public class BaseService {
@Autowired @Autowired
protected BeanUtil beanUtil; protected BeanUtil beanUtil;
@Autowired @Autowired
protected RestTemplate restTemplate;/* protected RestTemplate restTemplate;
@Autowired @Autowired
protected CommonDocumentHelper commonDocumentHelper;*/ protected CommonDocumentHelper commonDocumentHelper;
@Autowired @Autowired
protected ResponseMessageBuilder responseMessageBuilder; protected ResponseMessageBuilder responseMessageBuilder;
......
...@@ -14,15 +14,12 @@ import pwc.taxtech.atms.common.OperationAction; ...@@ -14,15 +14,12 @@ import pwc.taxtech.atms.common.OperationAction;
import pwc.taxtech.atms.common.OperationModule; import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.common.message.ErrorMessageCN; import pwc.taxtech.atms.common.message.ErrorMessageCN;
import pwc.taxtech.atms.dao.BusinessUnitMapper; import pwc.taxtech.atms.dao.BusinessUnitMapper;
import pwc.taxtech.atms.dto.BusinessUnitDto; import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.BusinessUnitInputDto;
import pwc.taxtech.atms.dto.IdModel;
import pwc.taxtech.atms.dto.OperationLogDto;
import pwc.taxtech.atms.dto.UpdateLogParams;
import pwc.taxtech.atms.entity.BusinessUnit; import pwc.taxtech.atms.entity.BusinessUnit;
import pwc.taxtech.atms.entity.BusinessUnitExample; import pwc.taxtech.atms.entity.BusinessUnitExample;
import pwc.taxtech.atms.entity.BusinessUnitExample.Criteria; import pwc.taxtech.atms.entity.BusinessUnitExample.Criteria;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.exception.ServiceException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -56,17 +53,25 @@ public class BusinessUnitServiceImpl { ...@@ -56,17 +53,25 @@ public class BusinessUnitServiceImpl {
} }
@Transactional @Transactional
public void addBusinessUnits(List<BusinessUnitInputDto> businessUnitDtoList) { public ApiResultDto addBusinessUnits(List<BusinessUnitInputDto> businessUnitDtoList) {
logger.debug("BusinessUnitServiceImpl addBusinessUnits"); logger.debug("BusinessUnitServiceImpl addBusinessUnits");
ApiResultDto res = ApiResultDto.success();
if (businessUnitDtoList.isEmpty()) { if (businessUnitDtoList.isEmpty()) {
throw new ApplicationException(CommonConstants.JSONNULLOBJECT); throw new ApplicationException(CommonConstants.JSONNULLOBJECT);
} }
for (BusinessUnitInputDto businessUnitDto : businessUnitDtoList) { for (BusinessUnitInputDto businessUnitDto : businessUnitDtoList) {
addBusinessUnit(businessUnitDto); res = addBusinessUnit(businessUnitDto);
if(ApiResultDto.FAILED == res.getCode()) break;
} }
return res;
} }
public void addBusinessUnit(BusinessUnitInputDto businessUnitDto) { public ApiResultDto addBusinessUnit(BusinessUnitInputDto businessUnitDto) {
BusinessUnitExample example = new BusinessUnitExample();
example.createCriteria().andNameEqualTo(businessUnitDto.getName());
if(businessUnitMapper.countByExample(example)>0){
return ApiResultDto.fail(ErrorMessageCN.BusinssUnitRepeat);
}
BusinessUnit businessUnit = rotateBusinessUnitDtoForInput(businessUnitDto); BusinessUnit businessUnit = rotateBusinessUnitDtoForInput(businessUnitDto);
businessUnit.setId(CommonUtils.getUUID()); businessUnit.setId(CommonUtils.getUUID());
businessUnit.setCreateTime(new Date()); businessUnit.setCreateTime(new Date());
...@@ -80,6 +85,7 @@ public class BusinessUnitServiceImpl { ...@@ -80,6 +85,7 @@ public class BusinessUnitServiceImpl {
operationLogDto.setAction(OperationAction.New.value()); operationLogDto.setAction(OperationAction.New.value());
operationLogDto.setLogType(OperateLogType.OperationLogBasicData.value()); operationLogDto.setLogType(OperateLogType.OperationLogBasicData.value());
operationLogService.addOperationLog(operationLogDto); operationLogService.addOperationLog(operationLogDto);
return ApiResultDto.success();
} }
@Transactional @Transactional
...@@ -109,11 +115,11 @@ public class BusinessUnitServiceImpl { ...@@ -109,11 +115,11 @@ public class BusinessUnitServiceImpl {
} }
@Transactional @Transactional
public Boolean updateBusinessUnits(List<BusinessUnitDto> businessUnitDtoList) { public ApiResultDto updateBusinessUnits(List<BusinessUnitDto> businessUnitDtoList) {
logger.debug("BusinessUnitServiceImpl updateBusinessUnits"); logger.debug("BusinessUnitServiceImpl updateBusinessUnits");
if (businessUnitDtoList.isEmpty()) { if (businessUnitDtoList.isEmpty()) {
throw new ApplicationException(CommonConstants.JSONNULLOBJECT); return ApiResultDto.fail(CommonConstants.JSONNULLOBJECT);
} }
for (BusinessUnitDto businessUnitDto : businessUnitDtoList) { for (BusinessUnitDto businessUnitDto : businessUnitDtoList) {
...@@ -121,16 +127,17 @@ public class BusinessUnitServiceImpl { ...@@ -121,16 +127,17 @@ public class BusinessUnitServiceImpl {
boolean isStatusChangeOperation = false; boolean isStatusChangeOperation = false;
if (businessUnitDto == null || !StringUtils.hasText(businessUnitDto.getId())) { if (businessUnitDto == null || !StringUtils.hasText(businessUnitDto.getId())) {
throw new ApplicationException("primary key can't be null"); return ApiResultDto.fail("primary key can't be null");
} }
// current businessUnit // current businessUnit
BusinessUnit businessUnit = businessUnitMapper.selectByPrimaryKey(businessUnitDto.getId()); BusinessUnit businessUnit = businessUnitMapper.selectByPrimaryKey(businessUnitDto.getId());
if (businessUnit == null) { if (businessUnit == null) {
throw new ApplicationException("can't find business unit, id: " + businessUnitDto.getId()); return ApiResultDto.fail("can't find business unit, id: " + businessUnitDto.getId());
} }
if(businessUnit.getName().equals(businessUnitDto.getName())){ if(businessUnitDto.getIsActive().equals(businessUnit.getIsActive())&&
throw new ApplicationException(ErrorMessageCN.BusinssUnitRepeat); businessUnit.getName().equals(businessUnitDto.getName())){
return ApiResultDto.fail(ErrorMessageCN.BusinssUnitUpdateFailed);
} }
// copy current businessUnit as tmp // copy current businessUnit as tmp
...@@ -163,8 +170,7 @@ public class BusinessUnitServiceImpl { ...@@ -163,8 +170,7 @@ public class BusinessUnitServiceImpl {
operationLogService.updateDataAddLog(updateLogParams); operationLogService.updateDataAddLog(updateLogParams);
} }
} }
return ApiResultDto.success();
return true;
} }
private List<BusinessUnitDto> rotateBusinessUnitList(List<BusinessUnit> businessUnitList) { private List<BusinessUnitDto> rotateBusinessUnitList(List<BusinessUnit> businessUnitList) {
......
...@@ -14,11 +14,7 @@ import pwc.taxtech.atms.common.OperationAction; ...@@ -14,11 +14,7 @@ import pwc.taxtech.atms.common.OperationAction;
import pwc.taxtech.atms.common.OperationModule; import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.common.message.ErrorMessageCN; import pwc.taxtech.atms.common.message.ErrorMessageCN;
import pwc.taxtech.atms.dao.OrganizationStructureMapper; import pwc.taxtech.atms.dao.OrganizationStructureMapper;
import pwc.taxtech.atms.dto.IdModel; import pwc.taxtech.atms.dto.*;
import pwc.taxtech.atms.dto.OperationLogDto;
import pwc.taxtech.atms.dto.OrganizationStructureDto;
import pwc.taxtech.atms.dto.OrganizationStructureInputDto;
import pwc.taxtech.atms.dto.UpdateLogParams;
import pwc.taxtech.atms.entity.OrganizationStructure; import pwc.taxtech.atms.entity.OrganizationStructure;
import pwc.taxtech.atms.entity.OrganizationStructureExample; import pwc.taxtech.atms.entity.OrganizationStructureExample;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
...@@ -53,24 +49,26 @@ public class OrganizationStructureServiceImpl { ...@@ -53,24 +49,26 @@ public class OrganizationStructureServiceImpl {
return rotateOrganizationStructureList(organizationStructureList); return rotateOrganizationStructureList(organizationStructureList);
} }
public void addOrganizationStructures(List<OrganizationStructureInputDto> organizationStructureDtoList) { public ApiResultDto addOrganizationStructures(List<OrganizationStructureInputDto> organizationStructureDtoList) {
logger.debug("OrganizationStructureService addOrganizationStructure"); logger.debug("OrganizationStructureService addOrganizationStructure");
logger.debug("organization structure to add: {}", JSON.toJSONString(organizationStructureDtoList, true)); logger.debug("organization structure to add: {}", JSON.toJSONString(organizationStructureDtoList, true));
ApiResultDto res = ApiResultDto.success();
if (organizationStructureDtoList.isEmpty()) { if (organizationStructureDtoList.isEmpty()) {
throw new ApplicationException(CommonConstants.JSONNULLOBJECT); return ApiResultDto.fail(CommonConstants.JSONNULLOBJECT);
} }
for (OrganizationStructureInputDto organizationStructureDto : organizationStructureDtoList) { for (OrganizationStructureInputDto organizationStructureDto : organizationStructureDtoList) {
addOrganizationStructure(organizationStructureDto); res = addOrganizationStructure(organizationStructureDto);
if(ApiResultDto.FAILED == res.getCode()) break;
} }
return res;
} }
public void addOrganizationStructure(OrganizationStructureInputDto organizationStructureDto) { public ApiResultDto addOrganizationStructure(OrganizationStructureInputDto organizationStructureDto) {
OrganizationStructureExample example = new OrganizationStructureExample(); OrganizationStructureExample example = new OrganizationStructureExample();
example.createCriteria().andNameEqualTo(organizationStructureDto.getName()); example.createCriteria().andNameEqualTo(organizationStructureDto.getName());
if(organizationStructureMapper.countByExample(example)>0){ if(organizationStructureMapper.countByExample(example)>0){
throw new ApplicationException(ErrorMessageCN.StrctureRepeat); return ApiResultDto.fail(ErrorMessageCN.StrctureRepeat);
} }
OrganizationStructure organizationStructure = rotateOrganizationStructureDto(organizationStructureDto); OrganizationStructure organizationStructure = rotateOrganizationStructureDto(organizationStructureDto);
organizationStructure.setId(CommonUtils.getUUID()); organizationStructure.setId(CommonUtils.getUUID());
...@@ -84,6 +82,7 @@ public class OrganizationStructureServiceImpl { ...@@ -84,6 +82,7 @@ public class OrganizationStructureServiceImpl {
operationLogDto.setOperationObject(organizationStructureDto.getName()); operationLogDto.setOperationObject(organizationStructureDto.getName());
operationLogDto.setAction(OperationAction.New.value()); operationLogDto.setAction(OperationAction.New.value());
operationLogService.addOperationLog(operationLogDto); operationLogService.addOperationLog(operationLogDto);
return ApiResultDto.success();
} }
private void makeUpOperationLogDto(OperationLogDto operationLogDto) { private void makeUpOperationLogDto(OperationLogDto operationLogDto) {
...@@ -115,12 +114,12 @@ public class OrganizationStructureServiceImpl { ...@@ -115,12 +114,12 @@ public class OrganizationStructureServiceImpl {
return result; return result;
} }
public Boolean updateOrganizationStructures(List<OrganizationStructureInputDto> organizationStructureDtoList) { public ApiResultDto updateOrganizationStructures(List<OrganizationStructureInputDto> organizationStructureDtoList) {
logger.debug("OrganizationStructureService updateOrganizationStructures"); logger.debug("OrganizationStructureService updateOrganizationStructures");
logger.debug("organization structure to update: {}", JSON.toJSONString(organizationStructureDtoList, true)); logger.debug("organization structure to update: {}", JSON.toJSONString(organizationStructureDtoList, true));
if (organizationStructureDtoList.isEmpty()) { if (organizationStructureDtoList.isEmpty()) {
throw new ApplicationException(CommonConstants.JSONNULLOBJECT); return ApiResultDto.fail(CommonConstants.JSONNULLOBJECT);
} }
for (OrganizationStructureInputDto organizationStructureDto : organizationStructureDtoList) { for (OrganizationStructureInputDto organizationStructureDto : organizationStructureDtoList) {
...@@ -128,14 +127,18 @@ public class OrganizationStructureServiceImpl { ...@@ -128,14 +127,18 @@ public class OrganizationStructureServiceImpl {
boolean isStatusChangeOperation = false; boolean isStatusChangeOperation = false;
if (organizationStructureDto == null || !StringUtils.hasText(organizationStructureDto.getId())) { if (organizationStructureDto == null || !StringUtils.hasText(organizationStructureDto.getId())) {
throw new ApplicationException("primary key can't be null"); return ApiResultDto.fail("primary key can't be null");
} }
// current OrganizationStructure // current OrganizationStructure
OrganizationStructure organizationStructure = organizationStructureMapper OrganizationStructure organizationStructure = organizationStructureMapper
.selectByPrimaryKey(organizationStructureDto.getId()); .selectByPrimaryKey(organizationStructureDto.getId());
if (organizationStructure == null) { if (organizationStructure == null) {
throw new ApplicationException("can't find organizationStructure, id: " + organizationStructureDto.getId()); return ApiResultDto.fail("can't find organizationStructure, id: " + organizationStructureDto.getId());
}
if(organizationStructureDto.getIsActive().equals(organizationStructure.getIsActive())&&
organizationStructure.getName().equals(organizationStructureDto.getName())){
return ApiResultDto.fail(ErrorMessageCN.OrgStructureFailed);
} }
//copy current OrganizationStructure as tmp //copy current OrganizationStructure as tmp
...@@ -147,12 +150,13 @@ public class OrganizationStructureServiceImpl { ...@@ -147,12 +150,13 @@ public class OrganizationStructureServiceImpl {
isStatusChangeOperation = true; isStatusChangeOperation = true;
organizationStructure.setIsActive(organizationStructureDto.getIsActive()); organizationStructure.setIsActive(organizationStructureDto.getIsActive());
organizationStructure.setName(organizationStructureDto.getName()); organizationStructure.setName(organizationStructureDto.getName());
if (!organizationStructureDto.getIsActive()&& // 参照atms取消层级若有机构不能停用的限制
/*if (!organizationStructureDto.getIsActive()&&
organizationService.isOrganizationStructureExists(organizationStructureDto.getId())) { organizationService.isOrganizationStructureExists(organizationStructureDto.getId())) {
// continue; // continue;
// return false; // return false;
throw new ApplicationException("the organization must not contain sub-organization!"); throw new ApplicationException("the organization must not contain sub-organization!");
} }*/
} }
organizationStructure.setUpdateTime(new Date()); organizationStructure.setUpdateTime(new Date());
organizationStructureMapper.updateByPrimaryKey(organizationStructure); organizationStructureMapper.updateByPrimaryKey(organizationStructure);
...@@ -172,7 +176,7 @@ public class OrganizationStructureServiceImpl { ...@@ -172,7 +176,7 @@ public class OrganizationStructureServiceImpl {
} }
} }
return true; return ApiResultDto.success();
} }
......
...@@ -1912,5 +1912,6 @@ ...@@ -1912,5 +1912,6 @@
"Country": "Country", "Country": "Country",
"Company": "Company", "Company": "Company",
"CompanySimpleName": "Company Simple Name", "CompanySimpleName": "Company Simple Name",
"DriverType": "Driver Type",
"~MustBeEndOneApp": "I Must be the End One, please!" "~MustBeEndOneApp": "I Must be the End One, please!"
} }
\ No newline at end of file
...@@ -2270,6 +2270,7 @@ ...@@ -2270,6 +2270,7 @@
"Company": "公司", "Company": "公司",
"CompanySimpleName": "公司简称", "CompanySimpleName": "公司简称",
"DriverType": "司机类型",
"~MustBeEndOneApp": "我必须是最后一个!" "~MustBeEndOneApp": "我必须是最后一个!"
} }
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
var businessUnitArray = []; var businessUnitArray = [];
businessUnitArray.push($scope.editingObject); businessUnitArray.push($scope.editingObject);
var successedFun = function(rst) { var successedFun = function() {
$scope.refreshData(); $scope.refreshData();
...@@ -71,14 +71,25 @@ ...@@ -71,14 +71,25 @@
} else { } else {
SweetAlert.success($translate.instant("OrganizationStructureAddSuccess")); SweetAlert.success($translate.instant("OrganizationStructureAddSuccess"));
} }
} };
if ($scope.isEdit) { if ($scope.isEdit) {
businessUnitService.updateBusinessUnit(businessUnitArray).success(function (data) {
businessUnitService.updateBusinessUnit(businessUnitArray).success(successedFun); if (data.code===0) {
successedFun();
}else {
SweetAlert.error(data.message);
}
});
} else { } else {
businessUnitService.addBusinessUnit(businessUnitArray).success(successedFun); businessUnitService.addBusinessUnit(businessUnitArray).success(function (data) {
if (data.code===0) {
successedFun();
}else {
SweetAlert.error(data.message);
}
});
} }
}; };
...@@ -208,7 +219,7 @@ ...@@ -208,7 +219,7 @@
function intiValidate() { function intiValidate() {
$.validator.addMethod("BURepeated", function(value, element, param) { /*后台校验$.validator.addMethod("BURepeated", function(value, element, param) {
if ($scope.gridOptions.data && $scope.gridOptions.data.length > 0) { if ($scope.gridOptions.data && $scope.gridOptions.data.length > 0) {
var objects = $.grep($scope.gridOptions.data, function(n, i) { var objects = $.grep($scope.gridOptions.data, function(n, i) {
return $scope.editingObject.ID != n.id && $.trim(n.name) == $.trim(value); return $scope.editingObject.ID != n.id && $.trim(n.name) == $.trim(value);
...@@ -219,7 +230,7 @@ ...@@ -219,7 +230,7 @@
return true; return true;
}); });*/
formValidator = $(editModalSelector).find("#edit-form").validate({ formValidator = $(editModalSelector).find("#edit-form").validate({
debug: true, debug: true,
...@@ -228,8 +239,8 @@ ...@@ -228,8 +239,8 @@
Name: { Name: {
required: true, required: true,
minlength: 2, minlength: 2,
maxlength: 50, maxlength: 50
BURepeated: true // BURepeated: true
}, },
IsActive: { IsActive: {
required: "input[name='IsActive']:checked" required: "input[name='IsActive']:checked"
...@@ -239,8 +250,8 @@ ...@@ -239,8 +250,8 @@
Name: { Name: {
required: $translate.instant('BusinessUnitEmptyNode'), required: $translate.instant('BusinessUnitEmptyNode'),
minlength: $translate.instant('BusinessUnitEmptyNode'), minlength: $translate.instant('BusinessUnitEmptyNode'),
maxlength: $translate.instant('BusinessUnitOutOfLengthNode'), maxlength: $translate.instant('BusinessUnitOutOfLengthNode')
BURepeated: $translate.instant('TaxData') // BURepeated: $translate.instant('BusinessUnitDuplicateNode')
}, },
IsActive: $translate.instant('BusinessUnitStatusUnsureness') IsActive: $translate.instant('BusinessUnitStatusUnsureness')
}, },
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<label class="col-sm-3 control-label">{{'BusinessUnitName' | translate}}:</label> <label class="col-sm-3 control-label">{{'BusinessUnitName' | translate}}:</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input class="form-control" name="Name" ng-model="editingObject.Name" maxlength="50"> <input class="form-control" name="Name" ng-model="editingObject.Name" maxlength="50">
<div class="validate-success" data-for="Name"></div> <!--<div class="validate-success" data-for="Name"></div>-->
</div> </div>
</div> </div>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
var osArray = []; var osArray = [];
osArray.push($scope.editingObject); osArray.push($scope.editingObject);
var successedFun = function(rst) { var successedFun = function() {
$scope.refreshData(); $scope.refreshData();
$(editModalSelector).modal('hide'); $(editModalSelector).modal('hide');
...@@ -78,9 +78,21 @@ ...@@ -78,9 +78,21 @@
} }
if ($scope.isEdit) { if ($scope.isEdit) {
organizationStructureService.updateOrganizationStructure(osArray).success(successedFun); organizationStructureService.updateOrganizationStructure(osArray).success(function (data) {
if (data.code===0) {
successedFun();
}else {
SweetAlert.error(data.message);
}
});
} else { } else {
organizationStructureService.addOrganizationStructure(osArray).success(successedFun); organizationStructureService.addOrganizationStructure(osArray).success(function (data) {
if (data.code===0) {
successedFun();
}else {
SweetAlert.error(data.message);
}
});
} }
}; };
......
analysisModule.controller('domesticDataImportController', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval' analysisModule.controller('domesticDataImportController', ['$scope','$filter', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal' , 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService' , 'vatSessionService', 'enums', 'vatOperationLogService'
, 'projectService', 'vatCommonService','templateService','orgService', , 'projectService', 'vatCommonService','templateService','orgService',
function ($scope, $log, $translate, $timeout, $q, $interval function ($scope,$filter, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal , apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService , vatSessionService, enums, vatOperationLogService
, projectService, vatCommonService,templateService,orgService) { , projectService, vatCommonService,templateService,orgService) {
...@@ -163,12 +163,15 @@ ...@@ -163,12 +163,15 @@
fileName = m.name + $scope.UploadPeriodTime+"_" +localDate; fileName = m.name + $scope.UploadPeriodTime+"_" +localDate;
} }
}); });
vatImportService.downloadDomesticFile($scope.queryParams,fileName).then(function (data) { var downloadParam = {
type: $scope.importType,
period: $scope.UploadPeriodTime
};
vatImportService.downloadDomesticFile(downloadParam,fileName).then(function (data) {
if (data) { if (data) {
ackMessageBox.success(translate('FileExportSuccess')); ackMessageBox.success(translate('FileExportSuccess'));
} }
}); });
}; };
//导入事件 //导入事件
...@@ -380,7 +383,7 @@ ...@@ -380,7 +383,7 @@
var getImportTax = function () { var getImportTax = function () {
vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) { vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) {
if (data.data) { if (data.data) {
$scope.taxGridSource = data.data[0]; $scope.taxGridSource = data.data;
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -472,7 +475,7 @@ ...@@ -472,7 +475,7 @@
var getImportReturnTax = function () { var getImportReturnTax = function () {
vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) { vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) {
if (data.data) { if (data.data) {
$scope.returnTaxGridSource = data.data[0]; $scope.returnTaxGridSource = data.data;
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -569,7 +572,7 @@ ...@@ -569,7 +572,7 @@
var getImportGMVSubsidy = function () { var getImportGMVSubsidy = function () {
vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) { vatImportService.displayAnalysisImportData($scope.importType,$scope.UploadPeriodTime).success(function (data) {
if (data.data) { if (data.data) {
$scope.GMVSubsidyGridSource = data.data[0]; $scope.GMVSubsidyGridSource = data.data;
}else { }else {
SweetAlert.error($translate.instant('SystemError')); SweetAlert.error($translate.instant('SystemError'));
} }
...@@ -680,25 +683,15 @@ ...@@ -680,25 +683,15 @@
allowHeaderFiltering: false, allowHeaderFiltering: false,
caption: $translate.instant('id') caption: $translate.instant('id')
}, { }, {
dataField: "joinInAmount", dataField: "driverType",
width: '25%', width: '50%',
allowHeaderFiltering: false,
caption: $translate.instant('JoinInAmount')
}, {
dataField: "selfSupportAmount",
allowHeaderFiltering: false, allowHeaderFiltering: false,
caption: $translate.instant('SelfSupportAmount'), caption: $translate.instant('DriverType')
width: '25%'
}, { }, {
dataField: "directSaleAmount", dataField: "driverNum",
allowHeaderFiltering: false, allowHeaderFiltering: false,
width: '25%', caption: $translate.instant('DriverNum'),
caption: $translate.instant('DirectSaleAmount') width: '50%'
}, {
dataField: "rightPublicAmount",
allowHeaderFiltering: false,
width: '25%',
caption: $translate.instant('RightPublicAmount')
}], }],
onContentReady: function (e) { onContentReady: function (e) {
$scope.driverNumInstance = e.component; $scope.driverNumInstance = e.component;
......
analysisModule.controller('internationalDataImportController', ['$scope', '$log', '$translate', '$timeout', '$q', '$interval' analysisModule.controller('internationalDataImportController', ['$scope','$filter', '$log', '$translate', '$timeout', '$q', '$interval'
, 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal' , 'apiInterceptor', 'Upload', 'vatImportService', 'SweetAlert', 'uiGridConstants', '$uibModal'
, 'vatSessionService', 'enums', 'vatOperationLogService' , 'vatSessionService', 'enums', 'vatOperationLogService'
, 'projectService', 'vatCommonService','templateService','orgService', , 'projectService', 'vatCommonService','templateService','orgService',
function ($scope, $log, $translate, $timeout, $q, $interval function ($scope,$filter, $log, $translate, $timeout, $q, $interval
, apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal , apiInterceptor, Upload, vatImportService, SweetAlert, uiGridConstants, $uibModal
, vatSessionService, enums, vatOperationLogService , vatSessionService, enums, vatOperationLogService
, projectService, vatCommonService,templateService,orgService) { , projectService, vatCommonService,templateService,orgService) {
...@@ -167,7 +167,22 @@ ...@@ -167,7 +167,22 @@
}; };
var doExport = function () { var doExport = function () {
var localDate=$filter('date')(new Date(), 'yyyyMMddHHmmss');
var fileName = '';
constant.anlDownLoadFileNameList.forEach(function (m) {
if (m.code === $scope.importType) {
fileName = m.name + $scope.UploadPeriodTime+"_" +localDate;
}
});
param.companyName = $scope.selectCompany;
param.country = $scope.selectCountry;
param.type = $scope.importType;
param.period = $scope.UploadPeriodTime;
vatImportService.downloadInternationalFile(param,fileName).then(function (data) {
if (data) {
ackMessageBox.success(translate('FileExportSuccess'));
}
});
}; };
......
webservices.factory('vatImportService', ['$http', 'apiConfig', 'vatSessionService', function ($http, apiConfig, vatSessionService) { webservices.factory('vatImportService', ['$http', 'apiConfig', 'vatSessionService','FileSaver', function ($http, apiConfig, vatSessionService,FileSaver) {
'use strict'; 'use strict';
return { return {
sample: function () { sample: function () {
...@@ -425,6 +425,14 @@ ...@@ -425,6 +425,14 @@
var data = new Blob([response.data], {type: response.headers('Content-Type')}); var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data, fileName + '.xlsx'); FileSaver.saveAs(data, fileName + '.xlsx');
}); });
},
downloadInternationalFile: function (queryParm, fileName) {
var thisConfig = apiConfig.create();
thisConfig.responseType = "arraybuffer";
return $http.post('/Analysis/downloadInternationalFile/get', queryParm, thisConfig).then(function (response) {
var data = new Blob([response.data], {type: response.headers('Content-Type')});
FileSaver.saveAs(data, fileName + '.xlsx');
});
} }
/***************************************批量数据导入服务(真) end**************************************************************/ /***************************************批量数据导入服务(真) end**************************************************************/
......
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