Commit 2af32692 authored by neo's avatar neo

[DEL] delete enterprise account set service interface

parent e8d180c5
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 java.util.List;
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;
...@@ -26,159 +17,174 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -26,159 +17,174 @@ 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 pwc.taxtech.atms.common.CommonUtils;
import io.swagger.annotations.ApiOperation; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.dpo.EnterpriseAccountDto; import pwc.taxtech.atms.dpo.EnterpriseAccountDto;
import pwc.taxtech.atms.dpo.EnterpriseAccountSetOrgDto; import pwc.taxtech.atms.dpo.EnterpriseAccountSetOrgDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.epaccount.AccountMapDto; import pwc.taxtech.atms.dto.epaccount.AccountMapDto;
import pwc.taxtech.atms.dto.epaccount.AccountMappingDto; import pwc.taxtech.atms.dto.epaccount.AccountMappingDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountAndValidateInfo; 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.epaccount.EnterpriseAccountUploadDto; import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountUploadDto;
import pwc.taxtech.atms.exception.ApplicationException; import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.constant.EnterpriseAccountConstant;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.EnterpriseAccountService; import pwc.taxtech.atms.service.EnterpriseAccountService;
import pwc.taxtech.atms.service.EnterpriseAccountSetService; import pwc.taxtech.atms.service.impl.EnterpriseAccountSetServiceImpl;
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;
import java.util.List;
@RestController @RestController
@RequestMapping("/api/v1/enterpriseAccountManage") @RequestMapping("/api/v1/enterpriseAccountManage")
public class EnterpriseAccountManagerController { public class EnterpriseAccountManagerController {
private static final Logger logger = LoggerFactory.getLogger(EnterpriseAccountManagerController.class); private static final Logger logger = LoggerFactory.getLogger(EnterpriseAccountManagerController.class);
@Autowired private EnterpriseAccountSetService enterpriseAccountSetService; @Autowired
@Autowired private EnterpriseAccountService enterpriseAccountService; private EnterpriseAccountSetServiceImpl enterpriseAccountSetService;
@Autowired private FileService fileService; @Autowired
private EnterpriseAccountService enterpriseAccountService;
@ApiOperation(value = "Get the enterprise account set list") @Autowired
@RequestMapping(value = { "/getEnterpriseAccountSetList" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) private FileService fileService;
public @ResponseBody List<EnterpriseAccountSetDto> getEnterpriseAccountSetList() {
return enterpriseAccountSetService.getEnterpriseAccountSetList(); @ApiOperation(value = "Get the enterprise account set list")
@RequestMapping(value = {"/getEnterpriseAccountSetList"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<EnterpriseAccountSetDto> getEnterpriseAccountSetList() {
return enterpriseAccountSetService.getEnterpriseAccountSetList();
} }
@ApiOperation(value = "Gets the enterprise account set") @ApiOperation(value = "Gets the enterprise account set")
@RequestMapping(value = { "/getEnterpriseAccountSet" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/getEnterpriseAccountSet"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody EnterpriseAccountSetDto getEnterpriseAccountSet(@RequestParam String id) { public @ResponseBody
EnterpriseAccountSetDto getEnterpriseAccountSet(@RequestParam String id) {
return enterpriseAccountSetService.getEnterpriseAccountSet(id); return enterpriseAccountSetService.getEnterpriseAccountSet(id);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Updates the enterprise account set") @ApiOperation(value = "Updates the enterprise account set")
@RequestMapping(value = { "/updateEnterpriseAccountSet" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/updateEnterpriseAccountSet"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto updateEnterpriseAccountSet(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) { public @ResponseBody
OperationResultDto updateEnterpriseAccountSet(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) {
return enterpriseAccountSetService.updateEnterpriseAccountSet(enterpriseAccountSetDto); return enterpriseAccountSetService.updateEnterpriseAccountSet(enterpriseAccountSetDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Enterprises the account set name validate") @ApiOperation(value = "Enterprises the account set name validate")
@RequestMapping(value = { "/enterpriseAccountSetNameValidate" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/enterpriseAccountSetNameValidate"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto enterpriseAccountSetNameValidate(@RequestParam String id, @RequestParam String name) { public @ResponseBody
OperationResultDto enterpriseAccountSetNameValidate(@RequestParam String id, @RequestParam String name) {
EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto(); EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto();
enterpriseAccountSetDto.setId(id); enterpriseAccountSetDto.setId(id);
enterpriseAccountSetDto.setName(name); enterpriseAccountSetDto.setName(name);
return enterpriseAccountSetService.enterpriseAccountSetNameValidate(enterpriseAccountSetDto); return enterpriseAccountSetService.enterpriseAccountSetNameValidate(enterpriseAccountSetDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Enterprises the account set code validate") @ApiOperation(value = "Enterprises the account set code validate")
@RequestMapping(value = { "/enterpriseAccountSetCodeValidate" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/enterpriseAccountSetCodeValidate"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto enterpriseAccountSetCodeValidate(@RequestParam String id, @RequestParam String code) { public @ResponseBody
OperationResultDto enterpriseAccountSetCodeValidate(@RequestParam String id, @RequestParam String code) {
EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto(); EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto();
enterpriseAccountSetDto.setId(id); enterpriseAccountSetDto.setId(id);
enterpriseAccountSetDto.setCode(code); enterpriseAccountSetDto.setCode(code);
return enterpriseAccountSetService.enterpriseAccountSetCodeValidate(enterpriseAccountSetDto); return enterpriseAccountSetService.enterpriseAccountSetCodeValidate(enterpriseAccountSetDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Enterprises the account set org validate") @ApiOperation(value = "Enterprises the account set org validate")
@RequestMapping(value = { "/enterpriseAccountSetOrgValidate" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/enterpriseAccountSetOrgValidate"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto enterpriseAccountSetOrgValidate(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) { public @ResponseBody
return enterpriseAccountSetService.enterpriseAccountSetOrgValidate(enterpriseAccountSetDto); OperationResultDto enterpriseAccountSetOrgValidate(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) {
return enterpriseAccountSetService.enterpriseAccountSetOrgValidate(enterpriseAccountSetDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Add the oganization link to an enterprises account set") @ApiOperation(value = "Add the oganization link to an enterprises account set")
@RequestMapping(value = { "/addEnterpriseAccountSetOrg" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/addEnterpriseAccountSetOrg"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto addEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) { public @ResponseBody
OperationResultDto addEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) {
return enterpriseAccountSetService.addEnterpriseAccountSetOrg(enterpriseAccountSetDto); return enterpriseAccountSetService.addEnterpriseAccountSetOrg(enterpriseAccountSetDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Update the oganization link to an enterprises account set") @ApiOperation(value = "Update the oganization link to an enterprises account set")
@RequestMapping(value = { "/updateEnterpriseAccountSetOrg" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/updateEnterpriseAccountSetOrg"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto updateEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto) { public @ResponseBody
OperationResultDto updateEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto) {
return enterpriseAccountSetService.updateEnterpriseAccountSetOrg(enterpriseAccountSetOrgDto); return enterpriseAccountSetService.updateEnterpriseAccountSetOrg(enterpriseAccountSetOrgDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Delete the oganization link to an enterprises account set") @ApiOperation(value = "Delete the oganization link to an enterprises account set")
@RequestMapping(value = { "/deleteEnterpriseAccountSetOrg" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/deleteEnterpriseAccountSetOrg"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto deleteEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) { public @ResponseBody
OperationResultDto deleteEnterpriseAccountSetOrg(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) {
return enterpriseAccountSetService.deleteEnterpriseAccountSetOrg(enterpriseAccountSetDto); return enterpriseAccountSetService.deleteEnterpriseAccountSetOrg(enterpriseAccountSetDto);
} }
@ApiOperation(value = "Download Enterprise account template") @ApiOperation(value = "Download Enterprise account template")
@RequestMapping(value = { "/downEntepriseAccountTemplate" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/downEntepriseAccountTemplate"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public void downEntepriseAccountTemplate(HttpServletResponse response) { public void downEntepriseAccountTemplate(HttpServletResponse response) {
String filePath; String filePath;
File templateFile = null; File templateFile = null;
InputStream inputStream = null; InputStream inputStream = null;
try { try {
filePath = EnterpriseAccountManagerController.class.getClassLoader().getResource("").toURI().getPath(); filePath = EnterpriseAccountManagerController.class.getClassLoader().getResource("").toURI().getPath();
templateFile = new File(filePath + EnterpriseAccountConstant.EnterpriseAccountTemplate); templateFile = new File(filePath + EnterpriseAccountConstant.EnterpriseAccountTemplate);
inputStream = new BufferedInputStream(new FileInputStream(templateFile)); inputStream = new BufferedInputStream(new FileInputStream(templateFile));
String customFileName = EnterpriseAccountConstant.EntepriseAccountFileName + DateTime.now().toString("yyyyMMddHHmmss") + ".xlsx";//客户端保存的文件名 String customFileName = EnterpriseAccountConstant.EntepriseAccountFileName + 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 " + EnterpriseAccountConstant.EnterpriseAccountTemplate);
logger.error("Template file not found. Template file should be located at " + EnterpriseAccountConstant.EnterpriseAccountTemplate); throw new ApplicationException("Tempate file not found.");
throw new ApplicationException("Tempate file not found."); } catch (Exception e) {
} logger.error("Error downloading template file " + EnterpriseAccountConstant.EntepriseAccountFileName + ".xlsx", e);
catch (Exception e) { throw new ApplicationException("Error downloading template file " + EnterpriseAccountConstant.EntepriseAccountFileName + ".xlsx", e);
logger.error("Error downloading template file " + EnterpriseAccountConstant.EntepriseAccountFileName + ".xlsx", e); } finally {
throw new ApplicationException("Error downloading template file " + EnterpriseAccountConstant.EntepriseAccountFileName + ".xlsx", e); try {
} templateFile = null;
finally { if (inputStream != null) {
try { inputStream.close();
templateFile = null; }
if (inputStream!=null) { } catch (Exception e) {
inputStream.close(); logger.error("Error closing inputstream. ", e);
} } finally {
} inputStream = null;
catch (Exception e) { }
logger.error("Error closing inputstream. ",e); }
}
finally {
inputStream = null;
}
}
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "Upload and save enterprise accounts.") @ApiOperation(value = "Upload and save enterprise accounts.")
@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 OperationResultDto uploadEnterpriseAccount(@ModelAttribute EnterpriseAccountUploadDto uploadForm, public @ResponseBody
@RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) { OperationResultDto uploadEnterpriseAccount(@ModelAttribute EnterpriseAccountUploadDto uploadForm,
@RequestParam(value = "file", required = false) CommonsMultipartFile inputFile) {
if (inputFile == null || inputFile.getSize() <= 0) {
return new OperationResultDto<>(false, ErrorMessage.NoFile); if (inputFile == null || inputFile.getSize() <= 0) {
} return new OperationResultDto<>(false, ErrorMessage.NoFile);
}
logger.debug("file name: " + inputFile.getOriginalFilename());
logger.debug("file name: " + inputFile.getOriginalFilename());
InputStream inputStream = null; InputStream inputStream = null;
try { try {
inputStream = inputFile.getInputStream(); inputStream = inputFile.getInputStream();
} catch (IOException e) { } catch (IOException e) {
throw Lang.wrapThrow(e); throw Lang.wrapThrow(e);
} }
//save file //save file
String filePath = FileUtils.getTempDirectory().getAbsolutePath() + File.separator + "EnterpriseAccount" + File.separator String filePath = FileUtils.getTempDirectory().getAbsolutePath() + File.separator + "EnterpriseAccount" + File.separator
+ CommonUtils.getUUID() + "_" + inputFile.getOriginalFilename(); + CommonUtils.getUUID() + "_" + inputFile.getOriginalFilename();
...@@ -187,87 +193,92 @@ public class EnterpriseAccountManagerController { ...@@ -187,87 +193,92 @@ public class EnterpriseAccountManagerController {
if (saveResult.getResult() != null && !saveResult.getResult()) { if (saveResult.getResult() != null && !saveResult.getResult()) {
return saveResult; return saveResult;
} }
//validate file //validate file
OperationResultDto<List<EnterpriseAccountDto>> validateResult = enterpriseAccountService.validateImportEnterpriseAccount(filePath); OperationResultDto<List<EnterpriseAccountDto>> validateResult = enterpriseAccountService.validateImportEnterpriseAccount(filePath);
if(!validateResult.getResult()) { if (!validateResult.getResult()) {
return validateResult; return validateResult;
} }
//import //import
String enterpriseAccountSetId = uploadForm.getEnterpriseAccountSetId(); String enterpriseAccountSetId = uploadForm.getEnterpriseAccountSetId();
//创建新账套 //创建新账套
if(enterpriseAccountSetId == null || enterpriseAccountSetId.isEmpty()) { if (enterpriseAccountSetId == null || enterpriseAccountSetId.isEmpty()) {
logger.debug("Uploading and save enterprise account set. " logger.debug("Uploading and save enterprise account set. "
+ "[name=" + uploadForm.getName()+", code=" + uploadForm.getCode() + "[name=" + uploadForm.getName() + ", code=" + uploadForm.getCode()
+ ", selectedOrgList=" + uploadForm.getSelectedOrgList() + ", isImportAppend=" + uploadForm.getIsImportAppend() + ".]"); + ", selectedOrgList=" + uploadForm.getSelectedOrgList() + ", isImportAppend=" + uploadForm.getIsImportAppend() + ".]");
enterpriseAccountService.addEnterpriseAccountSetAndImportData(uploadForm.getName(), uploadForm.getCode(), validateResult.getData()); enterpriseAccountService.addEnterpriseAccountSetAndImportData(uploadForm.getName(), uploadForm.getCode(), validateResult.getData());
} }
//仅仅上传科目 //仅仅上传科目
else { else {
logger.debug("Uploading enterprise account. " logger.debug("Uploading enterprise account. "
+ "[accountset id=" + uploadForm.getEnterpriseAccountSetId() + ", name=" + uploadForm.getName()+", code=" + uploadForm.getCode() + "[accountset id=" + uploadForm.getEnterpriseAccountSetId() + ", name=" + uploadForm.getName() + ", code=" + uploadForm.getCode()
+ ", selectedOrgList=" + uploadForm.getSelectedOrgList() + ", isImportAppend=" + uploadForm.getIsImportAppend() + ".]"); + ", selectedOrgList=" + uploadForm.getSelectedOrgList() + ", isImportAppend=" + uploadForm.getIsImportAppend() + ".]");
EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto(); EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto();
enterpriseAccountSetDto.setId(uploadForm.getEnterpriseAccountSetId()); enterpriseAccountSetDto.setId(uploadForm.getEnterpriseAccountSetId());
enterpriseAccountSetDto.setName(uploadForm.getName()); enterpriseAccountSetDto.setName(uploadForm.getName());
enterpriseAccountSetDto.setIsImportAppend(Boolean.valueOf(uploadForm.getIsImportAppend())); enterpriseAccountSetDto.setIsImportAppend(Boolean.valueOf(uploadForm.getIsImportAppend()));
enterpriseAccountService.repeatImportEnterpriseAccountSet(enterpriseAccountSetDto, validateResult.getData()); enterpriseAccountService.repeatImportEnterpriseAccountSet(enterpriseAccountSetDto, validateResult.getData());
} }
return OperationResultDto.success(); return OperationResultDto.success();
} }
@ApiOperation(value = "Gets the list by enterprise account set identifier.") @ApiOperation(value = "Gets the list by enterprise account set identifier.")
@RequestMapping(value = { "/getListByEnterpriseAccountSetID" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/getListByEnterpriseAccountSetID"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody public @ResponseBody
EnterpriseAccountAndValidateInfo getListByEnterpriseAccountSetId(@RequestParam String enterpriseAccountSetID) { EnterpriseAccountAndValidateInfo getListByEnterpriseAccountSetId(@RequestParam String enterpriseAccountSetID) {
return enterpriseAccountService.getListByEnterpriseAccountSetId(enterpriseAccountSetID); return enterpriseAccountService.getListByEnterpriseAccountSetId(enterpriseAccountSetID);
} }
@ApiOperation(value = "Gets the specified enterprise account by identifier") @ApiOperation(value = "Gets the specified enterprise account by identifier")
@RequestMapping(value = { "/getsingle" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/getsingle"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody EnterpriseAccountDto getEnterpriseAccount(@RequestParam String id) { public @ResponseBody
EnterpriseAccountDto getEnterpriseAccount(@RequestParam String id) {
return enterpriseAccountService.getEnterpriseAccount(id); return enterpriseAccountService.getEnterpriseAccount(id);
} }
@ApiOperation(value = "Add an enterprise account") @ApiOperation(value = "Add an enterprise account")
@RequestMapping(value = { "/add" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/add"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto<List<EnterpriseAccountDto>> addEnterpriseAccount(@RequestBody EnterpriseAccountDto enterpriseAccountDto) { public @ResponseBody
OperationResultDto<List<EnterpriseAccountDto>> addEnterpriseAccount(@RequestBody EnterpriseAccountDto enterpriseAccountDto) {
return enterpriseAccountService.addEnterpriseAccount(enterpriseAccountDto); return enterpriseAccountService.addEnterpriseAccount(enterpriseAccountDto);
} }
@ApiOperation(value = "Update an enterprise account") @ApiOperation(value = "Update an enterprise account")
@RequestMapping(value = { "/update" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/update"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto<List<EnterpriseAccountDto>> updateEnterpriseAccount(@RequestBody EnterpriseAccountDto enterpriseAccountDto) { public @ResponseBody
OperationResultDto<List<EnterpriseAccountDto>> updateEnterpriseAccount(@RequestBody EnterpriseAccountDto enterpriseAccountDto) {
return enterpriseAccountService.updateEnterpriseAccount(enterpriseAccountDto); return enterpriseAccountService.updateEnterpriseAccount(enterpriseAccountDto);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ApiOperation(value = "一键删除重复企业科目") @ApiOperation(value = "一键删除重复企业科目")
@RequestMapping(value = { "/clearRepeatEnterpriseAccountList" }, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = {"/clearRepeatEnterpriseAccountList"}, method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody OperationResultDto clearRepeatEnterpriseAccountList(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) { public @ResponseBody
return enterpriseAccountService.clearRepeatEnterpriseAccountList(enterpriseAccountSetDto); OperationResultDto clearRepeatEnterpriseAccountList(@RequestBody EnterpriseAccountSetDto enterpriseAccountSetDto) {
} return enterpriseAccountService.clearRepeatEnterpriseAccountList(enterpriseAccountSetDto);
}
@ApiOperation(value = "获取企业账套Mapping")
@RequestMapping(value = { "/getAccountMappingOrg" }, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @ApiOperation(value = "获取企业账套Mapping")
public @ResponseBody List<AccountMappingDto> getAccountMappingOrg(@RequestParam(name="organizationID") String organizationId) { @RequestMapping(value = {"/getAccountMappingOrg"}, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<AccountMappingDto> getAccountMappingOrg(@RequestParam(name = "organizationID") String organizationId) {
return enterpriseAccountService.getAccountMappingOrg(organizationId); return enterpriseAccountService.getAccountMappingOrg(organizationId);
} }
@ResponseBody @ResponseBody
@ApiOperation(value = "按组织机构查找") @ApiOperation(value = "按组织机构查找")
@RequestMapping(value = "getEnterpriseAccountSetListByOrgID", method = RequestMethod.GET) @RequestMapping(value = "getEnterpriseAccountSetListByOrgID", method = RequestMethod.GET)
public List<EnterpriseAccountSetDto> getEnterpriseAccountSetListByOrgId(@RequestParam(name="orgID") String orgId) { public List<EnterpriseAccountSetDto> getEnterpriseAccountSetListByOrgId(@RequestParam(name = "orgID") String orgId) {
return enterpriseAccountService.getEnterpriseAccountSetListByOrgId(orgId); return enterpriseAccountService.getEnterpriseAccountSetListByOrgId(orgId);
} }
@ResponseBody @ResponseBody
@ApiOperation(value = "科目对应列表") @ApiOperation(value = "科目对应列表")
@RequestMapping(value = "getEnterpriseAccountList", method = RequestMethod.GET) @RequestMapping(value = "getEnterpriseAccountList", method = RequestMethod.GET)
public List<EnterpriseAccountDto> getEnterpriseAccountList(@RequestParam(name="espID") String espId, public List<EnterpriseAccountDto> getEnterpriseAccountList(@RequestParam(name = "espID") String espId,
@RequestParam(name="orgID") String orgId, @RequestParam(name = "orgID") String orgId,
@RequestParam String filterType) { @RequestParam String filterType) {
return enterpriseAccountService.getList(espId, orgId, filterType); return enterpriseAccountService.getList(espId, orgId, filterType);
} }
......
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.dpo.EnterpriseAccountSetOrgDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto;
public interface EnterpriseAccountSetService {
/**
* 获取所有的账套
* @return List<EnterpriseAccountSetDto>
*/
List<EnterpriseAccountSetDto> getEnterpriseAccountSetList();
/**
* Gets the enterprise account set detail, including organizations using this account set
* @param enterpriseAccountSetId - The identifier
* @return
*/
EnterpriseAccountSetDto getEnterpriseAccountSet(String enterpriseAccountSetId);
/**
* Updates the enterprise account set.
*
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto updateEnterpriseAccountSet(EnterpriseAccountSetDto enterpriseAccountSetDto);
/**
* Validate EnterpriseAccountSet name, check if it is duplicated
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto enterpriseAccountSetNameValidate(EnterpriseAccountSetDto enterpriseAccountSetDto);
/**
* Validate EnterpriseAccountSet code, check if it is duplicated
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto enterpriseAccountSetCodeValidate(EnterpriseAccountSetDto enterpriseAccountSetDto);
/**
* Enterprises the account set org validate.
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto enterpriseAccountSetOrgValidate(EnterpriseAccountSetDto enterpriseAccountSetDto);
/**
* 添加关联机构
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto addEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto);
/**
* 更新关联机构
* @param enterpriseAccountSetOrgDto
* @return
*/
@SuppressWarnings("rawtypes")
OperationResultDto updateEnterpriseAccountSetOrg(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto);
/**
* Delete organiztion link with one enterpriseAccountSet
* @param enterpriseAccountSetDto
* @return OperationResultDto
*/
@SuppressWarnings("rawtypes")
OperationResultDto deleteEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto);
}
...@@ -42,7 +42,6 @@ import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetDto; ...@@ -42,7 +42,6 @@ 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.EnterpriseAccountService; import pwc.taxtech.atms.service.EnterpriseAccountService;
import pwc.taxtech.atms.service.EnterpriseAccountSetService;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
...@@ -54,7 +53,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent ...@@ -54,7 +53,7 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
@Autowired @Autowired
private AccountServiceImpl accountService; private AccountServiceImpl accountService;
@Autowired @Autowired
private EnterpriseAccountSetService enterpriseAccountSetService; private EnterpriseAccountSetServiceImpl enterpriseAccountSetService;
@Autowired @Autowired
private FileService fileService; private FileService fileService;
@Autowired @Autowired
......
...@@ -25,7 +25,6 @@ import pwc.taxtech.atms.entity.EnterpriseAccountSetOrg; ...@@ -25,7 +25,6 @@ import pwc.taxtech.atms.entity.EnterpriseAccountSetOrg;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample; import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample.Criteria; import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample.Criteria;
import pwc.taxtech.atms.entity.Organization; import pwc.taxtech.atms.entity.Organization;
import pwc.taxtech.atms.service.EnterpriseAccountSetService;
import pwc.taxtech.atms.service.OperationLogService; import pwc.taxtech.atms.service.OperationLogService;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -34,24 +33,28 @@ import java.util.Map; ...@@ -34,24 +33,28 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetService { public class EnterpriseAccountSetServiceImpl {
@Autowired
private EnterpriseAccountSetMapper enterpriseAccountSetMapper;
@Autowired
private EnterpriseAccountSetOrgMapper enterpriseAccountSetOrgMapper;
@Autowired
private OrganizationMapper organizationMapper;
@Autowired
private OperationLogService operationLogService;
@Autowired
private AuthUserHelper authUserHelper;
@Autowired private EnterpriseAccountSetMapper enterpriseAccountSetMapper;
@Autowired private EnterpriseAccountSetOrgMapper enterpriseAccountSetOrgMapper;
@Autowired private OrganizationMapper organizationMapper;
@Autowired private OperationLogService operationLogService;
@Autowired private AuthUserHelper authUserHelper;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see pwc.taxtech.atms.service.EnterpriseAccountSetService# * @see pwc.taxtech.atms.service.EnterpriseAccountSetService#
* getEnterpriseAccountSetList() * getEnterpriseAccountSetList()
*/ */
@Override
public List<EnterpriseAccountSetDto> getEnterpriseAccountSetList() { public List<EnterpriseAccountSetDto> getEnterpriseAccountSetList() {
EnterpriseAccountSetExample example = new EnterpriseAccountSetExample(); EnterpriseAccountSetExample example = new EnterpriseAccountSetExample();
...@@ -62,12 +65,11 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -62,12 +65,11 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* pwc.taxtech.atms.service.EnterpriseAccountService#GetEnterpriseAccountSet( * pwc.taxtech.atms.service.EnterpriseAccountService#GetEnterpriseAccountSet(
* java.lang.String) * java.lang.String)
*/ */
@Override
public EnterpriseAccountSetDto getEnterpriseAccountSet(String enterpriseAccountSetId) { public EnterpriseAccountSetDto getEnterpriseAccountSet(String enterpriseAccountSetId) {
EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper
.selectByPrimaryKey(enterpriseAccountSetId); .selectByPrimaryKey(enterpriseAccountSetId);
...@@ -92,9 +94,9 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -92,9 +94,9 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto = new EnterpriseAccountSetOrgDto(); EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto = new EnterpriseAccountSetOrgDto();
CommonUtils.copyProperties(entity, enterpriseAccountSetOrgDto); CommonUtils.copyProperties(entity, enterpriseAccountSetOrgDto);
enterpriseAccountSetOrgDto.setEffectiveDateStr( enterpriseAccountSetOrgDto.setEffectiveDateStr(
enterpriseAccountSetOrgDto.getEffectiveDate()==null ? "":new DateTime(entity.getEffectiveDate()).toString("yyyy-MM")); enterpriseAccountSetOrgDto.getEffectiveDate() == null ? "" : new DateTime(entity.getEffectiveDate()).toString("yyyy-MM"));
enterpriseAccountSetOrgDto.setExpiredDateStr( enterpriseAccountSetOrgDto.setExpiredDateStr(
enterpriseAccountSetOrgDto.getExpiredDate()==null ? "":new DateTime(entity.getExpiredDate()).toString("yyyy-MM")); enterpriseAccountSetOrgDto.getExpiredDate() == null ? "" : new DateTime(entity.getExpiredDate()).toString("yyyy-MM"));
enterpriseAccountSetOrgDto.setEnterpriseAccountSetName(""); enterpriseAccountSetOrgDto.setEnterpriseAccountSetName("");
enterpriseAccountSetOrgDto.setOrganizationName( enterpriseAccountSetOrgDto.setOrganizationName(
entity.getOrganization() == null ? "" : entity.getOrganization().getName()); entity.getOrganization() == null ? "" : entity.getOrganization().getName());
...@@ -107,48 +109,46 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -107,48 +109,46 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
return enterpriseAccountSetDto; return enterpriseAccountSetDto;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#updateEnterpriseAccountSet(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#updateEnterpriseAccountSet(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
@Transactional @Transactional
public OperationResultDto<?> updateEnterpriseAccountSet(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> updateEnterpriseAccountSet(EnterpriseAccountSetDto enterpriseAccountSetDto) {
EnterpriseAccountSet entity = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetDto.getId()); EnterpriseAccountSet entity = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetDto.getId());
EnterpriseAccountSet updateToEntity = new EnterpriseAccountSet(); EnterpriseAccountSet updateToEntity = new EnterpriseAccountSet();
CommonUtils.copyProperties(entity, updateToEntity); CommonUtils.copyProperties(entity, updateToEntity);
boolean isChangeEnterpriseAccountSetName = false; boolean isChangeEnterpriseAccountSetName = false;
boolean isChangeEnterpriseAccountSetCode = false; boolean isChangeEnterpriseAccountSetCode = false;
//name change //name change
if(!entity.getName().equals(enterpriseAccountSetDto.getName())) { if (!entity.getName().equals(enterpriseAccountSetDto.getName())) {
OperationResultDto<?> validate = enterpriseAccountSetNameValidate(enterpriseAccountSetDto); OperationResultDto<?> validate = enterpriseAccountSetNameValidate(enterpriseAccountSetDto);
if(!validate.getResult()) { if (!validate.getResult()) {
return validate; return validate;
} }
updateToEntity.setName(enterpriseAccountSetDto.getName()); updateToEntity.setName(enterpriseAccountSetDto.getName());
isChangeEnterpriseAccountSetName = true; isChangeEnterpriseAccountSetName = true;
} }
//code change //code change
if(!entity.getCode().equals(enterpriseAccountSetDto.getCode())) { if (!entity.getCode().equals(enterpriseAccountSetDto.getCode())) {
OperationResultDto<?> validate = enterpriseAccountSetCodeValidate(enterpriseAccountSetDto); OperationResultDto<?> validate = enterpriseAccountSetCodeValidate(enterpriseAccountSetDto);
if(!validate.getResult()) { if (!validate.getResult()) {
return validate; return validate;
} }
updateToEntity.setCode(enterpriseAccountSetDto.getCode()); updateToEntity.setCode(enterpriseAccountSetDto.getCode());
isChangeEnterpriseAccountSetCode = true; isChangeEnterpriseAccountSetCode = true;
} }
//update DB //update DB
enterpriseAccountSetMapper.updateByPrimaryKeySelective(updateToEntity); enterpriseAccountSetMapper.updateByPrimaryKeySelective(updateToEntity);
//add operation log //add operation log
if(isChangeEnterpriseAccountSetName || isChangeEnterpriseAccountSetCode) { if (isChangeEnterpriseAccountSetName || isChangeEnterpriseAccountSetCode) {
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get()); updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get());
updateLogParams.setUpdateState(updateToEntity); updateLogParams.setUpdateState(updateToEntity);
...@@ -159,90 +159,87 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -159,90 +159,87 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
updateLogParams.setOperateLogType(OperateLogType.OperationLogEnterPrise.value()); updateLogParams.setOperateLogType(OperateLogType.OperationLogEnterPrise.value());
updateLogParams.setOperationAction(OperationAction.UpdateEnterpriseAccountSet.value()); updateLogParams.setOperationAction(OperationAction.UpdateEnterpriseAccountSet.value());
updateLogParams.setOperationObject(entity.getCode()); updateLogParams.setOperationObject(entity.getCode());
operationLogService.updateDataAddLog(updateLogParams); operationLogService.updateDataAddLog(updateLogParams);
} }
return new OperationResultDto<>(true); return new OperationResultDto<>(true);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetNameValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetNameValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
public OperationResultDto<?> enterpriseAccountSetNameValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> enterpriseAccountSetNameValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) {
EnterpriseAccountSetExample example = new EnterpriseAccountSetExample(); EnterpriseAccountSetExample example = new EnterpriseAccountSetExample();
EnterpriseAccountSetExample.Criteria criteria = example.createCriteria(); EnterpriseAccountSetExample.Criteria criteria = example.createCriteria();
if(enterpriseAccountSetDto.getId()!=null) { if (enterpriseAccountSetDto.getId() != null) {
criteria.andIdNotEqualTo(enterpriseAccountSetDto.getId()); criteria.andIdNotEqualTo(enterpriseAccountSetDto.getId());
} }
criteria.andNameEqualTo(enterpriseAccountSetDto.getName()); criteria.andNameEqualTo(enterpriseAccountSetDto.getName());
List<EnterpriseAccountSet> enterpriseAccountSetList = enterpriseAccountSetMapper.selectByExample(example); List<EnterpriseAccountSet> enterpriseAccountSetList = enterpriseAccountSetMapper.selectByExample(example);
if (enterpriseAccountSetList != null && !enterpriseAccountSetList.isEmpty()) { if (enterpriseAccountSetList != null && !enterpriseAccountSetList.isEmpty()) {
return new OperationResultDto<>(false, EnterpriseAccountSetMessage.EnterpriseAccountSetNameRepeat); return new OperationResultDto<>(false, EnterpriseAccountSetMessage.EnterpriseAccountSetNameRepeat);
} }
return new OperationResultDto<>(true); return new OperationResultDto<>(true);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetCodeValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetCodeValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
public OperationResultDto<?> enterpriseAccountSetCodeValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> enterpriseAccountSetCodeValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) {
EnterpriseAccountSetExample example = new EnterpriseAccountSetExample(); EnterpriseAccountSetExample example = new EnterpriseAccountSetExample();
EnterpriseAccountSetExample.Criteria criteria = example.createCriteria(); EnterpriseAccountSetExample.Criteria criteria = example.createCriteria();
if(enterpriseAccountSetDto.getId()!=null) { if (enterpriseAccountSetDto.getId() != null) {
criteria.andIdNotEqualTo(enterpriseAccountSetDto.getId()); criteria.andIdNotEqualTo(enterpriseAccountSetDto.getId());
} }
criteria.andCodeEqualTo(enterpriseAccountSetDto.getCode()); criteria.andCodeEqualTo(enterpriseAccountSetDto.getCode());
List<EnterpriseAccountSet> enterpriseAccountSetList = enterpriseAccountSetMapper.selectByExample(example); List<EnterpriseAccountSet> enterpriseAccountSetList = enterpriseAccountSetMapper.selectByExample(example);
if (enterpriseAccountSetList != null && !enterpriseAccountSetList.isEmpty()) { if (enterpriseAccountSetList != null && !enterpriseAccountSetList.isEmpty()) {
return new OperationResultDto<>(false, EnterpriseAccountSetMessage.EnterpriseAccountSetCodeRepeat); return new OperationResultDto<>(false, EnterpriseAccountSetMessage.EnterpriseAccountSetCodeRepeat);
} }
return new OperationResultDto<>(true); return new OperationResultDto<>(true);
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetOrgValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#enterpriseAccountSetOrgValidate(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
public OperationResultDto<?> enterpriseAccountSetOrgValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> enterpriseAccountSetOrgValidate(EnterpriseAccountSetDto enterpriseAccountSetDto) {
List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList(); List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList();
if (enterpriseAccountSetOrgDtoList == null ) { if (enterpriseAccountSetOrgDtoList == null) {
enterpriseAccountSetOrgDtoList = new ArrayList<>(); enterpriseAccountSetOrgDtoList = new ArrayList<>();
} }
//effective date > expire date //effective date > expire date
if(enterpriseAccountSetOrgDtoList.stream() if (enterpriseAccountSetOrgDtoList.stream()
.anyMatch(sa -> sa.getEffectiveDate()!=null && sa.getExpiredDate()!=null .anyMatch(sa -> sa.getEffectiveDate() != null && sa.getExpiredDate() != null
&& sa.getEffectiveDate().compareTo(sa.getExpiredDate())>0)) { && sa.getEffectiveDate().compareTo(sa.getExpiredDate()) > 0)) {
return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EffectiveDateAreaProblem); return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EffectiveDateAreaProblem);
} }
//set org name //set org name
for(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto: enterpriseAccountSetOrgDtoList) { for (EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto : enterpriseAccountSetOrgDtoList) {
Organization organization = organizationMapper.selectByPrimaryKey(enterpriseAccountSetOrgDto.getOrganizationId()); Organization organization = organizationMapper.selectByPrimaryKey(enterpriseAccountSetOrgDto.getOrganizationId());
if(organization!=null) { if (organization != null) {
enterpriseAccountSetOrgDto.setOrganizationName(organization.getName()); enterpriseAccountSetOrgDto.setOrganizationName(organization.getName());
} }
} }
//validate by each organization //validate by each organization
//Map<organizationId, count> //Map<organizationId, count>
Map<String, Long> countByOrganization = enterpriseAccountSetOrgDtoList.stream() Map<String, Long> countByOrganization = enterpriseAccountSetOrgDtoList.stream()
.collect(Collectors.groupingBy(sa -> sa.getOrganizationId(), Collectors.counting())); .collect(Collectors.groupingBy(sa -> sa.getOrganizationId(), Collectors.counting()));
List<String> enterpriseAccountSetOrgIdInDtoList = new ArrayList<>(); List<String> enterpriseAccountSetOrgIdInDtoList = new ArrayList<>();
enterpriseAccountSetOrgIdInDtoList = enterpriseAccountSetOrgDtoList.stream() enterpriseAccountSetOrgIdInDtoList = enterpriseAccountSetOrgDtoList.stream()
.filter(sa -> sa.getId()!=null) .filter(sa -> sa.getId() != null)
.map(sa -> sa.getId()).collect(Collectors.toList()); .map(sa -> sa.getId()).collect(Collectors.toList());
for (Map.Entry<String, Long> organiztionCount : countByOrganization.entrySet()) { for (Map.Entry<String, Long> organiztionCount : countByOrganization.entrySet()) {
List<EnterpriseAccountSetOrgDto> organiztionAccountSetList = enterpriseAccountSetOrgDtoList.stream() List<EnterpriseAccountSetOrgDto> organiztionAccountSetList = enterpriseAccountSetOrgDtoList.stream()
.filter(sa -> sa.getOrganizationId().equals(organiztionCount.getKey())) .filter(sa -> sa.getOrganizationId().equals(organiztionCount.getKey()))
...@@ -250,70 +247,67 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -250,70 +247,67 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample(); EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
Criteria criteria = example.createCriteria(); Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(organiztionCount.getKey()); criteria.andOrganizationIdEqualTo(organiztionCount.getKey());
if(!enterpriseAccountSetOrgIdInDtoList.isEmpty()) { if (!enterpriseAccountSetOrgIdInDtoList.isEmpty()) {
criteria.andIdNotIn(enterpriseAccountSetOrgIdInDtoList); criteria.andIdNotIn(enterpriseAccountSetOrgIdInDtoList);
} }
List<EnterpriseAccountSetOrg> organiztionAccountSetInDBList = enterpriseAccountSetOrgMapper.selectByExample(example); List<EnterpriseAccountSetOrg> organiztionAccountSetInDBList = enterpriseAccountSetOrgMapper.selectByExample(example);
if(organiztionAccountSetInDBList!=null && !organiztionAccountSetInDBList.isEmpty()) { if (organiztionAccountSetInDBList != null && !organiztionAccountSetInDBList.isEmpty()) {
organiztionAccountSetInDBList.stream().forEach(enterpriseAccountSetOrg -> { organiztionAccountSetInDBList.stream().forEach(enterpriseAccountSetOrg -> {
EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto = new EnterpriseAccountSetOrgDto(); EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto = new EnterpriseAccountSetOrgDto();
CommonUtils.copyProperties(enterpriseAccountSetOrg, enterpriseAccountSetOrgDto); CommonUtils.copyProperties(enterpriseAccountSetOrg, enterpriseAccountSetOrgDto);
enterpriseAccountSetOrgDto.setOverlapList(new ArrayList<>()); enterpriseAccountSetOrgDto.setOverlapList(new ArrayList<>());
organiztionAccountSetList.add(enterpriseAccountSetOrgDto); organiztionAccountSetList.add(enterpriseAccountSetOrgDto);
}); });
} }
//同一个机构下的账套的时间段,是不能重叠的 //同一个机构下的账套的时间段,是不能重叠的
if(CommonUtils.isOrganizationDateTimeOverlap(organiztionAccountSetList)) { if (CommonUtils.isOrganizationDateTimeOverlap(organiztionAccountSetList)) {
List<EnterpriseAccountSetOrgDto> overlapList = organiztionAccountSetList.stream() List<EnterpriseAccountSetOrgDto> overlapList = organiztionAccountSetList.stream()
.filter(sa -> !sa.getOverlapList().isEmpty()).collect(Collectors.toList()); .filter(sa -> !sa.getOverlapList().isEmpty()).collect(Collectors.toList());
return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EnterpriseAccountSetOrgDateTimeOverlap, overlapList); return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EnterpriseAccountSetOrgDateTimeOverlap, overlapList);
} }
// 一年之内不能设置两个一样的账套,即:不能设置这种,账套A,2017年1月到3月,账套A,2017年4月到5月 // 一年之内不能设置两个一样的账套,即:不能设置这种,账套A,2017年1月到3月,账套A,2017年4月到5月
if (!CommonUtils.validateOnlyOncePerYear(organiztionAccountSetList)) { if (!CommonUtils.validateOnlyOncePerYear(organiztionAccountSetList)) {
return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EnterpriseAccountSetOrgOnlyOncePerYear); return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.EnterpriseAccountSetOrgOnlyOncePerYear);
} }
} }
return OperationResultDto.success(); return OperationResultDto.success();
} }
/* /*
* 1、判断传入的数据是否有时间段重叠 * 1、判断传入的数据是否有时间段重叠
2、判断传入的数据与现有数据库中的数据,是否有时间段的重叠 2、判断传入的数据与现有数据库中的数据,是否有时间段的重叠
* (non-Javadoc) * (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#addEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#addEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
@Transactional @Transactional
public OperationResultDto<?> addEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> addEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto) {
List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList(); List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList();
if(enterpriseAccountSetOrgDtoList==null || enterpriseAccountSetOrgDtoList.isEmpty()) { if (enterpriseAccountSetOrgDtoList == null || enterpriseAccountSetOrgDtoList.isEmpty()) {
return OperationResultDto.success(); return OperationResultDto.success();
} }
enterpriseAccountSetOrgDtoList.stream().forEach(sa -> { enterpriseAccountSetOrgDtoList.stream().forEach(sa -> {
if(sa.getEffectiveDateStr()!=null && !"".equals(sa.getEffectiveDateStr())) { if (sa.getEffectiveDateStr() != null && !"".equals(sa.getEffectiveDateStr())) {
sa.setEffectiveDate( sa.setEffectiveDate(
DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(sa.getEffectiveDateStr()+"-01").toDate()); DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(sa.getEffectiveDateStr() + "-01").toDate());
} }
if(sa.getExpiredDateStr()!=null && !"".equals(sa.getExpiredDateStr())) { if (sa.getExpiredDateStr() != null && !"".equals(sa.getExpiredDateStr())) {
sa.setExpiredDate(DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(sa.getExpiredDateStr()+"-01") sa.setExpiredDate(DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(sa.getExpiredDateStr() + "-01")
.plusMonths(1).minusDays(1).toDate()); .plusMonths(1).minusDays(1).toDate());
} }
}); });
OperationResultDto<?> checkResult = enterpriseAccountSetOrgValidate(enterpriseAccountSetDto); OperationResultDto<?> checkResult = enterpriseAccountSetOrgValidate(enterpriseAccountSetDto);
if(!checkResult.getResult()) { if (!checkResult.getResult()) {
return checkResult; return checkResult;
} }
if(!enterpriseAccountSetOrgDtoList.isEmpty()) { if (!enterpriseAccountSetOrgDtoList.isEmpty()) {
for(EnterpriseAccountSetOrgDto setOrgDto: enterpriseAccountSetOrgDtoList) { for (EnterpriseAccountSetOrgDto setOrgDto : enterpriseAccountSetOrgDtoList) {
EnterpriseAccountSetOrg setOrg = new EnterpriseAccountSetOrg(); EnterpriseAccountSetOrg setOrg = new EnterpriseAccountSetOrg();
CommonUtils.copyProperties(setOrgDto, setOrg); CommonUtils.copyProperties(setOrgDto, setOrg);
setOrg.setId(CommonUtils.getUUID()); setOrg.setId(CommonUtils.getUUID());
...@@ -321,10 +315,10 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -321,10 +315,10 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
enterpriseAccountSetOrgMapper.insert(setOrg); enterpriseAccountSetOrgMapper.insert(setOrg);
} }
} }
//operational log //operational log
List<UpdateLogParams> updateLogParamsList = new ArrayList<>(); List<UpdateLogParams> updateLogParamsList = new ArrayList<>();
for(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto : enterpriseAccountSetOrgDtoList) { for (EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto : enterpriseAccountSetOrgDtoList) {
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get()); updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get());
updateLogParams.setUpdateState(""); updateLogParams.setUpdateState("");
...@@ -339,25 +333,23 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -339,25 +333,23 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
updateLogParamsList.add(updateLogParams); updateLogParamsList.add(updateLogParams);
} }
operationLogService.addOrDeleteDataAddLog(updateLogParamsList); operationLogService.addOrDeleteDataAddLog(updateLogParamsList);
return OperationResultDto.success(); return OperationResultDto.success();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#updateEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetOrgDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#updateEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetOrgDto)
*/ */
@Override
@Transactional @Transactional
public OperationResultDto<?> updateEnterpriseAccountSetOrg(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto) { public OperationResultDto<?> updateEnterpriseAccountSetOrg(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto) {
if(enterpriseAccountSetOrgDto.getEffectiveDateStr()!=null && !"".equals(enterpriseAccountSetOrgDto.getEffectiveDateStr())) { if (enterpriseAccountSetOrgDto.getEffectiveDateStr() != null && !"".equals(enterpriseAccountSetOrgDto.getEffectiveDateStr())) {
enterpriseAccountSetOrgDto.setEffectiveDate( enterpriseAccountSetOrgDto.setEffectiveDate(
DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(enterpriseAccountSetOrgDto.getEffectiveDateStr()+"-01").toDate()); DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(enterpriseAccountSetOrgDto.getEffectiveDateStr() + "-01").toDate());
} }
if(enterpriseAccountSetOrgDto.getExpiredDateStr()!=null && !"".equals(enterpriseAccountSetOrgDto.getExpiredDateStr())) { if (enterpriseAccountSetOrgDto.getExpiredDateStr() != null && !"".equals(enterpriseAccountSetOrgDto.getExpiredDateStr())) {
enterpriseAccountSetOrgDto.setExpiredDate(DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(enterpriseAccountSetOrgDto.getExpiredDateStr()+"-01") enterpriseAccountSetOrgDto.setExpiredDate(DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime(enterpriseAccountSetOrgDto.getExpiredDateStr() + "-01")
.plusMonths(1).minusDays(1).toDate()); .plusMonths(1).minusDays(1).toDate());
} }
EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto(); EnterpriseAccountSetDto enterpriseAccountSetDto = new EnterpriseAccountSetDto();
...@@ -365,25 +357,25 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -365,25 +357,25 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
enterpriseAccountSetDto.setName(enterpriseAccountSetOrgDto.getEnterpriseAccountSetName()); enterpriseAccountSetDto.setName(enterpriseAccountSetOrgDto.getEnterpriseAccountSetName());
enterpriseAccountSetDto.setEnterpriseAccountSetOrgList(new ArrayList<>()); enterpriseAccountSetDto.setEnterpriseAccountSetOrgList(new ArrayList<>());
enterpriseAccountSetDto.getEnterpriseAccountSetOrgList().add(enterpriseAccountSetOrgDto); enterpriseAccountSetDto.getEnterpriseAccountSetOrgList().add(enterpriseAccountSetOrgDto);
//validate enterpriseAccountSetOrg //validate enterpriseAccountSetOrg
OperationResultDto<?> checkResult = enterpriseAccountSetOrgValidate(enterpriseAccountSetDto); OperationResultDto<?> checkResult = enterpriseAccountSetOrgValidate(enterpriseAccountSetDto);
if(!checkResult.getResult()) { if (!checkResult.getResult()) {
return checkResult; return checkResult;
} }
EnterpriseAccountSetOrg originalEntity = enterpriseAccountSetOrgMapper.selectByPrimaryKey(enterpriseAccountSetOrgDto.getId()); EnterpriseAccountSetOrg originalEntity = enterpriseAccountSetOrgMapper.selectByPrimaryKey(enterpriseAccountSetOrgDto.getId());
if(originalEntity==null) { if (originalEntity == null) {
return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.NoOrgSetOrOrgExist); return new OperationResultDto<>(false, EnterpriseAccountSetOrgMessage.NoOrgSetOrOrgExist);
} }
EnterpriseAccountSetOrg updateEntity = new EnterpriseAccountSetOrg(); EnterpriseAccountSetOrg updateEntity = new EnterpriseAccountSetOrg();
CommonUtils.copyProperties(originalEntity, updateEntity); CommonUtils.copyProperties(originalEntity, updateEntity);
updateEntity.setOrganizationId(enterpriseAccountSetOrgDto.getOrganizationId()); updateEntity.setOrganizationId(enterpriseAccountSetOrgDto.getOrganizationId());
updateEntity.setEffectiveDate(enterpriseAccountSetOrgDto.getEffectiveDate()); updateEntity.setEffectiveDate(enterpriseAccountSetOrgDto.getEffectiveDate());
updateEntity.setExpiredDate(enterpriseAccountSetOrgDto.getExpiredDate()); updateEntity.setExpiredDate(enterpriseAccountSetOrgDto.getExpiredDate());
enterpriseAccountSetOrgMapper.updateByPrimaryKey(updateEntity); enterpriseAccountSetOrgMapper.updateByPrimaryKey(updateEntity);
//operational log //operational log
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get()); updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get());
...@@ -392,47 +384,45 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -392,47 +384,45 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
updateLogParams.setOperateLogType(OperateLogType.OperationLogEnterPrise.value()); updateLogParams.setOperateLogType(OperateLogType.OperationLogEnterPrise.value());
updateLogParams.setComment(""); updateLogParams.setComment("");
updateLogParams.setOperationAction(OperationAction.UpdateRelevantOrg.value()); updateLogParams.setOperationAction(OperationAction.UpdateRelevantOrg.value());
if(originalEntity.getOrganizationId().equals(updateEntity.getOrganizationId())) { if (originalEntity.getOrganizationId().equals(updateEntity.getOrganizationId())) {
updateLogParams.setUpdateState(enterpriseAccountSetOrgDto.getEffectiveDateStr()+","+enterpriseAccountSetOrgDto.getExpiredDateStr()); updateLogParams.setUpdateState(enterpriseAccountSetOrgDto.getEffectiveDateStr() + "," + enterpriseAccountSetOrgDto.getExpiredDateStr());
updateLogParams.setOriginalState(getEnterpriseAccountSetOrgTimeLog(originalEntity)); updateLogParams.setOriginalState(getEnterpriseAccountSetOrgTimeLog(originalEntity));
updateLogParams.setOperationContent(enterpriseAccountSetOrgDto.getOrganizationName()); updateLogParams.setOperationContent(enterpriseAccountSetOrgDto.getOrganizationName());
} } else {
else {
Organization originalOrganization = organizationMapper.selectByPrimaryKey(originalEntity.getOrganizationId()); Organization originalOrganization = organizationMapper.selectByPrimaryKey(originalEntity.getOrganizationId());
String originalOrganizationName = originalOrganization == null ? "": originalOrganization.getName(); String originalOrganizationName = originalOrganization == null ? "" : originalOrganization.getName();
updateLogParams.setUpdateState(enterpriseAccountSetOrgDto.getOrganizationName() + ":" updateLogParams.setUpdateState(enterpriseAccountSetOrgDto.getOrganizationName() + ":"
+ enterpriseAccountSetOrgDto.getEffectiveDateStr() + "," + enterpriseAccountSetOrgDto.getExpiredDateStr()); + enterpriseAccountSetOrgDto.getEffectiveDateStr() + "," + enterpriseAccountSetOrgDto.getExpiredDateStr());
updateLogParams.setOriginalState(originalOrganizationName + ":" + getEnterpriseAccountSetOrgTimeLog(originalEntity)); updateLogParams.setOriginalState(originalOrganizationName + ":" + getEnterpriseAccountSetOrgTimeLog(originalEntity));
updateLogParams.setOperationContent(originalOrganizationName); updateLogParams.setOperationContent(originalOrganizationName);
} }
operationLogService.addOrDeleteDataAddLog(updateLogParams); operationLogService.addOrDeleteDataAddLog(updateLogParams);
return OperationResultDto.success(); return OperationResultDto.success();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see pwc.taxtech.atms.service.EnterpriseAccountService#deleteEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto) * @see pwc.taxtech.atms.service.EnterpriseAccountService#deleteEnterpriseAccountSetOrg(pwc.taxtech.atms.service.dto.EnterpriseAccountSetDto)
*/ */
@Override
@Transactional @Transactional
public OperationResultDto<?> deleteEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto) { public OperationResultDto<?> deleteEnterpriseAccountSetOrg(EnterpriseAccountSetDto enterpriseAccountSetDto) {
List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList(); List<EnterpriseAccountSetOrgDto> enterpriseAccountSetOrgDtoList = enterpriseAccountSetDto.getEnterpriseAccountSetOrgList();
if(enterpriseAccountSetOrgDtoList == null) { if (enterpriseAccountSetOrgDtoList == null) {
return OperationResultDto.success(); return OperationResultDto.success();
} }
List<String> enterpriseAccountSetOrgIdList = enterpriseAccountSetOrgDtoList.stream() List<String> enterpriseAccountSetOrgIdList = enterpriseAccountSetOrgDtoList.stream()
.map(sa -> sa.getId()).collect(Collectors.toList()); .map(sa -> sa.getId()).collect(Collectors.toList());
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample(); EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andIdIn(enterpriseAccountSetOrgIdList); example.createCriteria().andIdIn(enterpriseAccountSetOrgIdList);
enterpriseAccountSetOrgMapper.deleteByExample(example); enterpriseAccountSetOrgMapper.deleteByExample(example);
EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetDto.getId()); EnterpriseAccountSet enterpriseAccountSet = enterpriseAccountSetMapper.selectByPrimaryKey(enterpriseAccountSetDto.getId());
enterpriseAccountSetDto.setName(enterpriseAccountSet.getName()); enterpriseAccountSetDto.setName(enterpriseAccountSet.getName());
List<UpdateLogParams> updateLogParamsList = new ArrayList<>(); List<UpdateLogParams> updateLogParamsList = new ArrayList<>();
for(EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto : enterpriseAccountSetOrgDtoList) { for (EnterpriseAccountSetOrgDto enterpriseAccountSetOrgDto : enterpriseAccountSetOrgDtoList) {
UpdateLogParams updateLogParams = new UpdateLogParams(); UpdateLogParams updateLogParams = new UpdateLogParams();
updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get()); updateLogParams.setOperationUser(authUserHelper.getCurrentAuditor().get());
updateLogParams.setUpdateState(""); updateLogParams.setUpdateState("");
...@@ -446,14 +436,14 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -446,14 +436,14 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
updateLogParamsList.add(updateLogParams); updateLogParamsList.add(updateLogParams);
} }
operationLogService.addOrDeleteDataAddLog(updateLogParamsList); operationLogService.addOrDeleteDataAddLog(updateLogParamsList);
return OperationResultDto.success(); return OperationResultDto.success();
} }
/** /**
* Populate EnterpriseAccountSetDto list from EnterpriseAccountSet entity list * Populate EnterpriseAccountSetDto list from EnterpriseAccountSet entity list
* *
* @param enterpriseAccountSetList * @param enterpriseAccountSetList
* @return * @return
*/ */
...@@ -472,7 +462,7 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -472,7 +462,7 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
/** /**
* Populate EnterpriseAccountSetDto object from EnterpriseAccountSet entity * Populate EnterpriseAccountSetDto object from EnterpriseAccountSet entity
* *
* @param enterpriseAccountSet * @param enterpriseAccountSet
* @return * @return
*/ */
...@@ -488,16 +478,15 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ ...@@ -488,16 +478,15 @@ public class EnterpriseAccountSetServiceImpl implements EnterpriseAccountSetServ
/** /**
* Populate a string in the format of effectiveDateStr,expiredDateStr * Populate a string in the format of effectiveDateStr,expiredDateStr
*
* @param setOrg * @param setOrg
* @return String * @return String
*/ */
private String getEnterpriseAccountSetOrgTimeLog(EnterpriseAccountSetOrg setOrg) private String getEnterpriseAccountSetOrgTimeLog(EnterpriseAccountSetOrg setOrg) {
{
String effectiveDateStr = setOrg.getEffectiveDate() == null ? "" : new DateTime(setOrg.getEffectiveDate()).toString("yyyy-MM"); String effectiveDateStr = setOrg.getEffectiveDate() == null ? "" : new DateTime(setOrg.getEffectiveDate()).toString("yyyy-MM");
String expiredDateStr = setOrg.getExpiredDate() == null ? "" : new DateTime(setOrg.getExpiredDate()).toString("yyyy-MM"); String expiredDateStr = setOrg.getExpiredDate() == null ? "" : new DateTime(setOrg.getExpiredDate()).toString("yyyy-MM");
return effectiveDateStr + "," + expiredDateStr; return effectiveDateStr + "," + expiredDateStr;
} }
} }
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