Commit 13792da2 authored by neo's avatar neo

[DEL] delete single methond service

parent ee2fc699
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import java.io.BufferedInputStream; import io.swagger.annotations.ApiOperation;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
...@@ -23,31 +15,39 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -23,31 +15,39 @@ import org.springframework.web.bind.annotation.RequestParam;
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 org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.CommonConstants; import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.datainit.DataInitDto; import pwc.taxtech.atms.dto.datainit.DataInitDto;
import pwc.taxtech.atms.dto.datainit.DataInitMsgDto; import pwc.taxtech.atms.dto.datainit.DataInitMsgDto;
import pwc.taxtech.atms.service.DataInitService; import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.service.impl.DataInitServiceImpl;
import pwc.taxtech.atms.service.impl.FileService; import pwc.taxtech.atms.service.impl.FileService;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@RestController @RestController
@RequestMapping("api/v1/init") @RequestMapping("api/v1/init")
public class DataInitController { public class DataInitController {
private static final Logger logger = LoggerFactory.getLogger(DataInitController.class); private static final Logger logger = LoggerFactory.getLogger(DataInitController.class);
@Autowired private FileService fileService; @Autowired
@Autowired private DataInitService dataInitService; private FileService fileService;
@Autowired
private DataInitServiceImpl dataInitService;
@ApiOperation(value = "Download basic data initialization template") @ApiOperation(value = "Download basic data initialization template")
@RequestMapping(value = { "/downloadTemplate" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/downloadTemplate"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downloadTemplate(HttpServletResponse response) { public void downloadTemplate(HttpServletResponse response) {
String filePath; String filePath;
File templateFile = null; File templateFile = null;
InputStream inputStream = null; InputStream inputStream = null;
...@@ -56,51 +56,47 @@ public class DataInitController { ...@@ -56,51 +56,47 @@ public class DataInitController {
templateFile = new File(filePath + CommonConstants.BasicDataTemplate); templateFile = new File(filePath + CommonConstants.BasicDataTemplate);
inputStream = new BufferedInputStream(new FileInputStream(templateFile)); inputStream = new BufferedInputStream(new FileInputStream(templateFile));
String customFileName = CommonConstants.BasicDataFileName + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";//客户端保存的文件名 String customFileName = CommonConstants.BasicDataFileName + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";//客户端保存的文件名
response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName +"\"")); response.setHeader("Content-Disposition", String.format("inline; filename=\"" + customFileName + "\""));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
FileCopyUtils.copy(inputStream, response.getOutputStream()); FileCopyUtils.copy(inputStream, response.getOutputStream());
} } catch (FileNotFoundException e) {
catch (FileNotFoundException e) {
logger.error("Template file not found. Template file should be located at " + CommonConstants.BasicDataTemplate); logger.error("Template file not found. Template file should be located at " + CommonConstants.BasicDataTemplate);
throw new ApplicationException("Tempate file not found."); throw new ApplicationException("Tempate file not found.");
} } catch (Exception e) {
catch (Exception e) {
logger.error("Error downloading template file " + CommonConstants.BasicDataFileName + ".xlsx", e); logger.error("Error downloading template file " + CommonConstants.BasicDataFileName + ".xlsx", e);
throw new ApplicationException("Error downloading template file " + CommonConstants.BasicDataFileName + ".xlsx", e); throw new ApplicationException("Error downloading template file " + CommonConstants.BasicDataFileName + ".xlsx", e);
} } finally {
finally {
try { try {
templateFile = null; templateFile = null;
if (inputStream!=null) { if (inputStream != null) {
inputStream.close(); inputStream.close();
} }
} } catch (Exception e) {
catch (Exception e) { logger.error("Error closing inputstream. ", e);
logger.error("Error closing inputstream. ",e); } finally {
}
finally {
inputStream = null; inputStream = null;
} }
} }
} }
@ApiOperation(value = "Upload initial data") @ApiOperation(value = "Upload initial data")
@RequestMapping(value = { "/Upload" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/Upload"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody Object uploadInitData(@RequestParam String action, public @ResponseBody
@RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) { Object uploadInitData(@RequestParam String action,
@RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) {
if (inputFile == null || inputFile.getSize() <= 0) { if (inputFile == null || inputFile.getSize() <= 0) {
return new OperationResultDto<>(false, ErrorMessage.NoFile); return new OperationResultDto<>(false, ErrorMessage.NoFile);
} }
logger.debug("file name: " + inputFile.getOriginalFilename()); logger.debug("file name: " + inputFile.getOriginalFilename());
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = inputFile.getInputStream(); inputStream = inputFile.getInputStream();
} catch (IOException e) { } catch (IOException e) {
throw Lang.wrapThrow(e); throw Lang.wrapThrow(e);
} }
//save file //save file
String filePath = FileUtils.getTempDirectory().getAbsolutePath() + File.separator + "DataInit" + File.separator String filePath = FileUtils.getTempDirectory().getAbsolutePath() + File.separator + "DataInit" + File.separator
+ CommonUtils.getUUID() + "_" + inputFile.getOriginalFilename(); + CommonUtils.getUUID() + "_" + inputFile.getOriginalFilename();
...@@ -109,13 +105,13 @@ public class DataInitController { ...@@ -109,13 +105,13 @@ public class DataInitController {
if (saveResult.getResult() != null && !saveResult.getResult()) { if (saveResult.getResult() != null && !saveResult.getResult()) {
return saveResult; return saveResult;
} }
DataInitDto dataInitDto = dataInitService.validateAndImportInitData(filePath); DataInitDto dataInitDto = dataInitService.validateAndImportInitData(filePath);
DataInitMsgDto dataMsgDto = new DataInitMsgDto(); DataInitMsgDto dataMsgDto = new DataInitMsgDto();
dataMsgDto.setErrorMsg(dataInitDto.getErrorMsgs()); dataMsgDto.setErrorMsg(dataInitDto.getErrorMsgs());
dataMsgDto.setValidMsg(dataInitDto.getValidMsgs()); dataMsgDto.setValidMsg(dataInitDto.getValidMsgs());
return dataMsgDto; return dataMsgDto;
} }
} }
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping; 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.entity.Industry; import pwc.taxtech.atms.entity.Industry;
import pwc.taxtech.atms.service.ProjectIndustryService; import pwc.taxtech.atms.service.impl.ProjectIndustryServiceImpl;
import java.util.List;
@RestController @RestController
@RequestMapping(value = "api/v1/industry") @RequestMapping(value = "api/v1/industry")
public class IndustryController { public class IndustryController {
@Autowired @Autowired
ProjectIndustryService projectIndustryService; ProjectIndustryServiceImpl projectIndustryService;
@RequestMapping(value = "getAllAvailableIndustry", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getAllAvailableIndustry", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<Industry> getAllAvailableIndustry() { public @ResponseBody
return projectIndustryService.getAllAvailableIndustry(); List<Industry> getAllAvailableIndustry() {
} return projectIndustryService.getAllAvailableIndustry();
}
} }
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import java.util.List; import io.swagger.annotations.ApiOperation;
import javassist.tools.web.BadHttpRequest; import javassist.tools.web.BadHttpRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dpo.AnalyticsModelDetail; import pwc.taxtech.atms.dpo.AnalyticsModelDetail;
import pwc.taxtech.atms.dpo.FinancialStatementDetail; import pwc.taxtech.atms.dpo.FinancialStatementDetail;
import pwc.taxtech.atms.dpo.TaxReturnDetail; import pwc.taxtech.atms.dpo.TaxReturnDetail;
import pwc.taxtech.atms.dto.*; import pwc.taxtech.atms.dto.AddKeyValueConfigDto;
import pwc.taxtech.atms.dto.Common.RemoteValidationRetDto; import pwc.taxtech.atms.dto.Common.RemoteValidationRetDto;
import pwc.taxtech.atms.dto.KeyValueConfigDisplayDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.UpdateKeyValueConfigDto;
import pwc.taxtech.atms.dto.formula.FormulaConfigDto; import pwc.taxtech.atms.dto.formula.FormulaConfigDto;
import pwc.taxtech.atms.service.KeyValueConfigService; import pwc.taxtech.atms.service.KeyValueConfigService;
import pwc.taxtech.atms.service.TemplateFormulaService; import pwc.taxtech.atms.service.impl.TemplateFormulaServiceImpl;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/v1/keyValueConfig") @RequestMapping("/api/v1/keyValueConfig")
...@@ -29,7 +37,7 @@ public class KeyValueConfigController { ...@@ -29,7 +37,7 @@ public class KeyValueConfigController {
private KeyValueConfigService keyValueConfigService; private KeyValueConfigService keyValueConfigService;
@Autowired @Autowired
private TemplateFormulaService templateFormulaService; private TemplateFormulaServiceImpl templateFormulaService;
@ApiOperation(value = "get keyValueConfig") @ApiOperation(value = "get keyValueConfig")
@RequestMapping(value = "", method = RequestMethod.GET) @RequestMapping(value = "", method = RequestMethod.GET)
...@@ -111,9 +119,9 @@ public class KeyValueConfigController { ...@@ -111,9 +119,9 @@ public class KeyValueConfigController {
} }
@RequestMapping(value="isFormulaValid", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "isFormulaValid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody public @ResponseBody
RemoteValidationRetDto isFormulaValid(@RequestParam String value){ RemoteValidationRetDto isFormulaValid(@RequestParam String value) {
OperationResultDto validateResult = templateFormulaService.validate(value); OperationResultDto validateResult = templateFormulaService.validate(value);
RemoteValidationRetDto result = new RemoteValidationRetDto(); RemoteValidationRetDto result = new RemoteValidationRetDto();
result.setIsValid(validateResult.getResult()); result.setIsValid(validateResult.getResult());
......
package pwc.taxtech.atms.controller; package pwc.taxtech.atms.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dpo.ModelProfileDto; import pwc.taxtech.atms.dpo.ModelProfileDto;
import pwc.taxtech.atms.service.ModelConfigurationService; import pwc.taxtech.atms.service.impl.ModelConfigurationServiceImpl;
import java.util.List;
@RestController @RestController
@RequestMapping(value = "api/v1/modelConfiguration") @RequestMapping(value = "api/v1/modelConfiguration")
public class ModelConfigurationController { public class ModelConfigurationController {
@Autowired @Autowired
ModelConfigurationService modelConfigurationService; ModelConfigurationServiceImpl modelConfigurationService;
@RequestMapping(value = "/model/byIndustry/{serviceTypeId}/{industryId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/model/byIndustry/{serviceTypeId}/{industryId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<ModelProfileDto> getModelListByIndustry(@PathVariable String industryId, public @ResponseBody
@PathVariable String serviceTypeId) { List<ModelProfileDto> getModelListByIndustry(@PathVariable String industryId,
return modelConfigurationService.getModelListByIndustry(serviceTypeId, industryId); @PathVariable String serviceTypeId) {
} return modelConfigurationService.getModelListByIndustry(serviceTypeId, industryId);
}
} }
...@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.ServiceTypeDto; import pwc.taxtech.atms.dto.ServiceTypeDto;
import pwc.taxtech.atms.entity.ServiceType; import pwc.taxtech.atms.entity.ServiceType;
import pwc.taxtech.atms.service.ProjectService; import pwc.taxtech.atms.service.ProjectService;
import pwc.taxtech.atms.service.ServiceTypeService; import pwc.taxtech.atms.service.impl.ServiceTypeServiceImpl;
import java.util.List; import java.util.List;
...@@ -21,7 +21,7 @@ public class ServiceTypeController { ...@@ -21,7 +21,7 @@ public class ServiceTypeController {
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
@Autowired @Autowired
private ServiceTypeService serviceTypeService; private ServiceTypeServiceImpl serviceTypeService;
@ResponseBody @ResponseBody
@ApiOperation(value = "获取ServiceType列表") @ApiOperation(value = "获取ServiceType列表")
......
...@@ -4,20 +4,25 @@ import org.slf4j.Logger; ...@@ -4,20 +4,25 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; 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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.TemplateFormulaService; import pwc.taxtech.atms.service.impl.TemplateFormulaServiceImpl;
@RestController @RestController
@RequestMapping(value = "api/v1/templateFormula") @RequestMapping(value = "api/v1/templateFormula")
public class TemplateFormulaController { public class TemplateFormulaController {
@Autowired @Autowired
TemplateFormulaService templateFormulaService; TemplateFormulaServiceImpl templateFormulaService;
private static final Logger logger = LoggerFactory.getLogger(TemplateFormulaController.class); private static final Logger logger = LoggerFactory.getLogger(TemplateFormulaController.class);
@RequestMapping(value = "validate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "validate", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto validate(@RequestBody(required = false) String fromula) { public @ResponseBody
OperationResultDto validate(@RequestBody(required = false) String fromula) {
try { try {
return templateFormulaService.validate(fromula); return templateFormulaService.validate(fromula);
} catch (Exception e) { } catch (Exception e) {
......
package pwc.taxtech.atms.service;
public interface AccountService {
/**
* 匹配标准科目到企业科目(按科目编码)
* @param enterpriseAccountSetId - 账套Id
* @param stdAccountCode - 标准科目编码
* @param epAccountCode - 企业科目编码
* @param industryId - 行业Id
* @param organizationId - 机构Id
* @param bOverwrite - 是否覆盖已有对应
* @param acctLevel - 科目级别
*/
void mapStdAccountByCode (String enterpriseAccountSetId, String stdAccountCode, String epAccountCode, String industryId, String organizationId,
Boolean bOverwrite, Integer acctLevel);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.datainit.DataInitDto;
public interface DataInitService {
DataInitDto validateAndImportInitData(String filePath);
}
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.entity.Dictionary;
public interface DictionaryService {
List<Dictionary> getDictionaryByCode(String code);
}
package pwc.taxtech.atms.service;
import java.io.InputStream;
public interface FileSystemService {
/**
* 上传用户报表模板
*
* @param fileName 文件名
* @param inputStream InputStream
* @return 文件路径
* @throws Exception ex
*/
String uploadUserTemplate(String fileName, InputStream inputStream) throws Exception;
/**
* 下载用户报表模板
*
* @param filePath 文件路径
* @return InputStream
* @throws Exception ex
*/
InputStream downloadUserTemplate(String filePath) throws Exception;
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dpo.ModelProfileDto;
import java.util.List;
public interface ModelConfigurationService {
List<ModelProfileDto> getModelListByIndustry(String serviceTypeId, String industryId);
}
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.entity.Industry;
public interface ProjectIndustryService {
List<Industry> getAllAvailableIndustry();
}
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.entity.ServiceType;
public interface ServiceTypeService {
List<ServiceType> getServiceTypes();
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
public interface TemplateFormulaService {
OperationResultDto validate(String formula);
}
...@@ -2,79 +2,85 @@ package pwc.taxtech.atms.service.impl; ...@@ -2,79 +2,85 @@ package pwc.taxtech.atms.service.impl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonConstants; import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.entity.AccountMapping; import pwc.taxtech.atms.entity.AccountMapping;
import pwc.taxtech.atms.entity.AccountMappingExample; import pwc.taxtech.atms.entity.AccountMappingExample;
import pwc.taxtech.atms.entity.EnterpriseAccount; import pwc.taxtech.atms.entity.EnterpriseAccount;
import pwc.taxtech.atms.service.AccountService;
import pwc.taxtech.atms.service.EnterpriseAccountService; import pwc.taxtech.atms.service.EnterpriseAccountService;
@Service @Service
public class AccountServiceImpl extends AbstractService implements AccountService { public class AccountServiceImpl extends AbstractService {
@Autowired
EnterpriseAccountService enterpriseAccountService;
@Autowired EnterpriseAccountService enterpriseAccountService; /**
* 匹配标准科目到企业科目(按科目编码)
/* (non-Javadoc) * @param enterpriseAccountSetId - 账套Id
* @see pwc.taxtech.atms.service.AccountService#mapStdAccountByCode(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Integer) * @param stdAccountCode - 标准科目编码
* @param epAccountCode - 企业科目编码
* @param industryId - 行业Id
* @param organizationId - 机构Id
* @param bOverwrite - 是否覆盖已有对应
* @param acctLevel - 科目级别
*/ */
@Override
public void mapStdAccountByCode(String enterpriseAccountSetId, String stdAccountCode, String epAccountCode, String industryId, String organizationId, public void mapStdAccountByCode(String enterpriseAccountSetId, String stdAccountCode, String epAccountCode, String industryId, String organizationId,
Boolean bOverwrite, Integer acctLevel) { Boolean bOverwrite, Integer acctLevel) {
//set default value //set default value
if(bOverwrite == null) { if (bOverwrite == null) {
bOverwrite = true; bOverwrite = true;
} }
if(acctLevel == null) { if (acctLevel == null) {
acctLevel = 0; acctLevel = 0;
} }
EnterpriseAccount epAccount = enterpriseAccountService.getEnterpriseAccount(epAccountCode, enterpriseAccountSetId); EnterpriseAccount epAccount = enterpriseAccountService.getEnterpriseAccount(epAccountCode, enterpriseAccountSetId);
if (epAccount == null) { if (epAccount == null) {
return; return;
} }
//set stdAccountCode //set stdAccountCode
if(stdAccountCode==null || stdAccountCode.isEmpty()) { if (stdAccountCode == null || stdAccountCode.isEmpty()) {
stdAccountCode = CommonConstants.NullStdCode; stdAccountCode = CommonConstants.NullStdCode;
} }
if (!bOverwrite) { if (!bOverwrite) {
if(!isStdExists(enterpriseAccountSetId, epAccountCode, industryId, organizationId)) { if (!isStdExists(enterpriseAccountSetId, epAccountCode, industryId, organizationId)) {
deleteAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), organizationId, industryId); deleteAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), organizationId, industryId);
updateStdAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), stdAccountCode, industryId, organizationId); updateStdAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), stdAccountCode, industryId, organizationId);
} }
} } else {
else {
deleteAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), organizationId, industryId); deleteAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), organizationId, industryId);
updateStdAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), stdAccountCode, industryId, organizationId); updateStdAccountMapping(epAccountCode, epAccount.getEnterpriseAccountSetId(), stdAccountCode, industryId, organizationId);
} }
} }
/** /**
* 删除对应关系 * 删除对应关系
*
* @param epAccountCode * @param epAccountCode
* @param enterpriseAccountSetId * @param enterpriseAccountSetId
* @param organizaionId * @param organizaionId
* @param industryId * @param industryId
*/ */
private void deleteAccountMapping(String epAccountCode, String enterpriseAccountSetId, String organizaionId, private void deleteAccountMapping(String epAccountCode, String enterpriseAccountSetId, String organizaionId,
String industryId) { String industryId) {
AccountMappingExample accountMappingExample = new AccountMappingExample(); AccountMappingExample accountMappingExample = new AccountMappingExample();
accountMappingExample.createCriteria() accountMappingExample.createCriteria()
.andEnterpriseAccountCodeEqualTo(epAccountCode) .andEnterpriseAccountCodeEqualTo(epAccountCode)
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId) .andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId)
.andOrganizationIdEqualTo(organizaionId) .andOrganizationIdEqualTo(organizaionId)
.andIndustryIdEqualTo(industryId); .andIndustryIdEqualTo(industryId);
accountMappingMapper.deleteByExample(accountMappingExample); accountMappingMapper.deleteByExample(accountMappingExample);
} }
/** /**
* 插入对应关系到对应关系表 * 插入对应关系到对应关系表
*
* @param epAccountCode * @param epAccountCode
* @param enterpriseAccountSetId * @param enterpriseAccountSetId
* @param stdAccountCode * @param stdAccountCode
...@@ -83,8 +89,8 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -83,8 +89,8 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
* @param organizationId * @param organizationId
*/ */
private void updateStdAccountMapping(String epAccountCode, String enterpriseAccountSetId, private void updateStdAccountMapping(String epAccountCode, String enterpriseAccountSetId,
String stdAccountCode, String industryId, String organizationId) { String stdAccountCode, String industryId, String organizationId) {
AccountMapping accountMapping = new AccountMapping(); AccountMapping accountMapping = new AccountMapping();
accountMapping.setId(CommonUtils.getUUID()); accountMapping.setId(CommonUtils.getUUID());
accountMapping.setEnterpriseAccountSetId(enterpriseAccountSetId); accountMapping.setEnterpriseAccountSetId(enterpriseAccountSetId);
...@@ -96,10 +102,10 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -96,10 +102,10 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
} }
private boolean isStdExists(String enterpriseAccountSetId, String enterpirseAccountCode, String industryId, String organizationId) { private boolean isStdExists(String enterpriseAccountSetId, String enterpirseAccountCode, String industryId, String organizationId) {
Long stdAccountsCount = customAccountMapper.countStandardAccounts(enterpriseAccountSetId, enterpirseAccountCode, industryId, organizationId); Long stdAccountsCount = customAccountMapper.countStandardAccounts(enterpriseAccountSetId, enterpirseAccountCode, industryId, organizationId);
return stdAccountsCount>=1; return stdAccountsCount >= 1;
} }
} }
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.entity.Dictionary; import pwc.taxtech.atms.entity.Dictionary;
import pwc.taxtech.atms.entity.DictionaryExample; import pwc.taxtech.atms.entity.DictionaryExample;
import pwc.taxtech.atms.service.DictionaryService;
import java.util.List;
@Service @Service
public class DictionaryServiceImpl extends AbstractService implements DictionaryService { public class DictionaryServiceImpl extends AbstractService {
@Override
public List<Dictionary> getDictionaryByCode(String code) { public List<Dictionary> getDictionaryByCode(String code) {
DictionaryExample example = new DictionaryExample(); DictionaryExample example = new DictionaryExample();
example.createCriteria().andCodeEqualTo(code).andIsActiveEqualTo(true); example.createCriteria().andCodeEqualTo(code).andIsActiveEqualTo(true);
......
...@@ -3,25 +3,22 @@ package pwc.taxtech.atms.service.impl; ...@@ -3,25 +3,22 @@ package pwc.taxtech.atms.service.impl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.ftp.FtpService; import pwc.taxtech.atms.common.ftp.FtpService;
import pwc.taxtech.atms.service.FileSystemService;
import java.io.InputStream; import java.io.InputStream;
@Service @Service
public class FTPFileSystemServiceImpl implements FileSystemService { public class FTPFileSystemServiceImpl {
private static final String USER_TEMPLATE_PATH = "pwc/userTemplate/"; private static final String USER_TEMPLATE_PATH = "pwc/userTemplate/";
@Autowired @Autowired
private FtpService ftpService; private FtpService ftpService;
@Override
public String uploadUserTemplate(String fileName, InputStream inputStream) throws Exception { public String uploadUserTemplate(String fileName, InputStream inputStream) throws Exception {
ftpService.upload(USER_TEMPLATE_PATH, fileName, inputStream); ftpService.upload(USER_TEMPLATE_PATH, fileName, inputStream);
return USER_TEMPLATE_PATH + fileName; return USER_TEMPLATE_PATH + fileName;
} }
@Override
public InputStream downloadUserTemplate(String filePath) throws Exception { public InputStream downloadUserTemplate(String filePath) throws Exception {
return ftpService.getFtpFileWithStaticUrl(filePath); return ftpService.getFtpFileWithStaticUrl(filePath);
} }
......
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dpo.ModelProfileDto;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dpo.ModelProfileDto;
import pwc.taxtech.atms.service.ModelConfigurationService;
@Service @Service
public class ModelConfigurationServiceImpl extends AbstractService implements ModelConfigurationService { public class ModelConfigurationServiceImpl extends AbstractService {
@Override public List<ModelProfileDto> getModelListByIndustry(String serviceTypeId, String industryId) {
public List<ModelProfileDto> getModelListByIndustry(String serviceTypeId, String industryId) { Map<String, Object> map = new HashMap<>(2);
Map<String,Object> map = new HashMap<>(2); map.put("serviceTypeId", serviceTypeId);
map.put("serviceTypeId",serviceTypeId); map.put("industryId", industryId);
map.put("industryId",industryId); return modelConfigMapper.getModelListByIndustry(map);
return modelConfigMapper.getModelListByIndustry(map); }
}
} }
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.entity.Industry; import pwc.taxtech.atms.entity.Industry;
import pwc.taxtech.atms.service.ProjectIndustryService;
import java.util.List;
@Service @Service
public class ProjectIndustryServiceImpl extends AbstractService implements ProjectIndustryService { public class ProjectIndustryServiceImpl extends AbstractService {
@Override public List<Industry> getAllAvailableIndustry() {
public List<Industry> getAllAvailableIndustry() { return industryMapper.getAllAvailableIndustry();
return industryMapper.getAllAvailableIndustry(); }
}
} }
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import java.util.List;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.entity.ServiceType; import pwc.taxtech.atms.entity.ServiceType;
import pwc.taxtech.atms.entity.ServiceTypeExample; import pwc.taxtech.atms.entity.ServiceTypeExample;
import pwc.taxtech.atms.service.ServiceTypeService;
import java.util.List;
@Service @Service
public class ServiceTypeServiceImpl extends AbstractService implements ServiceTypeService { public class ServiceTypeServiceImpl extends AbstractService {
@Override public List<ServiceType> getServiceTypes() {
public List<ServiceType> getServiceTypes() { return serviceTypeMapper.selectByExample(new ServiceTypeExample());
return serviceTypeMapper.selectByExample(new ServiceTypeExample()); }
}
} }
package pwc.taxtech.atms.service.impl; package pwc.taxtech.atms.service.impl;
import static java.util.Comparator.comparing;
import static java.util.Comparator.naturalOrder;
import static java.util.Comparator.nullsFirst;
import static java.util.Comparator.nullsLast;
import static java.util.stream.Collectors.toList;
import static org.springframework.util.StringUtils.hasText;
import static pwc.taxtech.atms.common.CommonUtils.copyProperties;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.nutz.lang.Lang; import org.nutz.lang.Lang;
import org.nutz.lang.Strings; import org.nutz.lang.Strings;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dpo.StatisticAttributeDisplayDto;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.CommonConstants; import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.OperateLogType; import pwc.taxtech.atms.common.OperateLogType;
import pwc.taxtech.atms.common.OperationAction; import pwc.taxtech.atms.common.OperationAction;
import pwc.taxtech.atms.common.OperationModule; import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.constant.DimensionConstant; import pwc.taxtech.atms.constant.DimensionConstant;
import pwc.taxtech.atms.dpo.StatisticAttributeDisplayDto;
import pwc.taxtech.atms.dto.OperationLogDto; import pwc.taxtech.atms.dto.OperationLogDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.StatisticAttributeDimensionDto; import pwc.taxtech.atms.dto.StatisticAttributeDimensionDto;
...@@ -38,10 +21,22 @@ import pwc.taxtech.atms.entity.StatisticAttribute; ...@@ -38,10 +21,22 @@ import pwc.taxtech.atms.entity.StatisticAttribute;
import pwc.taxtech.atms.entity.StatisticAttributeDimension; import pwc.taxtech.atms.entity.StatisticAttributeDimension;
import pwc.taxtech.atms.entity.StatisticAttributeDimensionExample; import pwc.taxtech.atms.entity.StatisticAttributeDimensionExample;
import pwc.taxtech.atms.entity.StatisticAttributeExample; import pwc.taxtech.atms.entity.StatisticAttributeExample;
import pwc.taxtech.atms.service.DictionaryService; import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.service.DimensionService; import pwc.taxtech.atms.service.DimensionService;
import pwc.taxtech.atms.service.StatisticAttributeService; import pwc.taxtech.atms.service.StatisticAttributeService;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static java.util.Comparator.*;
import static java.util.stream.Collectors.toList;
import static org.springframework.util.StringUtils.hasText;
import static pwc.taxtech.atms.common.CommonUtils.copyProperties;
/** /**
*/ */
@Service @Service
...@@ -50,7 +45,7 @@ public class StatisticAttributeServiceImpl extends AbstractService implements St ...@@ -50,7 +45,7 @@ public class StatisticAttributeServiceImpl extends AbstractService implements St
@Autowired @Autowired
private DimensionService dimensionService; private DimensionService dimensionService;
@Autowired @Autowired
private DictionaryService dictionaryService; private DictionaryServiceImpl dictionaryService;
@Override @Override
public List<StatisticAttributeDisplayDto> getStatisticAttributeListByDimensionId(String parentDimensionId, public List<StatisticAttributeDisplayDto> getStatisticAttributeListByDimensionId(String parentDimensionId,
......
...@@ -8,16 +8,14 @@ import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook; ...@@ -8,16 +8,14 @@ import org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.TemplateFormulaService;
@Service @Service
public class TemplateFormulaServiceImpl extends AbstractService implements TemplateFormulaService { public class TemplateFormulaServiceImpl extends AbstractService {
private FormulaHelper formulaHelper = new FormulaHelper(); private FormulaHelper formulaHelper = new FormulaHelper();
//private static ScriptEngine m_engine = Python.CreateEngine(); //private static ScriptEngine m_engine = Python.CreateEngine();
@Override
public OperationResultDto validate(String formula) { public OperationResultDto validate(String formula) {
OperationResultDto result = new OperationResultDto(); OperationResultDto result = new OperationResultDto();
......
...@@ -20,14 +20,14 @@ import pwc.taxtech.atms.common.POIUtil; ...@@ -20,14 +20,14 @@ import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.message.TemplateMessage; import pwc.taxtech.atms.common.message.TemplateMessage;
import pwc.taxtech.atms.constant.enums.TemplateGroupType; import pwc.taxtech.atms.constant.enums.TemplateGroupType;
import pwc.taxtech.atms.dao.CellTemplateConfigMapper;
import pwc.taxtech.atms.dao.CellTemplateMapper;
import pwc.taxtech.atms.dao.TemplateGroupMapper;
import pwc.taxtech.atms.dao.TemplateMapper;
import pwc.taxtech.atms.dao.CellTemplateConfigDao; import pwc.taxtech.atms.dao.CellTemplateConfigDao;
import pwc.taxtech.atms.dao.CellTemplateConfigMapper;
import pwc.taxtech.atms.dao.CellTemplateDao; import pwc.taxtech.atms.dao.CellTemplateDao;
import pwc.taxtech.atms.dao.CellTemplateMapper;
import pwc.taxtech.atms.dao.TemplateDao; import pwc.taxtech.atms.dao.TemplateDao;
import pwc.taxtech.atms.dao.TemplateGroupDao; import pwc.taxtech.atms.dao.TemplateGroupDao;
import pwc.taxtech.atms.dao.TemplateGroupMapper;
import pwc.taxtech.atms.dao.TemplateMapper;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto; import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.entity.CellTemplate; import pwc.taxtech.atms.entity.CellTemplate;
...@@ -39,7 +39,6 @@ import pwc.taxtech.atms.entity.TemplateExample; ...@@ -39,7 +39,6 @@ import pwc.taxtech.atms.entity.TemplateExample;
import pwc.taxtech.atms.entity.TemplateGroup; import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.entity.TemplateGroupExample; import pwc.taxtech.atms.entity.TemplateGroupExample;
import pwc.taxtech.atms.exception.ServiceException; import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.service.FileSystemService;
import pwc.taxtech.atms.service.TemplateGroupService; import pwc.taxtech.atms.service.TemplateGroupService;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
...@@ -56,7 +55,7 @@ import java.util.stream.Collectors; ...@@ -56,7 +55,7 @@ import java.util.stream.Collectors;
@Service @Service
public class TemplateGroupServiceImpl extends AbstractService implements TemplateGroupService { public class TemplateGroupServiceImpl extends AbstractService implements TemplateGroupService {
@Autowired @Autowired
private FileSystemService fileSystemService; private FTPFileSystemServiceImpl fileSystemService;
@Autowired @Autowired
private TemplateGroupDao templateGroupDao; private TemplateGroupDao templateGroupDao;
@Autowired @Autowired
......
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