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,29 +15,37 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -23,29 +15,37 @@ 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;
...@@ -56,37 +56,33 @@ public class DataInitController { ...@@ -56,37 +56,33 @@ 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
Object uploadInitData(@RequestParam String action,
@RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) { @RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) {
if (inputFile == null || inputFile.getSize() <= 0) { if (inputFile == null || inputFile.getSize() <= 0) {
......
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
List<Industry> getAllAvailableIndustry() {
return projectIndustryService.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
List<ModelProfileDto> getModelListByIndustry(@PathVariable String industryId,
@PathVariable String serviceTypeId) { @PathVariable String serviceTypeId) {
return modelConfigurationService.getModelListByIndustry(serviceTypeId, industryId); 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,32 +2,37 @@ package pwc.taxtech.atms.service.impl; ...@@ -2,32 +2,37 @@ 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) /**
* @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 enterpriseAccountSetId - 账套Id
* @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;
} }
...@@ -37,17 +42,16 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -37,17 +42,16 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
} }
//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);
} }
...@@ -55,6 +59,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -55,6 +59,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
/** /**
* 删除对应关系 * 删除对应关系
*
* @param epAccountCode * @param epAccountCode
* @param enterpriseAccountSetId * @param enterpriseAccountSetId
* @param organizaionId * @param organizaionId
...@@ -75,6 +80,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -75,6 +80,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
/** /**
* 插入对应关系到对应关系表 * 插入对应关系到对应关系表
*
* @param epAccountCode * @param epAccountCode
* @param enterpriseAccountSetId * @param enterpriseAccountSetId
* @param stdAccountCode * @param stdAccountCode
...@@ -99,7 +105,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic ...@@ -99,7 +105,7 @@ public class AccountServiceImpl extends AbstractService implements AccountServic
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.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.nutz.lang.Files; import org.nutz.lang.Files;
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 org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
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.dto.datainit.DataCountDto; import pwc.taxtech.atms.dto.datainit.DataCountDto;
import pwc.taxtech.atms.dto.datainit.DataInitDto; import pwc.taxtech.atms.dto.datainit.DataInitDto;
import pwc.taxtech.atms.dto.user.UserTemp; import pwc.taxtech.atms.dto.user.UserTemp;
import pwc.taxtech.atms.entity.Area; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.entity.AreaExample;
import pwc.taxtech.atms.entity.AreaRegion; import java.io.InputStream;
import pwc.taxtech.atms.entity.AreaRegionExample; import java.util.ArrayList;
import pwc.taxtech.atms.entity.BusinessUnit; import java.util.Arrays;
import pwc.taxtech.atms.entity.BusinessUnitExample; import java.util.Collection;
import pwc.taxtech.atms.entity.Customer; import java.util.Date;
import pwc.taxtech.atms.entity.EnterpriseAccount; import java.util.List;
import pwc.taxtech.atms.entity.Organization; import java.util.Map;
import pwc.taxtech.atms.entity.OrganizationExample; import java.util.Objects;
import pwc.taxtech.atms.entity.OrganizationStructure; import java.util.stream.Collectors;
import pwc.taxtech.atms.entity.OrganizationStructureExample;
import pwc.taxtech.atms.entity.Region;
import pwc.taxtech.atms.entity.RegionExample;
import pwc.taxtech.atms.entity.Role;
import pwc.taxtech.atms.entity.RoleCategory;
import pwc.taxtech.atms.entity.RoleCategoryExample;
import pwc.taxtech.atms.entity.User;
import pwc.taxtech.atms.entity.UserRole;
import pwc.taxtech.atms.service.DataInitService;
@Service @Service
public class DataInitServiceImpl extends AbstractService implements DataInitService { public class DataInitServiceImpl extends AbstractService {
private static final String[] sheetArray = new String[] { "机构层级", "事业部", "区域", "企业科目", "客户列表", "机构", "用户", "角色" }; private static final String[] sheetArray = new String[]{"机构层级", "事业部", "区域", "企业科目", "客户列表", "机构", "用户", "角色"};
private static final String ENABLE = "启用"; private static final String ENABLE = "启用";
@Autowired @Autowired
...@@ -58,7 +38,6 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -58,7 +38,6 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
* String) * String)
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Override
public DataInitDto validateAndImportInitData(String filePath) { public DataInitDto validateAndImportInitData(String filePath) {
logger.debug("enter DataInitServiceImpl validateImportInitData"); logger.debug("enter DataInitServiceImpl validateImportInitData");
InputStream savedInputStream = Files.findFileAsStream(filePath); InputStream savedInputStream = Files.findFileAsStream(filePath);
...@@ -199,7 +178,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -199,7 +178,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<OrganizationStructure> importOrgStructureList = new ArrayList<>(); List<OrganizationStructure> importOrgStructureList = new ArrayList<>();
for (Map map : dataMapCollection) { for (Map map : dataMapCollection) {
if(map.get("层级名称") == null || map.get("使用状态") == null) { if (map.get("层级名称") == null || map.get("使用状态") == null) {
continue; continue;
} }
...@@ -250,13 +229,13 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -250,13 +229,13 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<Area> mappedAreaList = importAreaList.stream().filter(a -> Objects.equals(a.getName(), map.get("区域名称").toString())).collect(Collectors.toList()); List<Area> mappedAreaList = importAreaList.stream().filter(a -> Objects.equals(a.getName(), map.get("区域名称").toString())).collect(Collectors.toList());
//if area data not exist, then generate new one //if area data not exist, then generate new one
String uuid = null; String uuid = null;
if(!dbAreaList.isEmpty()) { if (!dbAreaList.isEmpty()) {
uuid = dbAreaList.get(0).getId(); uuid = dbAreaList.get(0).getId();
} }
if(!mappedAreaList.isEmpty()) { if (!mappedAreaList.isEmpty()) {
uuid = mappedAreaList.get(0).getId(); uuid = mappedAreaList.get(0).getId();
} }
if(dbAreaList.isEmpty() && mappedAreaList.isEmpty()) { if (dbAreaList.isEmpty() && mappedAreaList.isEmpty()) {
// Area data // Area data
Area area = new Area(); Area area = new Area();
uuid = CommonUtils.getUUID(); uuid = CommonUtils.getUUID();
...@@ -277,15 +256,15 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -277,15 +256,15 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<String> mappedRegionIdList = allRegions.stream() List<String> mappedRegionIdList = allRegions.stream()
.filter(a -> a.getName().contains(map.get("行政区域").toString())).map(Region::getId) .filter(a -> a.getName().contains(map.get("行政区域").toString())).map(Region::getId)
.collect(Collectors.toList()); .collect(Collectors.toList());
if(mappedRegionIdList.isEmpty()) { if (mappedRegionIdList.isEmpty()) {
//by default, region should exist //by default, region should exist
continue; continue;
} }
for(String s : mappedRegionIdList) { for (String s : mappedRegionIdList) {
AreaRegion areaRegion = new AreaRegion(); AreaRegion areaRegion = new AreaRegion();
areaRegion.setId(CommonUtils.getUUID()); areaRegion.setId(CommonUtils.getUUID());
if(mappedAreas.isEmpty()) { if (mappedAreas.isEmpty()) {
areaRegion.setAreaId(uuid); areaRegion.setAreaId(uuid);
} else { } else {
areaRegion.setAreaId(mappedAreas.get(0).getId()); areaRegion.setAreaId(mappedAreas.get(0).getId());
...@@ -368,10 +347,10 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -368,10 +347,10 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
} }
private Integer getEnterpriseAccountDirection(String name) { private Integer getEnterpriseAccountDirection(String name) {
if(name.indexOf(CommonConstants.CreditDirectionName) > -1) { if (name.indexOf(CommonConstants.CreditDirectionName) > -1) {
return Integer.valueOf(CommonConstants.CreditDirectionValue); return Integer.valueOf(CommonConstants.CreditDirectionValue);
} }
if(name.indexOf(CommonConstants.DebitDirectionName) > -1) { if (name.indexOf(CommonConstants.DebitDirectionName) > -1) {
return Integer.valueOf(CommonConstants.DebitDirectionValue); return Integer.valueOf(CommonConstants.DebitDirectionValue);
} }
return null; return null;
...@@ -402,7 +381,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -402,7 +381,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
// prepare data to insert // prepare data to insert
List<BusinessUnit> importBusinessUnitList = new ArrayList<>(); List<BusinessUnit> importBusinessUnitList = new ArrayList<>();
for (Map map : dataMapCollection) { for (Map map : dataMapCollection) {
if(map.get("事业部名称") == null || map.get("使用状态") == null) { if (map.get("事业部名称") == null || map.get("使用状态") == null) {
continue; continue;
} }
BusinessUnit businessUnit = new BusinessUnit(); BusinessUnit businessUnit = new BusinessUnit();
...@@ -476,7 +455,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -476,7 +455,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
// prepare data to insert // prepare data to insert
List<Organization> importOrganizationList = new ArrayList<>(); List<Organization> importOrganizationList = new ArrayList<>();
for (Map map : dataMapCollection) { for (Map map : dataMapCollection) {
if(StringUtils.isEmpty(map.get("机构名称").toString()) || StringUtils.isEmpty(map.get("机构代码").toString()) if (StringUtils.isEmpty(map.get("机构名称").toString()) || StringUtils.isEmpty(map.get("机构代码").toString())
|| StringUtils.isEmpty(map.get("行政地区").toString()) || StringUtils.isEmpty(map.get("行政地区").toString())
|| StringUtils.isEmpty(map.get("层级").toString()) || StringUtils.isEmpty(map.get("事业部").toString()) || StringUtils.isEmpty(map.get("层级").toString()) || StringUtils.isEmpty(map.get("事业部").toString())
|| StringUtils.isEmpty(map.get("地区").toString())) { || StringUtils.isEmpty(map.get("地区").toString())) {
...@@ -493,11 +472,11 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -493,11 +472,11 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
//parent id //parent id
String parentName = map.get("上级公司") == null ? null : map.get("上级公司").toString(); String parentName = map.get("上级公司") == null ? null : map.get("上级公司").toString();
if(!StringUtils.isEmpty(parentName)) { if (!StringUtils.isEmpty(parentName)) {
OrganizationExample organizationExample = new OrganizationExample(); OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andNameEqualTo(parentName); organizationExample.createCriteria().andNameEqualTo(parentName);
List<Organization> organizationList = organizationMapper.selectByExample(organizationExample); List<Organization> organizationList = organizationMapper.selectByExample(organizationExample);
if(organizationList.isEmpty()) { if (organizationList.isEmpty()) {
continue; continue;
} }
organization.setParentId(organizationList.get(0).getId()); organization.setParentId(organizationList.get(0).getId());
...@@ -507,7 +486,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -507,7 +486,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
RegionExample regionExample = new RegionExample(); RegionExample regionExample = new RegionExample();
regionExample.createCriteria().andNameEqualTo(map.get("行政地区").toString()); regionExample.createCriteria().andNameEqualTo(map.get("行政地区").toString());
List<Region> regionList = regionMapper.selectByExample(regionExample); List<Region> regionList = regionMapper.selectByExample(regionExample);
if(regionList.isEmpty()) { if (regionList.isEmpty()) {
continue; continue;
} }
organization.setRegionId(regionList.get(0).getId()); organization.setRegionId(regionList.get(0).getId());
...@@ -516,7 +495,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -516,7 +495,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
OrganizationStructureExample organizationStructureExample = new OrganizationStructureExample(); OrganizationStructureExample organizationStructureExample = new OrganizationStructureExample();
organizationStructureExample.createCriteria().andNameEqualTo(map.get("层级").toString()); organizationStructureExample.createCriteria().andNameEqualTo(map.get("层级").toString());
List<OrganizationStructure> organizationStructureList = organizationStructureMapper.selectByExample(organizationStructureExample); List<OrganizationStructure> organizationStructureList = organizationStructureMapper.selectByExample(organizationStructureExample);
if(organizationStructureList.isEmpty()) { if (organizationStructureList.isEmpty()) {
continue; continue;
} }
organization.setStructureId(organizationStructureList.get(0).getId()); organization.setStructureId(organizationStructureList.get(0).getId());
...@@ -527,7 +506,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -527,7 +506,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
BusinessUnitExample businessUnitExample = new BusinessUnitExample(); BusinessUnitExample businessUnitExample = new BusinessUnitExample();
businessUnitExample.createCriteria().andNameEqualTo(map.get("事业部").toString()); businessUnitExample.createCriteria().andNameEqualTo(map.get("事业部").toString());
List<BusinessUnit> businessUnitList = businessUnitMapper.selectByExample(businessUnitExample); List<BusinessUnit> businessUnitList = businessUnitMapper.selectByExample(businessUnitExample);
if(businessUnitList.isEmpty()) { if (businessUnitList.isEmpty()) {
continue; continue;
} }
organization.setBusinessUnitId(businessUnitList.get(0).getId()); organization.setBusinessUnitId(businessUnitList.get(0).getId());
...@@ -536,7 +515,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -536,7 +515,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
AreaExample areaExample = new AreaExample(); AreaExample areaExample = new AreaExample();
areaExample.createCriteria().andNameEqualTo(map.get("地区").toString()); areaExample.createCriteria().andNameEqualTo(map.get("地区").toString());
List<Area> areaList = areaMapper.selectByExample(areaExample); List<Area> areaList = areaMapper.selectByExample(areaExample);
if(areaList.isEmpty()) { if (areaList.isEmpty()) {
continue; continue;
} }
organization.setAreaId(areaList.get(0).getId()); organization.setAreaId(areaList.get(0).getId());
...@@ -576,7 +555,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -576,7 +555,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<RoleCategory> importRoleCatagoryList = new ArrayList<>(); List<RoleCategory> importRoleCatagoryList = new ArrayList<>();
for (Map map : dataMapCollection) { for (Map map : dataMapCollection) {
if(StringUtils.isEmpty(map.get("角色类别").toString()) || StringUtils.isEmpty(map.get("角色名称").toString())) { if (StringUtils.isEmpty(map.get("角色类别").toString()) || StringUtils.isEmpty(map.get("角色名称").toString())) {
continue; continue;
} }
...@@ -587,13 +566,13 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -587,13 +566,13 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<RoleCategory> mappedRoleCatagoryList = importRoleCatagoryList.stream().filter(a -> Objects.equals(a.getName(), map.get("角色类别").toString())).collect(Collectors.toList()); List<RoleCategory> mappedRoleCatagoryList = importRoleCatagoryList.stream().filter(a -> Objects.equals(a.getName(), map.get("角色类别").toString())).collect(Collectors.toList());
//not exist in database and not in list //not exist in database and not in list
String uuid = null; String uuid = null;
if(!dbRoleCatagoryList.isEmpty()) { if (!dbRoleCatagoryList.isEmpty()) {
uuid = dbRoleCatagoryList.get(0).getId(); uuid = dbRoleCatagoryList.get(0).getId();
} }
if(!mappedRoleCatagoryList.isEmpty()) { if (!mappedRoleCatagoryList.isEmpty()) {
uuid = mappedRoleCatagoryList.get(0).getId(); uuid = mappedRoleCatagoryList.get(0).getId();
} }
if(roleCategoryMapper.selectByExample(example).isEmpty() && mappedRoleCatagoryList.isEmpty()) { if (roleCategoryMapper.selectByExample(example).isEmpty() && mappedRoleCatagoryList.isEmpty()) {
RoleCategory roleCatagory = new RoleCategory(); RoleCategory roleCatagory = new RoleCategory();
importRoleCatagoryList.add(roleCatagory); importRoleCatagoryList.add(roleCatagory);
uuid = CommonUtils.getUUID(); uuid = CommonUtils.getUUID();
...@@ -645,7 +624,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -645,7 +624,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
// prepare data to insert // prepare data to insert
List<UserTemp> importUserTempList = new ArrayList<>(); List<UserTemp> importUserTempList = new ArrayList<>();
for (Map map : dataMapCollection) { for (Map map : dataMapCollection) {
if(StringUtils.isEmpty(map.get("Admin用户").toString()) || StringUtils.isEmpty(map.get("用户名").toString()) if (StringUtils.isEmpty(map.get("Admin用户").toString()) || StringUtils.isEmpty(map.get("用户名").toString())
|| StringUtils.isEmpty(map.get("所属机构").toString()) || StringUtils.isEmpty(map.get("角色").toString())) { || StringUtils.isEmpty(map.get("所属机构").toString()) || StringUtils.isEmpty(map.get("角色").toString())) {
continue; continue;
} }
...@@ -673,7 +652,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -673,7 +652,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<OrganizationStructure> orgStructureList = new ArrayList<>(); List<OrganizationStructure> orgStructureList = new ArrayList<>();
//if headers are valid //if headers are valid
if(dataInitDto.getIsImportOrgStructureValid()) { if (dataInitDto.getIsImportOrgStructureValid()) {
/* /*
* 目前采用逐条插入的方法, 如今后数据量大可改用批量插入, 但需要加入数据校验 * 目前采用逐条插入的方法, 如今后数据量大可改用批量插入, 但需要加入数据校验
*/ */
...@@ -690,7 +669,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -690,7 +669,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long newCount = organizationStructureMapper.countByExample(null); Long newCount = organizationStructureMapper.countByExample(null);
DataCountDto dataCountDto = new DataCountDto(orgStructureList.size(), originalCount, newCount, errorCount, "机构层级"); DataCountDto dataCountDto = new DataCountDto(orgStructureList.size(), originalCount, newCount, errorCount, "机构层级");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入机构层级错误"); dataInitDto.getErrorMsgs().add("导入机构层级错误");
} }
} }
...@@ -707,7 +686,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -707,7 +686,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = businessUnitMapper.countByExample(null); Long originalCount = businessUnitMapper.countByExample(null);
List<BusinessUnit> businessUnitList = new ArrayList<>(); List<BusinessUnit> businessUnitList = new ArrayList<>();
if(dataInitDto.getIsImportBusinessUnitValid()) { if (dataInitDto.getIsImportBusinessUnitValid()) {
/* /*
* 目前采用逐条插入的方法, 如今后数据量大可改用批量插入, 但需要加入数据校验 * 目前采用逐条插入的方法, 如今后数据量大可改用批量插入, 但需要加入数据校验
*/ */
...@@ -726,7 +705,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -726,7 +705,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(businessUnitList.size(), originalCount, newCount, errorCount, "事业部"); DataCountDto dataCountDto = new DataCountDto(businessUnitList.size(), originalCount, newCount, errorCount, "事业部");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入事业部错误"); dataInitDto.getErrorMsgs().add("导入事业部错误");
} }
} }
...@@ -746,7 +725,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -746,7 +725,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
* 准备数据时需要通过非空校验 * 准备数据时需要通过非空校验
*/ */
List<AreaRegion> areaRegionList = new ArrayList<>(); List<AreaRegion> areaRegionList = new ArrayList<>();
if(dataInitDto.getIsImportAreaValid()) { if (dataInitDto.getIsImportAreaValid()) {
// 插入Area // 插入Area
List<Area> areaList = dataInitDto.getImportAreaList(); List<Area> areaList = dataInitDto.getImportAreaList();
areaRegionList = dataInitDto.getImportAreaRegionList(); areaRegionList = dataInitDto.getImportAreaRegionList();
...@@ -755,7 +734,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -755,7 +734,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
//in case area exists //in case area exists
AreaExample areaExample = new AreaExample(); AreaExample areaExample = new AreaExample();
areaExample.createCriteria().andNameEqualTo(item.getName()).andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS); areaExample.createCriteria().andNameEqualTo(item.getName()).andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS);
if(areaMapper.selectByExample(areaExample).isEmpty()) { if (areaMapper.selectByExample(areaExample).isEmpty()) {
areaMapper.insert(item); areaMapper.insert(item);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -769,7 +748,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -769,7 +748,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
//in case area region exists //in case area region exists
AreaRegionExample areaRegionExample = new AreaRegionExample(); AreaRegionExample areaRegionExample = new AreaRegionExample();
areaRegionExample.createCriteria().andAreaIdEqualTo(item.getAreaId()).andRegionIdEqualTo(item.getRegionId()); areaRegionExample.createCriteria().andAreaIdEqualTo(item.getAreaId()).andRegionIdEqualTo(item.getRegionId());
if(areaRegionMapper.selectByExample(areaRegionExample).isEmpty()) { if (areaRegionMapper.selectByExample(areaRegionExample).isEmpty()) {
areaRegionMapper.insert(item); areaRegionMapper.insert(item);
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -783,7 +762,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -783,7 +762,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(areaRegionList.size(), originalCount, newCount, errorCount, "区域"); DataCountDto dataCountDto = new DataCountDto(areaRegionList.size(), originalCount, newCount, errorCount, "区域");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入区域错误"); dataInitDto.getErrorMsgs().add("导入区域错误");
} }
} }
...@@ -799,7 +778,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -799,7 +778,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = enterpriseAccountMapper.countByExample(null); Long originalCount = enterpriseAccountMapper.countByExample(null);
List<EnterpriseAccount> enterpriseAccountList = new ArrayList<>(); List<EnterpriseAccount> enterpriseAccountList = new ArrayList<>();
if(dataInitDto.getIsImportEnterpriseAccountValid()) { if (dataInitDto.getIsImportEnterpriseAccountValid()) {
/* /*
* 准备数据时需要通过非空校验 * 准备数据时需要通过非空校验
*/ */
...@@ -819,7 +798,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -819,7 +798,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(enterpriseAccountList.size(), originalCount, newCount, errorCount, "企业科目"); DataCountDto dataCountDto = new DataCountDto(enterpriseAccountList.size(), originalCount, newCount, errorCount, "企业科目");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入企业科目错误"); dataInitDto.getErrorMsgs().add("导入企业科目错误");
} }
} }
...@@ -835,7 +814,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -835,7 +814,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = customerMapper.countByExample(null); Long originalCount = customerMapper.countByExample(null);
List<Customer> customerList = new ArrayList<>(); List<Customer> customerList = new ArrayList<>();
if(dataInitDto.getIsImportCustomerValid()) { if (dataInitDto.getIsImportCustomerValid()) {
/* /*
* 准备数据时需要通过非空校验 * 准备数据时需要通过非空校验
*/ */
...@@ -855,7 +834,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -855,7 +834,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(customerList.size(), originalCount, newCount, errorCount, "客户列表"); DataCountDto dataCountDto = new DataCountDto(customerList.size(), originalCount, newCount, errorCount, "客户列表");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入客户列表错误"); dataInitDto.getErrorMsgs().add("导入客户列表错误");
} }
} }
...@@ -871,7 +850,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -871,7 +850,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = organizationMapper.countByExample(null); Long originalCount = organizationMapper.countByExample(null);
List<Organization> organizationList = new ArrayList<>(); List<Organization> organizationList = new ArrayList<>();
if(dataInitDto.getIsImportOrganizationValid()) { if (dataInitDto.getIsImportOrganizationValid()) {
RegionExample regionExample = new RegionExample(); RegionExample regionExample = new RegionExample();
regionExample.setOrderByClause("LevelType DESC"); regionExample.setOrderByClause("LevelType DESC");
/* /*
...@@ -893,13 +872,14 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -893,13 +872,14 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(organizationList.size(), originalCount, newCount, errorCount, "机构"); DataCountDto dataCountDto = new DataCountDto(organizationList.size(), originalCount, newCount, errorCount, "机构");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入机构列表错误"); dataInitDto.getErrorMsgs().add("导入机构列表错误");
} }
} }
/** /**
* 导入角色数据 * 导入角色数据
*
* @param dataInitDto * @param dataInitDto
* @return * @return
*/ */
...@@ -909,7 +889,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -909,7 +889,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = roleMapper.countByExample(null); Long originalCount = roleMapper.countByExample(null);
List<Role> roleList = new ArrayList<>(); List<Role> roleList = new ArrayList<>();
if(dataInitDto.getIsImportRoleValid()) { if (dataInitDto.getIsImportRoleValid()) {
/* /*
* 准备数据时需要通过非空校验 * 准备数据时需要通过非空校验
*/ */
...@@ -926,7 +906,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -926,7 +906,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
List<RoleCategory> queryList = roleCategoryMapper.selectByExample(null); List<RoleCategory> queryList = roleCategoryMapper.selectByExample(null);
//插入角色 //插入角色
for(Role role : roleList) { for (Role role : roleList) {
//用Id替换掉名字 //用Id替换掉名字
String oldId = role.getRoleCategoryId(); String oldId = role.getRoleCategoryId();
RoleCategory newObject = queryList.stream().filter(a -> Objects.equals(a.getName(), oldId)).findFirst().orElse(null); RoleCategory newObject = queryList.stream().filter(a -> Objects.equals(a.getName(), oldId)).findFirst().orElse(null);
...@@ -942,13 +922,14 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -942,13 +922,14 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long newCount = roleMapper.countByExample(null); Long newCount = roleMapper.countByExample(null);
DataCountDto dataCountDto = new DataCountDto(roleList.size(), originalCount, newCount, errorCount, "角色"); DataCountDto dataCountDto = new DataCountDto(roleList.size(), originalCount, newCount, errorCount, "角色");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入角色列表错误"); dataInitDto.getErrorMsgs().add("导入角色列表错误");
} }
} }
/** /**
* 导入用户数据 * 导入用户数据
*
* @param dataInitDto * @param dataInitDto
* @return * @return
*/ */
...@@ -957,7 +938,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -957,7 +938,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
Long originalCount = userMapper.countByExample(null); Long originalCount = userMapper.countByExample(null);
List<UserTemp> userTempList = new ArrayList<>(); List<UserTemp> userTempList = new ArrayList<>();
if(dataInitDto.getIsImportUserTempValid()) { if (dataInitDto.getIsImportUserTempValid()) {
/* /*
* 准备数据时需要通过非空校验 * 准备数据时需要通过非空校验
*/ */
...@@ -970,7 +951,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -970,7 +951,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
try { try {
User user = new User(); User user = new User();
Organization orgObject = orgList.stream().filter(a -> Objects.equals(a.getName(), item.getOrganizationName())).findFirst().orElse(null); Organization orgObject = orgList.stream().filter(a -> Objects.equals(a.getName(), item.getOrganizationName())).findFirst().orElse(null);
if(orgObject != null) { if (orgObject != null) {
String userId = CommonUtils.getUUID(); String userId = CommonUtils.getUUID();
user.setId(userId); user.setId(userId);
user.setUserName(item.getUserName()); user.setUserName(item.getUserName());
...@@ -984,9 +965,9 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -984,9 +965,9 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
user.setOrganizationId(orgObject.getId()); user.setOrganizationId(orgObject.getId());
userMapper.insert(user); userMapper.insert(user);
String[] roleNames = item.getRoleName().split("\\,|\\,"); String[] roleNames = item.getRoleName().split("\\,|\\,");
for(String roleName : roleNames) { for (String roleName : roleNames) {
Role roleObject = roleList.stream().filter(a -> Objects.equals(a.getName(), roleName)).findFirst().orElse(null); Role roleObject = roleList.stream().filter(a -> Objects.equals(a.getName(), roleName)).findFirst().orElse(null);
if(roleObject != null) { if (roleObject != null) {
UserRole userRole = new UserRole(); UserRole userRole = new UserRole();
userRole.setId(CommonUtils.getUUID()); userRole.setId(CommonUtils.getUUID());
userRole.setUserId(userId); userRole.setUserId(userId);
...@@ -1007,7 +988,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ ...@@ -1007,7 +988,7 @@ public class DataInitServiceImpl extends AbstractService implements DataInitServ
DataCountDto dataCountDto = new DataCountDto(userTempList.size(), originalCount, newCount, errorCount, "用户"); DataCountDto dataCountDto = new DataCountDto(userTempList.size(), originalCount, newCount, errorCount, "用户");
dataInitDto.getValidMsgs().add(dataCountDto); dataInitDto.getValidMsgs().add(dataCountDto);
if(errorCount > 0) { if (errorCount > 0) {
dataInitDto.getErrorMsgs().add("导入用户列表错误"); dataInitDto.getErrorMsgs().add("导入用户列表错误");
} }
} }
......
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);
......
...@@ -11,14 +11,24 @@ import org.nutz.lang.Files; ...@@ -11,14 +11,24 @@ import org.nutz.lang.Files;
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 org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.*; import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.OperateLogType;
import pwc.taxtech.atms.common.OperationAction;
import pwc.taxtech.atms.common.OperationModule;
import pwc.taxtech.atms.common.message.EnterpriseAccountMessage; import pwc.taxtech.atms.common.message.EnterpriseAccountMessage;
import pwc.taxtech.atms.common.message.EnterpriseAccountSetOrgMsg; import pwc.taxtech.atms.common.message.EnterpriseAccountSetOrgMsg;
import pwc.taxtech.atms.common.message.LogMessage; import pwc.taxtech.atms.common.message.LogMessage;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant; import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.constant.IndustryConstant; import pwc.taxtech.atms.constant.IndustryConstant;
import pwc.taxtech.atms.constant.enums.AccountRuleEnum; import pwc.taxtech.atms.constant.enums.AccountRuleEnum;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.AccountMappingDao;
import pwc.taxtech.atms.dao.AccountMappingManualDao;
import pwc.taxtech.atms.dao.AccountMappingManualMapper;
import pwc.taxtech.atms.dao.EnterpriseAccountDao;
import pwc.taxtech.atms.dao.EnterpriseAccountSetOrgDao;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.StandardAccountDao;
import pwc.taxtech.atms.dpo.EnterpriseAccountDto; import pwc.taxtech.atms.dpo.EnterpriseAccountDto;
import pwc.taxtech.atms.dto.OperationLogDto; import pwc.taxtech.atms.dto.OperationLogDto;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.OperationResultDto;
...@@ -31,7 +41,6 @@ import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountAndValidateInfo; ...@@ -31,7 +41,6 @@ import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountAndValidateInfo;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto; import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto;
import pwc.taxtech.atms.dto.stdaccount.StandardAccountDto; import pwc.taxtech.atms.dto.stdaccount.StandardAccountDto;
import pwc.taxtech.atms.entity.*; import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.service.AccountService;
import pwc.taxtech.atms.service.EnterpriseAccountService; import pwc.taxtech.atms.service.EnterpriseAccountService;
import pwc.taxtech.atms.service.EnterpriseAccountSetService; import pwc.taxtech.atms.service.EnterpriseAccountSetService;
...@@ -43,7 +52,7 @@ import java.util.stream.Collectors; ...@@ -43,7 +52,7 @@ import java.util.stream.Collectors;
public class EnterpriseAccountServiceImpl extends AbstractService implements EnterpriseAccountService { public class EnterpriseAccountServiceImpl extends AbstractService implements EnterpriseAccountService {
@Autowired @Autowired
private AccountService accountService; private AccountServiceImpl accountService;
@Autowired @Autowired
private EnterpriseAccountSetService enterpriseAccountSetService; private EnterpriseAccountSetService enterpriseAccountSetService;
@Autowired @Autowired
...@@ -75,7 +84,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -75,7 +84,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
example.createCriteria().andCodeEqualTo(enterpriseAccountCode).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId); example.createCriteria().andCodeEqualTo(enterpriseAccountCode).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId);
List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(example); List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(example);
return CollectionUtils.isEmpty(epAccounts)?null:epAccounts.get(0); return CollectionUtils.isEmpty(epAccounts) ? null : epAccounts.get(0);
} }
/* /*
...@@ -95,7 +104,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -95,7 +104,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
//no enterprise account //no enterprise account
if(epAccounts==null || epAccounts.isEmpty()) { if (epAccounts == null || epAccounts.isEmpty()) {
return new EnterpriseAccountAndValidateInfo(); return new EnterpriseAccountAndValidateInfo();
} }
...@@ -105,7 +114,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -105,7 +114,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
//set stdName //set stdName
List<EnterpriseAccountDto> epAccountDtoList = new ArrayList<>(); List<EnterpriseAccountDto> epAccountDtoList = new ArrayList<>();
for(EnterpriseAccount epAccount: epAccounts) { for (EnterpriseAccount epAccount : epAccounts) {
EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto(); EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto();
CommonUtils.copyProperties(epAccount, epAccountDto); CommonUtils.copyProperties(epAccount, epAccountDto);
...@@ -113,7 +122,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -113,7 +122,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
epAccountDto.setParentFullName(""); epAccountDto.setParentFullName("");
epAccountDto.setStdName(""); epAccountDto.setStdName("");
stdAccounts.stream().filter(stdAccount -> stdAccount.getCode().equals(epAccount.getStdCode())).findFirst() stdAccounts.stream().filter(stdAccount -> stdAccount.getCode().equals(epAccount.getStdCode())).findFirst()
.ifPresent(stdAccount -> {epAccountDto.setStdName(stdAccount.getName());}); .ifPresent(stdAccount -> {
epAccountDto.setStdName(stdAccount.getName());
});
epAccountDtoList.add(epAccountDto); epAccountDtoList.add(epAccountDto);
} }
...@@ -122,15 +133,15 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -122,15 +133,15 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<EnterpriseAccountDto> topEpAccountDtoList List<EnterpriseAccountDto> topEpAccountDtoList
= epAccountDtoList.stream().filter(epAccountDto -> epAccountDto.getParentCode() == null) = epAccountDtoList.stream().filter(epAccountDto -> epAccountDto.getParentCode() == null)
.collect(Collectors.toList()); .collect(Collectors.toList());
for(EnterpriseAccountDto epAccountDto: topEpAccountDtoList) { for (EnterpriseAccountDto epAccountDto : topEpAccountDtoList) {
epAccountDto.setTreeLevel(0); epAccountDto.setTreeLevel(0);
retEpAccountDtoList.add(epAccountDto); retEpAccountDtoList.add(epAccountDto);
retEpAccountDtoList.addAll(getWrapList(epAccountDto, epAccountDtoList)); retEpAccountDtoList.addAll(getWrapList(epAccountDto, epAccountDtoList));
} }
//lost epAccounts list //lost epAccounts list
for(EnterpriseAccountDto epAccountDto: epAccountDtoList) { for (EnterpriseAccountDto epAccountDto : epAccountDtoList) {
if( !retEpAccountDtoList.contains(epAccountDto)) { if (!retEpAccountDtoList.contains(epAccountDto)) {
retEpAccountDtoList.add(epAccountDto); retEpAccountDtoList.add(epAccountDto);
} }
} }
...@@ -167,7 +178,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -167,7 +178,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
EnterpriseAccountDto enterpriseAccountDto = new EnterpriseAccountDto(); EnterpriseAccountDto enterpriseAccountDto = new EnterpriseAccountDto();
CommonUtils.copyProperties(enterpriseAccount, enterpriseAccountDto); CommonUtils.copyProperties(enterpriseAccount, enterpriseAccountDto);
epAccounts.stream().filter(epAccount -> enterpriseAccount.getParentCode()!=null && enterpriseAccount.getParentCode().equals(epAccount.getCode())).findFirst() epAccounts.stream().filter(epAccount -> enterpriseAccount.getParentCode() != null && enterpriseAccount.getParentCode().equals(epAccount.getCode())).findFirst()
.ifPresent(epAccount -> { .ifPresent(epAccount -> {
enterpriseAccountDto.setParentName(epAccount.getName()); enterpriseAccountDto.setParentName(epAccount.getName());
enterpriseAccountDto.setParentFullName(epAccount.getFullName()); enterpriseAccountDto.setParentFullName(epAccount.getFullName());
...@@ -189,7 +200,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -189,7 +200,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
@Transactional @Transactional
public OperationResultDto<List<EnterpriseAccountDto>> addEnterpriseAccount(EnterpriseAccountDto enterpriseAccountDto) { public OperationResultDto<List<EnterpriseAccountDto>> addEnterpriseAccount(EnterpriseAccountDto enterpriseAccountDto) {
if(enterpriseAccountDto == null) { if (enterpriseAccountDto == null) {
return new OperationResultDto<>(false); return new OperationResultDto<>(false);
} }
EnterpriseAccount entityToAdd = new EnterpriseAccount(); EnterpriseAccount entityToAdd = new EnterpriseAccount();
...@@ -197,7 +208,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -197,7 +208,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
//check duplication ep account //check duplication ep account
List<EnterpriseAccountDto> sameEpAccounts = getSameEnterpriseAccountList(enterpriseAccountDto); List<EnterpriseAccountDto> sameEpAccounts = getSameEnterpriseAccountList(enterpriseAccountDto);
if(sameEpAccounts!=null && !sameEpAccounts.isEmpty()) { if (sameEpAccounts != null && !sameEpAccounts.isEmpty()) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.EnterpriceAccountRepeat, sameEpAccounts); return new OperationResultDto<>(false, EnterpriseAccountMessage.EnterpriceAccountRepeat, sameEpAccounts);
} }
//set parent account no leaf //set parent account no leaf
...@@ -221,7 +232,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -221,7 +232,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
epAccountCodeList.add(entityToAdd.getCode()); epAccountCodeList.add(entityToAdd.getCode());
this.mapParentAccountResult = new HashMap<>(); this.mapParentAccountResult = new HashMap<>();
for(EnterpriseAccountSetOrg accountSetOrg : accountSetOrgList) { for (EnterpriseAccountSetOrg accountSetOrg : accountSetOrgList) {
String industryId = organizationMapper.selectByPrimaryKey(accountSetOrg.getOrganizationId()).getIndustryId(); String industryId = organizationMapper.selectByPrimaryKey(accountSetOrg.getOrganizationId()).getIndustryId();
mapAccountUpdateParent(epAccountCodeList, accountSetOrg.getEnterpriseAccountSetId(), getConvertedIndustryId(industryId), accountSetOrg.getOrganizationId(), true); mapAccountUpdateParent(epAccountCodeList, accountSetOrg.getEnterpriseAccountSetId(), getConvertedIndustryId(industryId), accountSetOrg.getOrganizationId(), true);
} }
...@@ -251,18 +262,18 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -251,18 +262,18 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
@Transactional @Transactional
public OperationResultDto<List<EnterpriseAccountDto>> updateEnterpriseAccount(EnterpriseAccountDto enterpriseAccountDto) { public OperationResultDto<List<EnterpriseAccountDto>> updateEnterpriseAccount(EnterpriseAccountDto enterpriseAccountDto) {
if(enterpriseAccountDto == null) { if (enterpriseAccountDto == null) {
return new OperationResultDto<>(false); return new OperationResultDto<>(false);
} }
EnterpriseAccount entityToUpdate = enterpriseAccountMapper.selectByPrimaryKey(enterpriseAccountDto.getId()); EnterpriseAccount entityToUpdate = enterpriseAccountMapper.selectByPrimaryKey(enterpriseAccountDto.getId());
if(entityToUpdate == null) { if (entityToUpdate == null) {
return new OperationResultDto<>(false); return new OperationResultDto<>(false);
} }
//check duplication ep account //check duplication ep account
List<EnterpriseAccountDto> sameEpAccounts = getSameEnterpriseAccountList(enterpriseAccountDto); List<EnterpriseAccountDto> sameEpAccounts = getSameEnterpriseAccountList(enterpriseAccountDto);
if(sameEpAccounts!=null && !sameEpAccounts.isEmpty()) { if (sameEpAccounts != null && !sameEpAccounts.isEmpty()) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.EnterpriceAccountRepeat, sameEpAccounts); return new OperationResultDto<>(false, EnterpriseAccountMessage.EnterpriceAccountRepeat, sameEpAccounts);
} }
...@@ -270,7 +281,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -270,7 +281,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
EnterpriseAccount entityCopy = new EnterpriseAccount(); EnterpriseAccount entityCopy = new EnterpriseAccount();
CommonUtils.copyProperties(entityToUpdate, entityCopy); CommonUtils.copyProperties(entityToUpdate, entityCopy);
if(entityCopy.getParentCode()!=null && !entityCopy.getParentCode().equals(enterpriseAccountDto.getParentCode())) { if (entityCopy.getParentCode() != null && !entityCopy.getParentCode().equals(enterpriseAccountDto.getParentCode())) {
// reset the isleaf // reset the isleaf
setParentIsNotLeaf(enterpriseAccountDto.getParentCode(), enterpriseAccountDto.getEnterpriseAccountSetId()); setParentIsNotLeaf(enterpriseAccountDto.getParentCode(), enterpriseAccountDto.getEnterpriseAccountSetId());
setParentLeaf(entityCopy.getParentCode(), enterpriseAccountDto.getEnterpriseAccountSetId(), enterpriseAccountDto.getId()); setParentLeaf(entityCopy.getParentCode(), enterpriseAccountDto.getEnterpriseAccountSetId(), enterpriseAccountDto.getId());
...@@ -284,9 +295,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -284,9 +295,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andParentCodeEqualTo(entityCopy.getCode()) .andParentCodeEqualTo(entityCopy.getCode())
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountDto.getEnterpriseAccountSetId()); .andEnterpriseAccountSetIdEqualTo(enterpriseAccountDto.getEnterpriseAccountSetId());
List<EnterpriseAccount> childrenAccountList = enterpriseAccountMapper.selectByExample(enterpriseAccountexample); List<EnterpriseAccount> childrenAccountList = enterpriseAccountMapper.selectByExample(enterpriseAccountexample);
if(childrenAccountList!=null && !childrenAccountList.isEmpty()) { if (childrenAccountList != null && !childrenAccountList.isEmpty()) {
if(!entityCopy.getCode().equals(enterpriseAccountDto.getCode()) || !entityCopy.getName().equals(enterpriseAccountDto.getName())) { if (!entityCopy.getCode().equals(enterpriseAccountDto.getCode()) || !entityCopy.getName().equals(enterpriseAccountDto.getName())) {
for(EnterpriseAccount childrenAccount: childrenAccountList) { for (EnterpriseAccount childrenAccount : childrenAccountList) {
childrenAccount.setParentCode(enterpriseAccountDto.getCode()); childrenAccount.setParentCode(enterpriseAccountDto.getCode());
childrenAccount.setFullName(enterpriseAccountDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator + childrenAccount.getName()); childrenAccount.setFullName(enterpriseAccountDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator + childrenAccount.getName());
enterpriseAccountMapper.updateByPrimaryKey(childrenAccount); enterpriseAccountMapper.updateByPrimaryKey(childrenAccount);
...@@ -313,8 +324,8 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -313,8 +324,8 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
epAccountCodeList.add(entityToUpdate.getCode()); epAccountCodeList.add(entityToUpdate.getCode());
this.mapParentAccountResult = new HashMap<>(); this.mapParentAccountResult = new HashMap<>();
for(EnterpriseAccountSetOrg accountSetOrg : accountSetOrgList) { for (EnterpriseAccountSetOrg accountSetOrg : accountSetOrgList) {
if(entityToUpdate.getParentCode()!=null && entityToUpdate.getParentCode().equals(entityCopy.getParentCode())) { if (entityToUpdate.getParentCode() != null && entityToUpdate.getParentCode().equals(entityCopy.getParentCode())) {
/* @See below C#代码 EnterpriseAccountService.cs Line 238-240 /* @See below C#代码 EnterpriseAccountService.cs Line 238-240
* string updateSql = "UPDATE AccountMapping SET StandardAccountCode='00' WHERE EnterpriseAccountCode={0} AND EnterpriseAccountSetId={1} AND OrganizationId={2} AND IndustryId={3}"; * string updateSql = "UPDATE AccountMapping SET StandardAccountCode='00' WHERE EnterpriseAccountCode={0} AND EnterpriseAccountSetId={1} AND OrganizationId={2} AND IndustryId={3}";
...@@ -375,12 +386,12 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -375,12 +386,12 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId) .andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId)
.andCodeEqualTo(epAccountCode); .andCodeEqualTo(epAccountCode);
List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> epAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if(CollectionUtils.isEmpty(epAccounts)) { if (CollectionUtils.isEmpty(epAccounts)) {
continue; continue;
} }
EnterpriseAccount epAccount = epAccounts.get(0); EnterpriseAccount epAccount = epAccounts.get(0);
//如果当前对应的本身就是第一级,不需要再考虑 //如果当前对应的本身就是第一级,不需要再考虑
if(epAccount.getParentCode() == null || epAccount.getParentCode().isEmpty()) { if (epAccount.getParentCode() == null || epAccount.getParentCode().isEmpty()) {
continue; continue;
} }
...@@ -390,7 +401,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -390,7 +401,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId) .andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId)
.andCodeEqualTo(epAccount.getParentCode()); .andCodeEqualTo(epAccount.getParentCode());
List<EnterpriseAccount> parentEpAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> parentEpAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if(CollectionUtils.isEmpty(parentEpAccounts)) { if (CollectionUtils.isEmpty(parentEpAccounts)) {
return; //C# return return; //C# return
} }
EnterpriseAccount parentEpAccount = parentEpAccounts.get(0); EnterpriseAccount parentEpAccount = parentEpAccounts.get(0);
...@@ -399,26 +410,26 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -399,26 +410,26 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<EnterpriseAccount> childrenEpAccountList = getMappingResultByParentCode(parentEpAccount.getCode(), enterpriseAccountSetId, industryId, orgId); List<EnterpriseAccount> childrenEpAccountList = getMappingResultByParentCode(parentEpAccount.getCode(), enterpriseAccountSetId, industryId, orgId);
//第四步: 判断第三步获取到企业科目中,标准科目为空的个数 //第四步: 判断第三步获取到企业科目中,标准科目为空的个数
if(CollectionUtils.isEmpty(childrenEpAccountList)) { if (CollectionUtils.isEmpty(childrenEpAccountList)) {
continue; continue;
} }
long emptyStdCodeCount = childrenEpAccountList.stream().filter(sa -> sa.getStdCode()==null || sa.getStdCode().isEmpty()).count(); long emptyStdCodeCount = childrenEpAccountList.stream().filter(sa -> sa.getStdCode() == null || sa.getStdCode().isEmpty()).count();
//第五部: 将第三步获取到的所有企业科目取出其中的StdCode并去重 //第五部: 将第三步获取到的所有企业科目取出其中的StdCode并去重
List<String> uniqueStdCodeList = childrenEpAccountList.stream() List<String> uniqueStdCodeList = childrenEpAccountList.stream()
.filter(sa -> sa.getStdCode()!=null && !sa.getStdCode().isEmpty()) .filter(sa -> sa.getStdCode() != null && !sa.getStdCode().isEmpty())
.map(sa -> sa.getStdCode()).collect(Collectors.toList()); .map(sa -> sa.getStdCode()).collect(Collectors.toList());
/* 数据准备 end */ /* 数据准备 end */
/* 业务处理 start */ /* 业务处理 start */
//等于0说明子科目全部都有对应上 //等于0说明子科目全部都有对应上
if(emptyStdCodeCount == 0) { if (emptyStdCodeCount == 0) {
long countOfDistinctStdCode = uniqueStdCodeList.size(); long countOfDistinctStdCode = uniqueStdCodeList.size();
//等于1说明对应上的标准科目都是同一个 //等于1说明对应上的标准科目都是同一个
if(countOfDistinctStdCode == 1) { if (countOfDistinctStdCode == 1) {
//2. 手动对应,子科目完全对应的时候并且都对应到同一个标准科目,那么父级也要对应到该标准科目 //2. 手动对应,子科目完全对应的时候并且都对应到同一个标准科目,那么父级也要对应到该标准科目
mappedStdCode = uniqueStdCodeList.get(0); mappedStdCode = uniqueStdCodeList.get(0);
} }
...@@ -430,7 +441,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -430,7 +441,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
standardAccountExample.createCriteria() standardAccountExample.createCriteria()
.andCodeIn(uniqueStdCodeList).andIndustryIdEqualTo(industryId); .andCodeIn(uniqueStdCodeList).andIndustryIdEqualTo(industryId);
List<StandardAccount> standardAccountList = standardAccountMapper.selectByExample(standardAccountExample); List<StandardAccount> standardAccountList = standardAccountMapper.selectByExample(standardAccountExample);
if(CollectionUtils.isEmpty(standardAccountList)) { if (CollectionUtils.isEmpty(standardAccountList)) {
continue; continue;
} }
List<String> distinctStdParentCodeList = standardAccountList.stream() List<String> distinctStdParentCodeList = standardAccountList.stream()
...@@ -438,34 +449,30 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -438,34 +449,30 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
long uniqueStdParentCodeCount = distinctStdParentCodeList.size(); long uniqueStdParentCodeCount = distinctStdParentCodeList.size();
//等于1说明对应上的都属于同一个父级标准科目 //等于1说明对应上的都属于同一个父级标准科目
if(uniqueStdParentCodeCount == 1 if (uniqueStdParentCodeCount == 1
&& distinctStdParentCodeList.get(0)!=null && !distinctStdParentCodeList.get(0).isEmpty() && distinctStdParentCodeList.get(0) != null && !distinctStdParentCodeList.get(0).isEmpty()
&& !uniqueStdCodeList.contains("0000")) { && !uniqueStdCodeList.contains("0000")) {
//子科目完全对应的时候但是没有对应到同一个标准科目但是属于同一个父科目下,那么该企业科目的父级也要对应到该标准科目的父级 //子科目完全对应的时候但是没有对应到同一个标准科目但是属于同一个父科目下,那么该企业科目的父级也要对应到该标准科目的父级
mappedStdCode = standardAccountList.get(0).getParentCode(); mappedStdCode = standardAccountList.get(0).getParentCode();
} } else {
else {
//子科目完全对应的时候但是没有对应到同一个标准科目又不属于同一个父科目下,那么该企业科目的父级显示为横线 - //子科目完全对应的时候但是没有对应到同一个标准科目又不属于同一个父科目下,那么该企业科目的父级显示为横线 -
mappedStdCode = CommonConstants.EmptyStdCode; mappedStdCode = CommonConstants.EmptyStdCode;
} }
} }
} } else {
else {
//4. 手动对应,子科目没有全对应的时候,那么父级科目显示为未对应 //4. 手动对应,子科目没有全对应的时候,那么父级科目显示为未对应
mappedStdCode = null; mappedStdCode = null;
} }
/* 更新UI准备 start */ /* 更新UI准备 start */
StandardAccount stdAccount = new StandardAccount(); StandardAccount stdAccount = new StandardAccount();
if(mappedStdCode == CommonConstants.EmptyStdCode) { if (mappedStdCode == CommonConstants.EmptyStdCode) {
stdAccount.setCode(CommonConstants.EmptyStdCode); stdAccount.setCode(CommonConstants.EmptyStdCode);
stdAccount.setName(""); stdAccount.setName("");
} } else if (mappedStdCode == null) {
else if(mappedStdCode == null) {
stdAccount.setCode(null); stdAccount.setCode(null);
stdAccount.setName(""); stdAccount.setName("");
} } else {
else {
StandardAccountExample standardAccountExample = new StandardAccountExample(); StandardAccountExample standardAccountExample = new StandardAccountExample();
standardAccountExample.createCriteria() standardAccountExample.createCriteria()
.andCodeEqualTo(mappedStdCode) .andCodeEqualTo(mappedStdCode)
...@@ -504,12 +511,12 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -504,12 +511,12 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
enterpriseAccountSetDto.setCode(enterpriseAccountSetCode); enterpriseAccountSetDto.setCode(enterpriseAccountSetCode);
//validate name is duplicated //validate name is duplicated
OperationResultDto<?> nameValidate = enterpriseAccountSetService.enterpriseAccountSetNameValidate(enterpriseAccountSetDto); OperationResultDto<?> nameValidate = enterpriseAccountSetService.enterpriseAccountSetNameValidate(enterpriseAccountSetDto);
if(!nameValidate.getResult()) { if (!nameValidate.getResult()) {
return nameValidate; return nameValidate;
} }
//validate code is duplicated //validate code is duplicated
OperationResultDto<?> codeValidate = enterpriseAccountSetService.enterpriseAccountSetCodeValidate(enterpriseAccountSetDto); OperationResultDto<?> codeValidate = enterpriseAccountSetService.enterpriseAccountSetCodeValidate(enterpriseAccountSetDto);
if(!codeValidate.getResult()) { if (!codeValidate.getResult()) {
return codeValidate; return codeValidate;
} }
...@@ -537,7 +544,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -537,7 +544,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
operationLogService.addOrDeleteDataAddLog(updateLogParams); operationLogService.addOrDeleteDataAddLog(updateLogParams);
//nothing to import //nothing to import
if(importData == null && CollectionUtils.isEmpty(importData)) { if (importData == null && CollectionUtils.isEmpty(importData)) {
return OperationResultDto.success(); return OperationResultDto.success();
} }
...@@ -572,15 +579,15 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -572,15 +579,15 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetDto.getId()); .andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetDto.getId());
List<EnterpriseAccount> epAccountList = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> epAccountList = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if(enterpriseAccountSetDto.getRepeatCodeList() == null && enterpriseAccountSetDto.getRepeatCodeList().isEmpty()) { if (enterpriseAccountSetDto.getRepeatCodeList() == null && enterpriseAccountSetDto.getRepeatCodeList().isEmpty()) {
return OperationResultDto.success(); return OperationResultDto.success();
} }
//删除重复项 留1个 //删除重复项 留1个
for(String repeatCode: enterpriseAccountSetDto.getRepeatCodeList()) { for (String repeatCode : enterpriseAccountSetDto.getRepeatCodeList()) {
List<EnterpriseAccount> repeatedEpAccountList = epAccountList.stream() List<EnterpriseAccount> repeatedEpAccountList = epAccountList.stream()
.filter(sa -> sa.getCode().equals(repeatCode)).collect(Collectors.toList()); .filter(sa -> sa.getCode().equals(repeatCode)).collect(Collectors.toList());
for(int i=0; i<repeatedEpAccountList.size()-1; i++) { for (int i = 0; i < repeatedEpAccountList.size() - 1; i++) {
enterpriseAccountMapper.deleteByPrimaryKey(repeatedEpAccountList.get(i).getId()); enterpriseAccountMapper.deleteByPrimaryKey(repeatedEpAccountList.get(i).getId());
} }
} }
...@@ -592,6 +599,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -592,6 +599,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Generate by-level wrapped enterprise Account list * Generate by-level wrapped enterprise Account list
*
* @param currentEpAccountDto * @param currentEpAccountDto
* @param epAccountDtoList * @param epAccountDtoList
* @return List<EnterpriseAccountDto> * @return List<EnterpriseAccountDto>
...@@ -603,14 +611,14 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -603,14 +611,14 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.filter(epAccountDto -> currentEpAccountDto.getCode().equals(epAccountDto.getParentCode())) .filter(epAccountDto -> currentEpAccountDto.getCode().equals(epAccountDto.getParentCode()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(subList!=null && !subList.isEmpty()) { if (subList != null && !subList.isEmpty()) {
for(EnterpriseAccountDto sub: subList) { for (EnterpriseAccountDto sub : subList) {
sub.setTreeLevel(currentEpAccountDto.getTreeLevel()+1); sub.setTreeLevel(currentEpAccountDto.getTreeLevel() + 1);
sub.setParentName(currentEpAccountDto.getName()); sub.setParentName(currentEpAccountDto.getName());
sub.setParentFullName(currentEpAccountDto.getFullName()); sub.setParentFullName(currentEpAccountDto.getFullName());
result.add(sub); result.add(sub);
List<EnterpriseAccountDto> tempList = getWrapList(sub, epAccountDtoList); List<EnterpriseAccountDto> tempList = getWrapList(sub, epAccountDtoList);
if(tempList!=null && !tempList.isEmpty()) { if (tempList != null && !tempList.isEmpty()) {
result.addAll(tempList); result.addAll(tempList);
} }
} }
...@@ -1142,8 +1150,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1142,8 +1150,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
} }
} }
public void addManualMappingRecord(AccountMappingManual manualMapping) public void addManualMappingRecord(AccountMappingManual manualMapping) {
{
mappingManualDao.delMapping(manualMapping.getFullName(), manualMapping.getEnterpriseAccountSetId(), mappingManualDao.delMapping(manualMapping.getFullName(), manualMapping.getEnterpriseAccountSetId(),
manualMapping.getOrganizationId(), manualMapping.getIndustryId()); manualMapping.getOrganizationId(), manualMapping.getIndustryId());
mappingManualMapper.insertSelective(manualMapping); mappingManualMapper.insertSelective(manualMapping);
...@@ -1217,7 +1224,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1217,7 +1224,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
} }
private void applyPriorityKeywords(List<EnterpriseAccountDto> allEpAccountDtoList, List<AccountMappingManual> allManualList, private void applyPriorityKeywords(List<EnterpriseAccountDto> allEpAccountDtoList, List<AccountMappingManual> allManualList,
String accountSetId, String orgId, String industryId){ String accountSetId, String orgId, String industryId) {
List<AccountMappingManualDto> resultList; List<AccountMappingManualDto> resultList;
//1 账套机构行业都一样 (本身优先级别最高) //1 账套机构行业都一样 (本身优先级别最高)
List<AccountMappingManual> tmpManualList = allManualList.stream().filter(x -> StringUtils.equals(x.getEnterpriseAccountSetId(), accountSetId) List<AccountMappingManual> tmpManualList = allManualList.stream().filter(x -> StringUtils.equals(x.getEnterpriseAccountSetId(), accountSetId)
...@@ -1260,9 +1267,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1260,9 +1267,9 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
resultList = getManualMappingResult(resultList, wrapPriority(tmpManualList, 8)); resultList = getManualMappingResult(resultList, wrapPriority(tmpManualList, 8));
List<AccountMapping> mappingList = Lists.newArrayList(); List<AccountMapping> mappingList = Lists.newArrayList();
resultList.stream().forEach(x->{ resultList.stream().forEach(x -> {
allEpAccountDtoList.stream().filter(EnterpriseAccountDto::getIsLeaf).forEach(y->{ allEpAccountDtoList.stream().filter(EnterpriseAccountDto::getIsLeaf).forEach(y -> {
if (StringUtils.equals(x.getFullName(),y.getFullName())){ if (StringUtils.equals(x.getFullName(), y.getFullName())) {
AccountMapping tmp = new AccountMapping(); AccountMapping tmp = new AccountMapping();
tmp.setId(CommonUtils.getUUID()); tmp.setId(CommonUtils.getUUID());
tmp.setEnterpriseAccountCode(y.getCode()); tmp.setEnterpriseAccountCode(y.getCode());
...@@ -1342,6 +1349,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1342,6 +1349,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates the enterprise account list. * Validates the enterprise account list.
*
* @param epAccountList * @param epAccountList
* @return The validate list * @return The validate list
*/ */
...@@ -1355,13 +1363,14 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1355,13 +1363,14 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
validateInfoDtolist.add(this.getNoParentValidate(epAccountList)); validateInfoDtolist.add(this.getNoParentValidate(epAccountList));
return validateInfoDtolist.stream() return validateInfoDtolist.stream()
.filter(validateInfo -> validateInfo.getInValidateCodeList()!=null && !validateInfo.getInValidateCodeList().isEmpty()) .filter(validateInfo -> validateInfo.getInValidateCodeList() != null && !validateInfo.getInValidateCodeList().isEmpty())
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/** /**
* Validates if there is any duplication account code in the list * Validates if there is any duplication account code in the list
*
* @param list * @param list
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1373,10 +1382,10 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1373,10 +1382,10 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<String> distinctCodeList = epAccountList.stream() List<String> distinctCodeList = epAccountList.stream()
.map(epAccount -> epAccount.getCode()).distinct().collect(Collectors.toList()); .map(epAccount -> epAccount.getCode()).distinct().collect(Collectors.toList());
for(String code: distinctCodeList) { for (String code : distinctCodeList) {
List<EnterpriseAccountDto> accountsWithSameCode = epAccountList.stream() List<EnterpriseAccountDto> accountsWithSameCode = epAccountList.stream()
.filter(epAccount -> code.equals(epAccount.getCode())).collect(Collectors.toList()); .filter(epAccount -> code.equals(epAccount.getCode())).collect(Collectors.toList());
if(accountsWithSameCode!=null && accountsWithSameCode.size()>1) { if (accountsWithSameCode != null && accountsWithSameCode.size() > 1) {
validateInfoDto.addInValidateCode(code); validateInfoDto.addInValidateCode(code);
} }
} }
...@@ -1385,6 +1394,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1385,6 +1394,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates if there is any account with wrong direction value * Validates if there is any account with wrong direction value
*
* @param epAccountList * @param epAccountList
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1405,6 +1415,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1405,6 +1415,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates if there is any account with wrong accprop value * Validates if there is any account with wrong accprop value
*
* @param epAccountList * @param epAccountList
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1415,7 +1426,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1415,7 +1426,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<String> inValidateCodeList = epAccountList.stream() List<String> inValidateCodeList = epAccountList.stream()
.filter(epAccount -> .filter(epAccount ->
epAccount.getAcctProp()!=null && (epAccount.getAcctProp() > EnterpriseAccountConstant.MaxAcctPropValue || (epAccount.getAcctProp() < EnterpriseAccountConstant.MinAcctPropValue && epAccount.getAcctProp() != EnterpriseAccountConstant.SpecialAcctPropValue))) epAccount.getAcctProp() != null && (epAccount.getAcctProp() > EnterpriseAccountConstant.MaxAcctPropValue || (epAccount.getAcctProp() < EnterpriseAccountConstant.MinAcctPropValue && epAccount.getAcctProp() != EnterpriseAccountConstant.SpecialAcctPropValue)))
.map(epAccount -> epAccount.getCode()) .map(epAccount -> epAccount.getCode())
.distinct().collect(Collectors.toList()); .distinct().collect(Collectors.toList());
validateInfoDto.setInValidateCodeList(inValidateCodeList); validateInfoDto.setInValidateCodeList(inValidateCodeList);
...@@ -1425,6 +1436,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1425,6 +1436,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates if there is any account with null accprop value * Validates if there is any account with null accprop value
*
* @param epAccountList * @param epAccountList
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1435,7 +1447,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1435,7 +1447,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
List<String> inValidateCodeList = epAccountList.stream() List<String> inValidateCodeList = epAccountList.stream()
.filter(epAccount -> .filter(epAccount ->
epAccount.getAcctProp()==null) epAccount.getAcctProp() == null)
.map(epAccount -> epAccount.getCode()) .map(epAccount -> epAccount.getCode())
.distinct().collect(Collectors.toList()); .distinct().collect(Collectors.toList());
validateInfoDto.setInValidateCodeList(inValidateCodeList); validateInfoDto.setInValidateCodeList(inValidateCodeList);
...@@ -1445,6 +1457,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1445,6 +1457,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates if there is any account with empty name * Validates if there is any account with empty name
*
* @param epAccountList * @param epAccountList
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1464,6 +1477,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1464,6 +1477,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Validates if there is any account with empty name * Validates if there is any account with empty name
*
* @param epAccountList * @param epAccountList
* @return ValidateInfoDto * @return ValidateInfoDto
*/ */
...@@ -1472,13 +1486,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1472,13 +1486,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
ValidateInfoDto validateInfoDto = new ValidateInfoDto(); ValidateInfoDto validateInfoDto = new ValidateInfoDto();
validateInfoDto.setType(EnterpriseAccountMessage.NoParentCode); validateInfoDto.setType(EnterpriseAccountMessage.NoParentCode);
List<EnterpriseAccountDto> accountsWithParent = epAccountList.stream().filter(epAccount -> epAccount.getParentCode()!=null && !epAccount.getParentCode().equals("")) List<EnterpriseAccountDto> accountsWithParent = epAccountList.stream().filter(epAccount -> epAccount.getParentCode() != null && !epAccount.getParentCode().equals(""))
.collect(Collectors.toList()); .collect(Collectors.toList());
for (EnterpriseAccountDto accountWithParent: accountsWithParent) { for (EnterpriseAccountDto accountWithParent : accountsWithParent) {
boolean parentExist = epAccountList.stream() boolean parentExist = epAccountList.stream()
.anyMatch(epAccount -> epAccount.getCode().equals(accountWithParent.getParentCode())); .anyMatch(epAccount -> epAccount.getCode().equals(accountWithParent.getParentCode()));
if(!parentExist) { if (!parentExist) {
validateInfoDto.addInValidateCode(accountWithParent.getCode()); validateInfoDto.addInValidateCode(accountWithParent.getCode());
} }
} }
...@@ -1489,10 +1503,11 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1489,10 +1503,11 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Gets the same enterprise account list. * Gets the same enterprise account list.
*
* @param enterpriseAccountDto * @param enterpriseAccountDto
* @return * @return
*/ */
private List<EnterpriseAccountDto> getSameEnterpriseAccountList(EnterpriseAccountDto enterpriseAccountDto){ private List<EnterpriseAccountDto> getSameEnterpriseAccountList(EnterpriseAccountDto enterpriseAccountDto) {
if (enterpriseAccountDto == null) { if (enterpriseAccountDto == null) {
return null; return null;
...@@ -1500,7 +1515,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1500,7 +1515,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
EnterpriseAccountExample enterpriseAccountExample = new EnterpriseAccountExample(); EnterpriseAccountExample enterpriseAccountExample = new EnterpriseAccountExample();
EnterpriseAccountExample.Criteria criteria = enterpriseAccountExample.createCriteria(); EnterpriseAccountExample.Criteria criteria = enterpriseAccountExample.createCriteria();
if(enterpriseAccountDto.getId()!=null && !enterpriseAccountDto.getId().isEmpty()) { if (enterpriseAccountDto.getId() != null && !enterpriseAccountDto.getId().isEmpty()) {
criteria.andIdNotEqualTo(enterpriseAccountDto.getId()); criteria.andIdNotEqualTo(enterpriseAccountDto.getId());
} }
criteria.andEnterpriseAccountSetIdEqualTo(enterpriseAccountDto.getEnterpriseAccountSetId()) criteria.andEnterpriseAccountSetIdEqualTo(enterpriseAccountDto.getEnterpriseAccountSetId())
...@@ -1508,22 +1523,22 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1508,22 +1523,22 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS); .andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS);
List<EnterpriseAccount> epAccountsWithSameCode = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> epAccountsWithSameCode = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
//没有重复项 //没有重复项
if(epAccountsWithSameCode == null || epAccountsWithSameCode.isEmpty()) { if (epAccountsWithSameCode == null || epAccountsWithSameCode.isEmpty()) {
return null; return null;
} }
//有重复项 //有重复项
List<EnterpriseAccountDto> sameEnterpriseAccountDtoList = new ArrayList<>(); List<EnterpriseAccountDto> sameEnterpriseAccountDtoList = new ArrayList<>();
for(EnterpriseAccount enterpriseAccount : epAccountsWithSameCode) { for (EnterpriseAccount enterpriseAccount : epAccountsWithSameCode) {
enterpriseAccountExample = new EnterpriseAccountExample(); enterpriseAccountExample = new EnterpriseAccountExample();
criteria = enterpriseAccountExample.createCriteria(); criteria = enterpriseAccountExample.createCriteria();
if(enterpriseAccount.getParentCode()!=null && !enterpriseAccount.getParentCode().isEmpty()) { if (enterpriseAccount.getParentCode() != null && !enterpriseAccount.getParentCode().isEmpty()) {
criteria.andCodeEqualTo(enterpriseAccount.getParentCode()); criteria.andCodeEqualTo(enterpriseAccount.getParentCode());
} }
criteria.andRuleTypeEqualTo(2) criteria.andRuleTypeEqualTo(2)
.andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS); .andIsActiveEqualTo(CommonConstants.ACTIVE_STATUS);
List<EnterpriseAccount> epAccountsParent = enterpriseAccountMapper.selectByExample(enterpriseAccountExample); List<EnterpriseAccount> epAccountsParent = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if(epAccountsParent!=null&&!epAccountsParent.isEmpty()) { if (epAccountsParent != null && !epAccountsParent.isEmpty()) {
epAccountsParent.stream().forEach(epAccountParent -> { epAccountsParent.stream().forEach(epAccountParent -> {
EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto(); EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto();
CommonUtils.copyProperties(enterpriseAccount, epAccountDto); CommonUtils.copyProperties(enterpriseAccount, epAccountDto);
...@@ -1532,8 +1547,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1532,8 +1547,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
epAccountDto.setSubStdAccounts(new ArrayList<>()); epAccountDto.setSubStdAccounts(new ArrayList<>());
sameEnterpriseAccountDtoList.add(epAccountDto); sameEnterpriseAccountDtoList.add(epAccountDto);
}); });
} } else {
else {
EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto(); EnterpriseAccountDto epAccountDto = new EnterpriseAccountDto();
CommonUtils.copyProperties(enterpriseAccount, epAccountDto); CommonUtils.copyProperties(enterpriseAccount, epAccountDto);
epAccountDto.setParentName(""); epAccountDto.setParentName("");
...@@ -1547,24 +1561,25 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1547,24 +1561,25 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Sets the parent is not leaf. * Sets the parent is not leaf.
*
* @param parentCode - The parent code * @param parentCode - The parent code
* @param enterpriseAccountSetId - The enterprise account set identifier * @param enterpriseAccountSetId - The enterprise account set identifier
*/ */
private void setParentIsNotLeaf(String parentCode, String enterpriseAccountSetId) { private void setParentIsNotLeaf(String parentCode, String enterpriseAccountSetId) {
// no parent, do nothing // no parent, do nothing
if(parentCode == null || parentCode.isEmpty()) { if (parentCode == null || parentCode.isEmpty()) {
return; return;
} }
EnterpriseAccountExample example = new EnterpriseAccountExample(); EnterpriseAccountExample example = new EnterpriseAccountExample();
example.createCriteria().andCodeEqualTo(parentCode).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId); example.createCriteria().andCodeEqualTo(parentCode).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId);
List<EnterpriseAccount> parentNodes = enterpriseAccountMapper.selectByExample(example); List<EnterpriseAccount> parentNodes = enterpriseAccountMapper.selectByExample(example);
if(parentNodes==null || parentNodes.isEmpty()) { if (parentNodes == null || parentNodes.isEmpty()) {
return; return;
} }
EnterpriseAccount parentNode = parentNodes.get(0); EnterpriseAccount parentNode = parentNodes.get(0);
if(parentNode!=null && parentNode.getIsLeaf().equals(CommonConstants.IsLeaf)) { if (parentNode != null && parentNode.getIsLeaf().equals(CommonConstants.IsLeaf)) {
//save enterpriseAccount //save enterpriseAccount
EnterpriseAccount parentNodeOriginal = new EnterpriseAccount(); EnterpriseAccount parentNodeOriginal = new EnterpriseAccount();
CommonUtils.copyProperties(parentNode, parentNodeOriginal); CommonUtils.copyProperties(parentNode, parentNodeOriginal);
...@@ -1587,18 +1602,19 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1587,18 +1602,19 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Sets the parent leaf. * Sets the parent leaf.
*
* @param parentCode - The parentcode * @param parentCode - The parentcode
* @param enterpriseAccountSetId * @param enterpriseAccountSetId
* @param currentEpAccountId - Current enterprise account id * @param currentEpAccountId - Current enterprise account id
*/ */
private void setParentLeaf(String parentCode, String enterpriseAccountSetId, String currentEpAccountId) { private void setParentLeaf(String parentCode, String enterpriseAccountSetId, String currentEpAccountId) {
// no parent, do nothing // no parent, do nothing
if(parentCode == null || parentCode.isEmpty()) { if (parentCode == null || parentCode.isEmpty()) {
return; return;
} }
EnterpriseAccount parentNodeEntity = getEnterpriseAccount(parentCode, enterpriseAccountSetId); EnterpriseAccount parentNodeEntity = getEnterpriseAccount(parentCode, enterpriseAccountSetId);
if(parentNodeEntity == null) { if (parentNodeEntity == null) {
return; return;
} }
...@@ -1613,7 +1629,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1613,7 +1629,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.andIdNotEqualTo(currentEpAccountId) .andIdNotEqualTo(currentEpAccountId)
.andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId); .andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId);
List<EnterpriseAccount> childrenAccountsOfparentNode = enterpriseAccountMapper.selectByExample(example); List<EnterpriseAccount> childrenAccountsOfparentNode = enterpriseAccountMapper.selectByExample(example);
if(CollectionUtils.isEmpty(childrenAccountsOfparentNode)) { if (CollectionUtils.isEmpty(childrenAccountsOfparentNode)) {
// no sub node list, set is the leaf node // no sub node list, set is the leaf node
parentNodeEntity.setIsLeaf(CommonConstants.IsLeaf); parentNodeEntity.setIsLeaf(CommonConstants.IsLeaf);
enterpriseAccountMapper.updateByPrimaryKey(parentNodeEntity); enterpriseAccountMapper.updateByPrimaryKey(parentNodeEntity);
...@@ -1635,6 +1651,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1635,6 +1651,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* 通过Parent企业科目对象获取该ParentCode下面的所有子企业科目 * 通过Parent企业科目对象获取该ParentCode下面的所有子企业科目
*
* @param parentCode - Parent企业科目代码 * @param parentCode - Parent企业科目代码
* @param accountSetId - 企业账套Id * @param accountSetId - 企业账套Id
* @param industryId - 行业Id * @param industryId - 行业Id
...@@ -1645,31 +1662,25 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1645,31 +1662,25 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
return customAccountMapper.getMappingResult(accountSetId, industryId, orgId, parentCode); return customAccountMapper.getMappingResult(accountSetId, industryId, orgId, parentCode);
} }
private void addMapParentAccountResult(String key, List<String> value) private void addMapParentAccountResult(String key, List<String> value) {
{ if (!mapParentAccountResult.containsKey(key)) {
if (!mapParentAccountResult.containsKey(key))
{
this.mapParentAccountResult.put(key, value); this.mapParentAccountResult.put(key, value);
} }
} }
private String getConvertedIndustryId(String industryId) private String getConvertedIndustryId(String industryId) {
{ if (industryId != null && industryId.equals(IndustryConstant.RealEstateId)) {
if (industryId != null && industryId.equals(IndustryConstant.RealEstateId))
{
return industryId; return industryId;
} }
return IndustryConstant.GeneralIndustryId; return IndustryConstant.GeneralIndustryId;
} }
private String getEnterpriseAccountInfo(EnterpriseAccount enterpriseAccount) private String getEnterpriseAccountInfo(EnterpriseAccount enterpriseAccount) {
{
String str = ""; String str = "";
if (enterpriseAccount.getAcctProp()!=null && enterpriseAccount.getAcctProp() < EnterpriseAccountConstant.acctPropLogList.size()) { if (enterpriseAccount.getAcctProp() != null && enterpriseAccount.getAcctProp() < EnterpriseAccountConstant.acctPropLogList.size()) {
if (enterpriseAccount.getAcctProp() <= -1) { if (enterpriseAccount.getAcctProp() <= -1) {
str = EnterpriseAccountConstant.acctPropLogList.get(0); str = EnterpriseAccountConstant.acctPropLogList.get(0);
} } else {
else {
str = EnterpriseAccountConstant.acctPropLogList.get(enterpriseAccount.getAcctProp()); str = EnterpriseAccountConstant.acctPropLogList.get(enterpriseAccount.getAcctProp());
} }
} }
...@@ -1681,7 +1692,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1681,7 +1692,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
private void enableEnterpriseAccountSet(String enterpriseAccountSetId) { private void enableEnterpriseAccountSet(String enterpriseAccountSetId) {
EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetId); EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetId);
if(enterpriseAccountSet.getIsActive()) { if (enterpriseAccountSet.getIsActive()) {
return; return;
} }
...@@ -1701,8 +1712,8 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1701,8 +1712,8 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
}); });
List<ValidateInfoDto> validateInfoDtoList = validateEnterpriseAccountList(enterpriseAccountDtoList); List<ValidateInfoDto> validateInfoDtoList = validateEnterpriseAccountList(enterpriseAccountDtoList);
boolean anyValidationErrorExist = validateInfoDtoList.stream().filter(sa -> !CollectionUtils.isEmpty(sa.getInValidateCodeList())).findAny().isPresent(); boolean anyValidationErrorExist = validateInfoDtoList.stream().filter(sa -> !CollectionUtils.isEmpty(sa.getInValidateCodeList())).findAny().isPresent();
if(!anyValidationErrorExist) { if (!anyValidationErrorExist) {
if(!enterpriseAccountSet.getIsActive()) { if (!enterpriseAccountSet.getIsActive()) {
enterpriseAccountSet.setIsActive(CommonConstants.ACTIVE_STATUS); enterpriseAccountSet.setIsActive(CommonConstants.ACTIVE_STATUS);
enterpriseAccountSetMapper.updateByPrimaryKey(enterpriseAccountSet); enterpriseAccountSetMapper.updateByPrimaryKey(enterpriseAccountSet);
} }
...@@ -1727,10 +1738,10 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1727,10 +1738,10 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
EnterpriseAccountConstant.Direction, EnterpriseAccountConstant.Direction,
EnterpriseAccountConstant.AcctProp); EnterpriseAccountConstant.AcctProp);
boolean hasParentCode = true; boolean hasParentCode = true;
for(String header: standardHeader) { for (String header : standardHeader) {
Integer index = headerMap.get(header); Integer index = headerMap.get(header);
if(index == null) { if (index == null) {
if(header.equals(EnterpriseAccountConstant.ParentCode)) { if (header.equals(EnterpriseAccountConstant.ParentCode)) {
hasParentCode = false; hasParentCode = false;
continue; continue;
} }
...@@ -1743,65 +1754,63 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1743,65 +1754,63 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
Collection<Map> mapCollection = fileService.readExcelAndClose(savedInputStream); Collection<Map> mapCollection = fileService.readExcelAndClose(savedInputStream);
//nothing to import //nothing to import
if(mapCollection==null || CollectionUtils.isEmpty(mapCollection)) { if (mapCollection == null || CollectionUtils.isEmpty(mapCollection)) {
return new OperationResultDto<>(true); return new OperationResultDto<>(true);
} }
//validate data //validate data
List<EnterpriseAccountDto> importData = new ArrayList<>(); List<EnterpriseAccountDto> importData = new ArrayList<>();
for (Map map: mapCollection) { for (Map map : mapCollection) {
EnterpriseAccountDto enterpriseAccountDto = new EnterpriseAccountDto(); EnterpriseAccountDto enterpriseAccountDto = new EnterpriseAccountDto();
//direction //direction
String direction = map.get(EnterpriseAccountConstant.Direction)==null ? null: map.get(EnterpriseAccountConstant.Direction).toString(); String direction = map.get(EnterpriseAccountConstant.Direction) == null ? null : map.get(EnterpriseAccountConstant.Direction).toString();
if (direction == null || direction.trim().isEmpty()) { if (direction == null || direction.trim().isEmpty()) {
direction = CommonConstants.DebitDirection; direction = CommonConstants.DebitDirection;
} }
try { try {
enterpriseAccountDto.setDirection(Integer.valueOf(direction)); enterpriseAccountDto.setDirection(Integer.valueOf(direction));
} } catch (NumberFormatException e) {
catch (NumberFormatException e) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.DirectionFormatError); return new OperationResultDto<>(false, EnterpriseAccountMessage.DirectionFormatError);
} }
//accprop //accprop
String acctProp = map.get(EnterpriseAccountConstant.AcctProp)==null ? null:map.get(EnterpriseAccountConstant.AcctProp).toString(); String acctProp = map.get(EnterpriseAccountConstant.AcctProp) == null ? null : map.get(EnterpriseAccountConstant.AcctProp).toString();
if(acctProp == null || acctProp.trim().isEmpty()) { if (acctProp == null || acctProp.trim().isEmpty()) {
acctProp = "-1"; acctProp = "-1";
} }
try { try {
enterpriseAccountDto.setAcctProp(Integer.valueOf(acctProp)); enterpriseAccountDto.setAcctProp(Integer.valueOf(acctProp));
} } catch (NumberFormatException e) {
catch (NumberFormatException e) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.AcctPropFormatError); return new OperationResultDto<>(false, EnterpriseAccountMessage.AcctPropFormatError);
} }
//code //code
String code = map.get(EnterpriseAccountConstant.Code)==null ? null:map.get(EnterpriseAccountConstant.Code).toString(); String code = map.get(EnterpriseAccountConstant.Code) == null ? null : map.get(EnterpriseAccountConstant.Code).toString();
if(code == null || code.trim().isEmpty()) { if (code == null || code.trim().isEmpty()) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.CodeEmpty); return new OperationResultDto<>(false, EnterpriseAccountMessage.CodeEmpty);
} }
if(code.length()>EnterpriseAccountConstant.CodeMaxLength) { if (code.length() > EnterpriseAccountConstant.CodeMaxLength) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.CodeMaxLength); return new OperationResultDto<>(false, EnterpriseAccountMessage.CodeMaxLength);
} }
enterpriseAccountDto.setCode(code); enterpriseAccountDto.setCode(code);
//name //name
String name = map.get(EnterpriseAccountConstant.Name)==null ? null:map.get(EnterpriseAccountConstant.Name).toString(); String name = map.get(EnterpriseAccountConstant.Name) == null ? null : map.get(EnterpriseAccountConstant.Name).toString();
if(name==null || name.trim().isEmpty()) { if (name == null || name.trim().isEmpty()) {
name = ""; name = "";
} }
if(name.length()>EnterpriseAccountConstant.NameMaxLength) { if (name.length() > EnterpriseAccountConstant.NameMaxLength) {
return new OperationResultDto<>(false, EnterpriseAccountMessage.NameMaxLength); return new OperationResultDto<>(false, EnterpriseAccountMessage.NameMaxLength);
} }
enterpriseAccountDto.setName(name); enterpriseAccountDto.setName(name);
//parentCode //parentCode
String parentCode = ""; String parentCode = "";
if(hasParentCode) { if (hasParentCode) {
parentCode = map.get(EnterpriseAccountConstant.ParentCode)==null ? null:map.get(EnterpriseAccountConstant.ParentCode).toString(); parentCode = map.get(EnterpriseAccountConstant.ParentCode) == null ? null : map.get(EnterpriseAccountConstant.ParentCode).toString();
} }
if(enterpriseAccountDto.getCode().equals(parentCode)) { if (enterpriseAccountDto.getCode().equals(parentCode)) {
parentCode = ""; parentCode = "";
} }
enterpriseAccountDto.setParentCode(parentCode); enterpriseAccountDto.setParentCode(parentCode);
...@@ -1816,7 +1825,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1816,7 +1825,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
private OperationResultDto<?> importDataProcess(List<EnterpriseAccountDto> importData, String enterpriseAccountSetId, boolean isImportAppend) { private OperationResultDto<?> importDataProcess(List<EnterpriseAccountDto> importData, String enterpriseAccountSetId, boolean isImportAppend) {
//nothing to import //nothing to import
if(CollectionUtils.isEmpty(importData) && isImportAppend) { if (CollectionUtils.isEmpty(importData) && isImportAppend) {
return OperationResultDto.success(); return OperationResultDto.success();
} }
// transfrom data // transfrom data
...@@ -1824,20 +1833,20 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1824,20 +1833,20 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
//disable EnterpriseAccountSet //disable EnterpriseAccountSet
EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetId); EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetId);
if(enterpriseAccountSet.getIsActive()) { if (enterpriseAccountSet.getIsActive()) {
enterpriseAccountSet.setIsActive(CommonConstants.DEACTIVE_STATUS); enterpriseAccountSet.setIsActive(CommonConstants.DEACTIVE_STATUS);
enterpriseAccountSetMapper.updateByPrimaryKey(enterpriseAccountSet); enterpriseAccountSetMapper.updateByPrimaryKey(enterpriseAccountSet);
} }
//import //import
//如覆盖导入先批量删除 //如覆盖导入先批量删除
if(!isImportAppend) { if (!isImportAppend) {
EnterpriseAccountExample example = new EnterpriseAccountExample(); EnterpriseAccountExample example = new EnterpriseAccountExample();
example.createCriteria().andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId); example.createCriteria().andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetId);
enterpriseAccountMapper.deleteByExample(example); enterpriseAccountMapper.deleteByExample(example);
} }
//导入 //导入
for(EnterpriseAccount importEntity: importEntityList) { for (EnterpriseAccount importEntity : importEntityList) {
enterpriseAccountMapper.insertSelective(importEntity); enterpriseAccountMapper.insertSelective(importEntity);
} }
...@@ -1855,7 +1864,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1855,7 +1864,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
*/ */
private List<EnterpriseAccount> transform(List<EnterpriseAccountDto> importData, String enterpriseAccountSetId) { private List<EnterpriseAccount> transform(List<EnterpriseAccountDto> importData, String enterpriseAccountSetId) {
if(CollectionUtils.isEmpty(importData)) { if (CollectionUtils.isEmpty(importData)) {
return new ArrayList<>(); return new ArrayList<>();
} }
importData.stream().forEach(account -> { importData.stream().forEach(account -> {
...@@ -1871,25 +1880,23 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1871,25 +1880,23 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
//set parent code, //set parent code,
List<String> validateCodeList = importData.stream().map(sa -> sa.getCode()).collect(Collectors.toList()); List<String> validateCodeList = importData.stream().map(sa -> sa.getCode()).collect(Collectors.toList());
for (EnterpriseAccountDto enterpriseAccountDto: importData) { for (EnterpriseAccountDto enterpriseAccountDto : importData) {
if(enterpriseAccountDto.getParentCode()==null || enterpriseAccountDto.getParentCode().isEmpty()) { if (enterpriseAccountDto.getParentCode() == null || enterpriseAccountDto.getParentCode().isEmpty()) {
enterpriseAccountDto.setParentCode(getMatchParentCode(enterpriseAccountDto.getCode(), validateCodeList)); enterpriseAccountDto.setParentCode(getMatchParentCode(enterpriseAccountDto.getCode(), validateCodeList));
} }
} }
//set acct level,is leaf //set acct level,is leaf
List<String> parentCodeList = importData.stream().filter(sa -> sa.getParentCode()!=null && !sa.getParentCode().isEmpty()) List<String> parentCodeList = importData.stream().filter(sa -> sa.getParentCode() != null && !sa.getParentCode().isEmpty())
.map(sa -> sa.getParentCode()).collect(Collectors.toList()); .map(sa -> sa.getParentCode()).collect(Collectors.toList());
for (EnterpriseAccountDto enterpriseAccountDto: importData) { for (EnterpriseAccountDto enterpriseAccountDto : importData) {
setAcctLevel(enterpriseAccountDto, importData); setAcctLevel(enterpriseAccountDto, importData);
if(CollectionUtils.isEmpty(parentCodeList)) { if (CollectionUtils.isEmpty(parentCodeList)) {
enterpriseAccountDto.setIsLeaf(true); enterpriseAccountDto.setIsLeaf(true);
} } else {
else { if (parentCodeList.contains(enterpriseAccountDto.getCode())) {
if(parentCodeList.contains(enterpriseAccountDto.getCode())) {
enterpriseAccountDto.setIsLeaf(false); enterpriseAccountDto.setIsLeaf(false);
} } else {
else {
enterpriseAccountDto.setIsLeaf(true); enterpriseAccountDto.setIsLeaf(true);
} }
} }
...@@ -1910,16 +1917,17 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1910,16 +1917,17 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Get parent Code from existing validated code list * Get parent Code from existing validated code list
*
* @param code * @param code
* @param validateCodeList * @param validateCodeList
* @return parent code * @return parent code
*/ */
private String getMatchParentCode(String code, List<String> validateCodeList) { private String getMatchParentCode(String code, List<String> validateCodeList) {
for(int i = code.length()-1; i>=0; i--) { for (int i = code.length() - 1; i >= 0; i--) {
String temp = code.substring(0, i); String temp = code.substring(0, i);
List<String> matchList = validateCodeList.stream().filter(vCode -> vCode.equals(temp)).collect(Collectors.toList()); List<String> matchList = validateCodeList.stream().filter(vCode -> vCode.equals(temp)).collect(Collectors.toList());
if(matchList!=null && matchList.size()==1) { if (matchList != null && matchList.size() == 1) {
return temp; return temp;
} }
} }
...@@ -1928,12 +1936,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1928,12 +1936,13 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
/** /**
* Sets the acct level. * Sets the acct level.
*
* @param current - The current * @param current - The current
* @param validateList - The validate list * @param validateList - The validate list
*/ */
private void setAcctLevel(EnterpriseAccountDto currentDto, List<EnterpriseAccountDto> validateDtoList) { private void setAcctLevel(EnterpriseAccountDto currentDto, List<EnterpriseAccountDto> validateDtoList) {
if(currentDto.getParentCode()==null || currentDto.getParentCode().isEmpty()) { if (currentDto.getParentCode() == null || currentDto.getParentCode().isEmpty()) {
currentDto.setAcctLevel(1); currentDto.setAcctLevel(1);
currentDto.setFullName(currentDto.getName()); currentDto.setFullName(currentDto.getName());
return; return;
...@@ -1941,24 +1950,22 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -1941,24 +1950,22 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
EnterpriseAccountDto parentDto = null; EnterpriseAccountDto parentDto = null;
Optional<EnterpriseAccountDto> ifparentDtoExist = validateDtoList.stream() Optional<EnterpriseAccountDto> ifparentDtoExist = validateDtoList.stream()
.filter(sa -> sa.getCode().equals(currentDto.getParentCode())).findAny(); .filter(sa -> sa.getCode().equals(currentDto.getParentCode())).findAny();
if(ifparentDtoExist.isPresent()) { if (ifparentDtoExist.isPresent()) {
parentDto = ifparentDtoExist.get(); parentDto = ifparentDtoExist.get();
} }
if(parentDto!=null) { if (parentDto != null) {
if(parentDto.getAcctLevel()==null) { if (parentDto.getAcctLevel() == null) {
setAcctLevel(parentDto, validateDtoList); setAcctLevel(parentDto, validateDtoList);
} }
currentDto.setAcctLevel(parentDto.getAcctLevel()+1); currentDto.setAcctLevel(parentDto.getAcctLevel() + 1);
if(currentDto.getName()!=null && !currentDto.getName().isEmpty() if (currentDto.getName() != null && !currentDto.getName().isEmpty()
&& !currentDto.getName().contains(parentDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator)) { && !currentDto.getName().contains(parentDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator)) {
currentDto.setFullName(parentDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator + currentDto.getName()); currentDto.setFullName(parentDto.getFullName() + EnterpriseAccountConstant.FullNameSeparator + currentDto.getName());
} } else {
else {
currentDto.setFullName(currentDto.getName()); currentDto.setFullName(currentDto.getName());
} }
} } else {
else {
currentDto.setFullName(currentDto.getName()); currentDto.setFullName(currentDto.getName());
} }
} }
......
...@@ -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