Commit da324458 authored by gary's avatar gary

1、机构接口

parent 2e39bfb5
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
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.RestController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/ebs/api/v1/dd")
public class EbsApiController {
private static final Logger logger = LoggerFactory.getLogger(EbsApiController.class);
@Resource
private EbsApiService ebsApiService;
@RequestMapping(value = "/updateJE", method = RequestMethod.POST)
public ApiResultDto updateJE(@RequestBody List<JournalEntryQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateJE return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateJE(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateJE error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateTB", method = RequestMethod.POST)
public ApiResultDto updateTB(@RequestBody List<TrialBalanceQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateTB return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateTB(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateTB error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateCF", method = RequestMethod.POST)
public ApiResultDto updateCF(@RequestBody List<CashFlowQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateCF return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateCF(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateCF error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateBS", method = RequestMethod.POST)
public ApiResultDto updateBS(@RequestBody List<BalanceSheetQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateBS return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateBS(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateBS error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updatePL", method = RequestMethod.POST)
public ApiResultDto updatePL(@RequestBody List<ProfitLossStatementQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updatePL return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdatePL(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updatePL error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateBSprc", method = RequestMethod.POST)
public ApiResultDto updateBSprc(@RequestBody List<BalanceSheetPrcQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateBSprc return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateBSprc(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateBSprc error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updatePLprc", method = RequestMethod.POST)
public ApiResultDto updatePLprc(@RequestBody List<ProfitLossStatementPrcQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updatePLprc return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdatePLprc(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updatePLprc error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateOAR", method = RequestMethod.POST)
public ApiResultDto updateOAR(@RequestBody List<OrganizationAccountingRateQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateOAR return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateOAR(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateOAR error.", e);
}
return ApiResultDto.fail();
}
}
package pwc.taxtech.atms.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
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.RestController;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@RestController
@RequestMapping("/ebs/api/v1/dd")
public class EbsApiController {
private static final Logger logger = LoggerFactory.getLogger(EbsApiController.class);
@Resource
private EbsApiService ebsApiService;
@RequestMapping(value = "/updateJE", method = RequestMethod.POST)
public ApiResultDto updateJE(@RequestBody List<JournalEntryQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateJE return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateJE(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateJE error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateTB", method = RequestMethod.POST)
public ApiResultDto updateTB(@RequestBody List<TrialBalanceQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateTB return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateTB(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateTB error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateCF", method = RequestMethod.POST)
public ApiResultDto updateCF(@RequestBody List<CashFlowQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateCF return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateCF(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateCF error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateBS", method = RequestMethod.POST)
public ApiResultDto updateBS(@RequestBody List<BalanceSheetQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateBS return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateBS(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateBS error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updatePL", method = RequestMethod.POST)
public ApiResultDto updatePL(@RequestBody List<ProfitLossStatementQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updatePL return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdatePL(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updatePL error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateBSprc", method = RequestMethod.POST)
public ApiResultDto updateBSprc(@RequestBody List<BalanceSheetPrcQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateBSprc return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateBSprc(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateBSprc error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updatePLprc", method = RequestMethod.POST)
public ApiResultDto updatePLprc(@RequestBody List<ProfitLossStatementPrcQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updatePLprc return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdatePLprc(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updatePLprc error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateOAR", method = RequestMethod.POST)
public ApiResultDto updateOAR(@RequestBody List<OrganizationAccountingRateQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateOAR return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateOAR(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateOAR error.", e);
}
return ApiResultDto.fail();
}
@RequestMapping(value = "/updateOrg", method = RequestMethod.POST)
public ApiResultDto updateOrg(@RequestBody List<OrganizationQueryDto> items) {
if (CollectionUtils.isEmpty(items)) {
logger.debug("the updateOrg return items is empty");
return ApiResultDto.success(Collections.emptyList());
}
try {
ebsApiService.queryRemoteServerThenUpdateOrg(items);
return ApiResultDto.success();
} catch (Exception e) {
logger.error("updateOrg error.", e);
}
return ApiResultDto.fail();
}
}
package pwc.taxtech.atms.dto.ebsdto;
import java.io.Serializable;
/**
* @Auther: Gary J Li
* @Date: 04/03/2019 17:14
* @Description:
*/
public class OrganizationQueryDto implements Serializable {
private String taxPayerNumber;
private String code;
private String name;
private String enterpriseAccountCode;
private String legalPersonName;
private String registrationCapital;
private String paidInCapital;
private String legalPersonPhoneNumber;
private String legalPersonLandlineNum;
private String legalPersonEmailAddress;
private String regFinancialOfficerName;
private String regFinancialOfficerPhoneNum;
private String regFinancialOfficerLandlineNum;
private String regFinancialOfficerEmailAddress;
private String currencyCode;
private String registerAddress;
private String parentName;
private int staffSize;
public String getTaxPayerNumber() {
return taxPayerNumber;
}
public void setTaxPayerNumber(String taxPayerNumber) {
this.taxPayerNumber = taxPayerNumber;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEnterpriseAccountCode() {
return enterpriseAccountCode;
}
public void setEnterpriseAccountCode(String enterpriseAccountCode) {
this.enterpriseAccountCode = enterpriseAccountCode;
}
public String getLegalPersonName() {
return legalPersonName;
}
public void setLegalPersonName(String legalPersonName) {
this.legalPersonName = legalPersonName;
}
public String getRegistrationCapital() {
return registrationCapital;
}
public void setRegistrationCapital(String registrationCapital) {
this.registrationCapital = registrationCapital;
}
public String getPaidInCapital() {
return paidInCapital;
}
public void setPaidInCapital(String paidInCapital) {
this.paidInCapital = paidInCapital;
}
public String getLegalPersonPhoneNumber() {
return legalPersonPhoneNumber;
}
public void setLegalPersonPhoneNumber(String legalPersonPhoneNumber) {
this.legalPersonPhoneNumber = legalPersonPhoneNumber;
}
public String getLegalPersonLandlineNum() {
return legalPersonLandlineNum;
}
public void setLegalPersonLandlineNum(String legalPersonLandlineNum) {
this.legalPersonLandlineNum = legalPersonLandlineNum;
}
public String getLegalPersonEmailAddress() {
return legalPersonEmailAddress;
}
public void setLegalPersonEmailAddress(String legalPersonEmailAddress) {
this.legalPersonEmailAddress = legalPersonEmailAddress;
}
public String getRegFinancialOfficerName() {
return regFinancialOfficerName;
}
public void setRegFinancialOfficerName(String regFinancialOfficerName) {
this.regFinancialOfficerName = regFinancialOfficerName;
}
public String getRegFinancialOfficerPhoneNum() {
return regFinancialOfficerPhoneNum;
}
public void setRegFinancialOfficerPhoneNum(String regFinancialOfficerPhoneNum) {
this.regFinancialOfficerPhoneNum = regFinancialOfficerPhoneNum;
}
public String getRegFinancialOfficerLandlineNum() {
return regFinancialOfficerLandlineNum;
}
public void setRegFinancialOfficerLandlineNum(String regFinancialOfficerLandlineNum) {
this.regFinancialOfficerLandlineNum = regFinancialOfficerLandlineNum;
}
public String getRegFinancialOfficerEmailAddress() {
return regFinancialOfficerEmailAddress;
}
public void setRegFinancialOfficerEmailAddress(String regFinancialOfficerEmailAddress) {
this.regFinancialOfficerEmailAddress = regFinancialOfficerEmailAddress;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getRegisterAddress() {
return registerAddress;
}
public void setRegisterAddress(String registerAddress) {
this.registerAddress = registerAddress;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public int getStaffSize() {
return staffSize;
}
public void setStaffSize(int staffSize) {
this.staffSize = staffSize;
}
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.ebsdto.*;
import java.util.List;
public interface EbsApiService {
/**
* EBS 日记账同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateJE(List<JournalEntryQueryDto> items);
/**
* ebs 科目余额表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateTB(List<TrialBalanceQueryDto> items);
/**
* ebs 现金流量表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateCF(List<CashFlowQueryDto> items);
/**
* ebs 资产负债表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateBS(List<BalanceSheetQueryDto> items);
/**
* ebs 资产负债表PRC同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateBSprc(List<BalanceSheetPrcQueryDto> items);
/**
* ebs 利润表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdatePL(List<ProfitLossStatementQueryDto> items);
/**
* ebs 利润表PRC同步更新
*
* @param items
*/
void queryRemoteServerThenUpdatePLprc(List<ProfitLossStatementPrcQueryDto> items);
/**
* ebs 汇率表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateOAR(List<OrganizationAccountingRateQueryDto> items);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.ebsdto.*;
import java.util.List;
public interface EbsApiService {
/**
* EBS 日记账同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateJE(List<JournalEntryQueryDto> items);
/**
* ebs 科目余额表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateTB(List<TrialBalanceQueryDto> items);
/**
* ebs 现金流量表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateCF(List<CashFlowQueryDto> items);
/**
* ebs 资产负债表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateBS(List<BalanceSheetQueryDto> items);
/**
* ebs 资产负债表PRC同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateBSprc(List<BalanceSheetPrcQueryDto> items);
/**
* ebs 利润表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdatePL(List<ProfitLossStatementQueryDto> items);
/**
* ebs 利润表PRC同步更新
*
* @param items
*/
void queryRemoteServerThenUpdatePLprc(List<ProfitLossStatementPrcQueryDto> items);
/**
* ebs 汇率表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateOAR(List<OrganizationAccountingRateQueryDto> items);
/**
* ebs 机构信息表同步更新
*
* @param items
*/
void queryRemoteServerThenUpdateOrg(List<OrganizationQueryDto> items);
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.dao.OrganizationAccountingRateMapper;
import pwc.taxtech.atms.dao.OrganizationMapper;
import pwc.taxtech.atms.dao.ProjectMapper;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.service.EbsApiService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Optional;
@Service
public class EbsApiServiceImpl implements EbsApiService {
@Resource
private JournalEntryMapper journalEntryMapper;
@Resource
private TrialBalanceMapper trialBalanceMapper;
@Resource
private CashFlowMapper cashFlowMapper;
@Resource
private BalanceSheetMapper balanceSheetMapper;
@Resource
private ProfitLossStatementMapper profitLossStatementMapper;
@Resource
private OrganizationAccountingRateMapper organizationAccountingRateMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private DistributedIdService distributedIdService;
@Resource
private BeanUtil beanUtil;
private static final Logger logger = LoggerFactory.getLogger(EbsApiServiceImpl.class);
@Override
public void queryRemoteServerThenUpdateJE(List<JournalEntryQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateJE 日记账表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS JournalEntry 日记账表 response, skip processing");
return;
}
logger.debug("requestJEItems 日记账表条目:" + JSON.toJSONString(items));
for (JournalEntryQueryDto a : items) {
try {
processJE(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateJE 日记账表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateTB(List<TrialBalanceQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateTB 科目余额表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS TrialBalance 科目余额表 response, skip processing");
return;
}
logger.debug("requestTBItems 科目余额表条目:" + JSON.toJSONString(items));
for (TrialBalanceQueryDto a : items) {
try {
processTB(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateTB 科目余额表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateCF(List<CashFlowQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateCF 现金流量表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS CashFlow 现金流量表 response, skip processing");
return;
}
logger.debug("requestCFItems 现金流量表条目:" + JSON.toJSONString(items));
for (CashFlowQueryDto a : items) {
try {
processCF(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateCF 现金流量表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateBS(List<BalanceSheetQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateBS 资产负债表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS BalanceSheet 资产负债表 response, skip processing");
return;
}
logger.debug("requestBSItems 资产负债表条目:" + JSON.toJSONString(items));
for (BalanceSheetQueryDto a : items) {
try {
processBS(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateBS 资产负债表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateBSprc(List<BalanceSheetPrcQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateBSprc 资产负债表PRC");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS BSprc 资产负债表PRC response, skip processing");
return;
}
logger.debug("requestBSprcItems 资产负债表PRC条目:" + JSON.toJSONString(items));
for (BalanceSheetPrcQueryDto a : items) {
try {
processBSprc(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateBSprc 资产负债表PRC,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdatePL(List<ProfitLossStatementQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdatePL 利润表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS ProfitLossStatement 利润表 response, skip processing");
return;
}
logger.debug("requestPLItems 利润表条目:" + JSON.toJSONString(items));
for (ProfitLossStatementQueryDto a : items) {
try {
processPL(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdatePL 利润表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdatePLprc(List<ProfitLossStatementPrcQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdatePLprc 利润表PRC");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS ProfitLossStatement 利润表PRC response, skip processing");
return;
}
logger.debug("requestPLItems 利润表PRC条目:" + JSON.toJSONString(items));
for (ProfitLossStatementPrcQueryDto a : items) {
try {
processPLprc(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdatePLprc 利润表PRC,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateOAR(List<OrganizationAccountingRateQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateOAR 汇率表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS OrganizationAccountingRate 汇率表 response, skip processing");
return;
}
logger.debug("requestPLItems 汇率表:" + JSON.toJSONString(items));
for (OrganizationAccountingRateQueryDto a : items) {
try {
processOAR(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateOAR 汇率表,took [{}] ms", System.currentTimeMillis() - start);
}
private void processJE(JournalEntryQueryDto item) {
JournalEntryExample journalEntryExample = new JournalEntryExample();
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum());
List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample);
//唯一则更新否则插入
JournalEntry journalEntry = new JournalEntry();
if (journalEntryList.size() == 1) {
logger.info("exit and update journalEntry headerId:{},lineNum:{}", item.getHeaderId(), item.getLineNum());
journalEntry = journalEntryList.get(0);
populateFieldsJE(item, journalEntry);
journalEntry.setId(journalEntryList.get(0).getId());
journalEntryMapper.updateByPrimaryKey(journalEntry);
} else {
logger.info("miss and insert journalEntry headerId:{},lineNum:{}", item.getHeaderId(), item.getLineNum());
populateFieldsJE(item, journalEntry);
journalEntry.setId(distributedIdService.nextId());
journalEntry.setCreatedBy("");
journalEntry.setCreatedDate(new Date());
journalEntry.setCreateTime(new Date());
journalEntryMapper.insertSelective(journalEntry);
}
}
private void processTB(TrialBalanceQueryDto item) {
TrialBalanceExample example = new TrialBalanceExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(item.getPeriod());
List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example);
//唯一则更新否则插入
TrialBalance result = new TrialBalance();
if (itemList.size() == 1) {
logger.info("exit and update TrialBalance OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsTB(item, result);
result.setId(itemList.get(0).getId());
trialBalanceMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update TrialBalance OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsTB(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
result.setCreateTime(new Date());
trialBalanceMapper.insertSelective(result);
}
}
private void processCF(CashFlowQueryDto item) {
CashFlowExample example = new CashFlowExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<CashFlow> itemList = cashFlowMapper.selectByExample(example);
//唯一则更新否则插入
CashFlow result = new CashFlow();
if (itemList.size() == 1) {
logger.info("exit and update CashFlow OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsCF(item, result);
result.setId(itemList.get(0).getId());
cashFlowMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update CashFlow OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsCF(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
cashFlowMapper.insertSelective(result);
}
}
private void processBS(BalanceSheetQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
if (itemList.size() == 1) {
logger.info("exit and update BalanceSheet OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsBS(item, result);
result.setId(itemList.get(0).getId());
balanceSheetMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update BalanceSheet OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsBS(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
balanceSheetMapper.insertSelective(result);
}
}
private void processBSprc(BalanceSheetPrcQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
if (itemList.size() == 1) {
logger.info("exit and update BalanceSheetPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsBSprc(item, result);
result.setId(itemList.get(0).getId());
balanceSheetMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update BalanceSheetPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsBSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
balanceSheetMapper.insertSelective(result);
}
}
private void processPL(ProfitLossStatementQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
if (itemList.size() == 1) {
logger.info("exit and update ProfitLossStatement OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsPLS(item, result);
result.setId(itemList.get(0).getId());
profitLossStatementMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update ProfitLossStatement OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsPLS(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
profitLossStatementMapper.insertSelective(result);
}
}
private void processPLprc(ProfitLossStatementPrcQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
if (itemList.size() == 1) {
logger.info("exit and update ProfitLossStatementPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsPLSprc(item, result);
result.setId(itemList.get(0).getId());
profitLossStatementMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update ProfitLossStatementPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsPLSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
profitLossStatementMapper.insertSelective(result);
}
}
private void processOAR(OrganizationAccountingRateQueryDto item) {
OrganizationAccountingRateExample example = new OrganizationAccountingRateExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//TODO 汇率表更新依据未知
//期间
example.createCriteria().andPeriodEqualTo(item.getPeriod());
List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example);
//唯一则更新否则插入
OrganizationAccountingRate result = new OrganizationAccountingRate();
if (itemList.size() == 1) {
logger.info("exit and update OrganizationAccountingRate OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsOAR(item, result);
result.setId(itemList.get(0).getId());
organizationAccountingRateMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update OrganizationAccountingRate OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsOAR(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
organizationAccountingRateMapper.insertSelective(result);
}
}
private void populateFieldsJE(JournalEntryQueryDto item, JournalEntry result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setCurrencyCode(trimLimit(item.getCurrencyCode(), 20));
result.setStatus(trimLimit(item.getStatus(), 10));
result.setHeaderId(trimLimit(item.getHeaderId(), 128));
result.setLineNum(trimLimit(item.getLineNum(), 300));
result.setApprovalStatus(trimLimit(item.getApprovalStatus(), 20));
result.setPostedStatus(trimLimit(item.getPostedStatus(), 20));
result.setPeriod(StringUtils.isBlank(item.getPeriod().toString()) ? 0 : item.getPeriod());
result.setAccountingDate(item.getAccountingDate());
result.setJournalSource(trimLimit(item.getJournalSource(), 20));
result.setCategory(trimLimit(item.getCategory(), 50));
result.setName(trimLimit(item.getName(), 300));
result.setVoucherNum(trimLimit(item.getVoucherNum(), 128));
result.setDescription(trimLimit(item.getDescription(), 500));
result.setSegment1(trimLimit(item.getSegment1(), 300));
result.setSegment2(trimLimit(item.getSegment2(), 300));
result.setSegment3(trimLimit(item.getSegment3(), 300));
result.setSegment4(trimLimit(item.getSegment4(), 300));
result.setSegment5(trimLimit(item.getSegment5(), 300));
result.setSegment6(trimLimit(item.getSegment6(), 300));
result.setSegment7(trimLimit(item.getSegment7(), 300));
result.setSegment8(trimLimit(item.getSegment8(), 300));
result.setSegment9(trimLimit(item.getSegment9(), 300));
result.setSegment10(trimLimit(item.getSegment10(), 300));
result.setSegment1Name(trimLimit(item.getSegment1Name(), 300));
result.setSegment2Name(trimLimit(item.getSegment2Name(), 300));
result.setSegment3Name(trimLimit(item.getSegment3Name(), 300));
result.setSegment4Name(trimLimit(item.getSegment4Name(), 300));
result.setSegment5Name(trimLimit(item.getSegment5Name(), 300));
result.setSegment6Name(trimLimit(item.getSegment6Name(), 300));
result.setSegment7Name(trimLimit(item.getSegment7Name(), 300));
result.setSegment8Name(trimLimit(item.getSegment8Name(), 300));
result.setSegment9Name(trimLimit(item.getSegment9Name(), 300));
result.setSegment10Name(trimLimit(item.getSegment10Name(), 300));
result.setJournalCurrencyCode(trimLimit(item.getJournalCurrencyCode(), 20));
result.setSobCurrencyCode(trimLimit(item.getSobCurrencyCode(), 20));
result.setAccountedDr(Optional.ofNullable(item.getAccountedDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setAccountedCr(Optional.ofNullable(item.getAccountedCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEnteredDr(Optional.ofNullable(item.getEnteredDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEnteredCr(Optional.ofNullable(item.getEnteredCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setCfItem(trimLimit(item.getCfItem(), 50));
result.setAttribute1(trimLimit(item.getAttribute1(), 300));
result.setAttribute2(item.getAttribute2());
result.setAttribute3(trimLimit(item.getAttribute3(), 300));
result.setAttribute4(trimLimit(item.getAttribute4(), 300));
result.setAttribute5(trimLimit(item.getAttribute5(), 300));
result.setAttribute6(trimLimit(item.getAttribute6(), 300));
result.setAttribute7(trimLimit(item.getAttribute7(), 300));
result.setAttribute8(trimLimit(item.getAttribute8(), 300));
result.setAttribute9(trimLimit(item.getAttribute9(), 300));
result.setAttribute10(trimLimit(item.getAttribute10(), 300));
result.setAttribute11(trimLimit(item.getAttribute11(), 300));
result.setAttribute12(trimLimit(item.getAttribute12(), 300));
result.setAttribute13(trimLimit(item.getAttribute13(), 300));
result.setAttribute14(trimLimit(item.getAttribute14(), 300));
result.setAttribute15(trimLimit(item.getAttribute15(), 300));
result.setAttribute16(trimLimit(item.getAttribute16(), 300));
result.setLateUpdatedBy("");
result.setLateUpdatedDate(new Date());
result.setUpdateTime(new Date());
}
private void populateFieldsTB(TrialBalanceQueryDto item, TrialBalance result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setCurrencyCode(trimLimit(item.getCurrencyCode(), 20));
result.setStatus(trimLimit(item.getStatus(), 20));
result.setCategory(trimLimit(item.getCategory(), 10));
result.setAccountCategory(trimLimit(item.getAccountCategory(), 20));
result.setAcctCode1(trimLimit(item.getAcctCode1(), 300));
result.setAcctName1(trimLimit(item.getAcctName1(), 300));
result.setAcctName2(trimLimit(item.getAcctName2(), 300));
result.setAcctName3(trimLimit(item.getAcctName3(), 300));
result.setSegment1(trimLimit(item.getSegment1(), 300));
result.setSegment2(trimLimit(item.getSegment2(), 300));
result.setSegment3(trimLimit(item.getSegment3(), 300));
result.setSegment4(trimLimit(item.getSegment4(), 300));
result.setSegment5(trimLimit(item.getSegment5(), 300));
result.setSegment6(trimLimit(item.getSegment6(), 300));
result.setSegment7(trimLimit(item.getSegment7(), 300));
result.setSegment8(trimLimit(item.getSegment8(), 300));
result.setSegment9(trimLimit(item.getSegment9(), 300));
result.setSegment10(trimLimit(item.getSegment10(), 300));
result.setSegment1Name(trimLimit(item.getSegment1Name(), 300));
result.setSegment2Name(trimLimit(item.getSegment2Name(), 300));
result.setSegment3Name(trimLimit(item.getSegment3Name(), 300));
result.setSegment4Name(trimLimit(item.getSegment4Name(), 300));
result.setSegment5Name(trimLimit(item.getSegment5Name(), 300));
result.setSegment6Name(trimLimit(item.getSegment6Name(), 300));
result.setSegment7Name(trimLimit(item.getSegment7Name(), 300));
result.setSegment8Name(trimLimit(item.getSegment8Name(), 300));
result.setSegment9Name(trimLimit(item.getSegment9Name(), 300));
result.setSegment10Name(trimLimit(item.getSegment10Name(), 300));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodDr(Optional.ofNullable(item.getPeriodDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodCr(Optional.ofNullable(item.getPeriodCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdDr(Optional.ofNullable(item.getQtdDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdCr(Optional.ofNullable(item.getQtdCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdDr(Optional.ofNullable(item.getYtdDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdCr(Optional.ofNullable(item.getYtdCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBalBeq(Optional.ofNullable(item.getBegBalBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodDrBeq(Optional.ofNullable(item.getPeriodDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodCrBeq(Optional.ofNullable(item.getPeriodCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEndBalBeq(Optional.ofNullable(item.getEndBalBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdDrBeq(Optional.ofNullable(item.getQtdDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdCrBeq(Optional.ofNullable(item.getQtdCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdDrBeq(Optional.ofNullable(item.getYtdDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdCrBeq(Optional.ofNullable(item.getYtdCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsCF(CashFlowQueryDto item, CashFlow result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 128));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 128));
result.setEntityCode(trimLimit(item.getEntityCode(), 128));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setItemName2(trimLimit(item.getItemName2(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsBS(BalanceSheetQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsPLS(ProfitLossStatementQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateTime(new Date());
result.setUpdateBy("");
}
private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateTime(new Date());
result.setUpdateBy("");
}
private void populateFieldsOAR(OrganizationAccountingRateQueryDto item, OrganizationAccountingRate result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId("");
result.setPeriod(item.getPeriod());
result.setConvertionType(trimLimit(item.getConvertionType(), 100));
result.setCurrencyFrom(trimLimit(item.getCurrencyFrom(), 10));
result.setCurrencyTo(trimLimit(item.getCurrencyTo(), 10));
result.setRate(item.getRate());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
/**对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码查询到具体机构
* @param code
* @return
*/
private Organization getOrganizationByEbsCode(String code){
OrganizationExample example=new OrganizationExample();
example.createCriteria().andCodeEqualTo(code);
List<Organization> list=organizationMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Organization();
}
/**
* *对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码和期间查询到具体机构,期间到年yyyy=period/100
* @param code
* @param period
* @return
*/
private Project getProjectByEbsCodeAndPeriod(String code,Integer period){
ProjectExample example=new ProjectExample();
example.createCriteria().andCodeEqualTo(code).andYearEqualTo(period);
List<Project> list=projectMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Project();
}
/**
* 期间格式转换yyyy13均改为yyyy12
* @param period
* @return
*/
private Integer convertPeriod(Integer period){
if(period%100==13){
period--;
}
return period;
}
/**
* Trim字符串,并限定字符串的长度. 如果是输入值是空指针,会返回空字符串
*/
public String trimLimit(String str, int limit) {
if (Strings.isBlank(str)) {
return "";
}
String tmp = str.trim();
String result = cutString(tmp, limit);
if (result == null) {
result = "";
}
return result;
}
/**
* 限定字符串的长度.
*/
public String cutString(String s, int length) {
if (Lang.isEmpty(length) || Lang.isEmpty(s)) {
return "";
} else if (s.length() <= length) {
return s;
} else {
return s.substring(0, length);
}
}
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.apache.commons.lang3.StringUtils;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.service.EbsApiService;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.entity.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@Service
public class EbsApiServiceImpl implements EbsApiService {
@Resource
private JournalEntryMapper journalEntryMapper;
@Resource
private TrialBalanceMapper trialBalanceMapper;
@Resource
private CashFlowMapper cashFlowMapper;
@Resource
private BalanceSheetMapper balanceSheetMapper;
@Resource
private ProfitLossStatementMapper profitLossStatementMapper;
@Resource
private OrganizationAccountingRateMapper organizationAccountingRateMapper;
@Resource
private OrganizationMapper organizationMapper;
@Resource
private OrganizationEmployeeMapper organizationEmployeeMapper;
@Resource
private OrganizationExtraMapper organizationExtraMapper;
@Resource
private EnterpriseAccountSetMapper enterpriseAccountSetMapper;
@Resource
private EnterpriseAccountSetOrgMapper enterpriseAccountSetOrgMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
private DistributedIdService distributedIdService;
@Resource
private BeanUtil beanUtil;
private static final Logger logger = LoggerFactory.getLogger(EbsApiServiceImpl.class);
@Override
public void queryRemoteServerThenUpdateJE(List<JournalEntryQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateJE 日记账表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS JournalEntry 日记账表 response, skip processing");
return;
}
logger.debug("requestJEItems 日记账表条目:" + JSON.toJSONString(items));
for (JournalEntryQueryDto a : items) {
try {
processJE(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateJE 日记账表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateTB(List<TrialBalanceQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateTB 科目余额表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS TrialBalance 科目余额表 response, skip processing");
return;
}
logger.debug("requestTBItems 科目余额表条目:" + JSON.toJSONString(items));
for (TrialBalanceQueryDto a : items) {
try {
processTB(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateTB 科目余额表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateCF(List<CashFlowQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateCF 现金流量表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS CashFlow 现金流量表 response, skip processing");
return;
}
logger.debug("requestCFItems 现金流量表条目:" + JSON.toJSONString(items));
for (CashFlowQueryDto a : items) {
try {
processCF(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateCF 现金流量表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateBS(List<BalanceSheetQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateBS 资产负债表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS BalanceSheet 资产负债表 response, skip processing");
return;
}
logger.debug("requestBSItems 资产负债表条目:" + JSON.toJSONString(items));
for (BalanceSheetQueryDto a : items) {
try {
processBS(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateBS 资产负债表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateBSprc(List<BalanceSheetPrcQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateBSprc 资产负债表PRC");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS BSprc 资产负债表PRC response, skip processing");
return;
}
logger.debug("requestBSprcItems 资产负债表PRC条目:" + JSON.toJSONString(items));
for (BalanceSheetPrcQueryDto a : items) {
try {
processBSprc(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateBSprc 资产负债表PRC,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdatePL(List<ProfitLossStatementQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdatePL 利润表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS ProfitLossStatement 利润表 response, skip processing");
return;
}
logger.debug("requestPLItems 利润表条目:" + JSON.toJSONString(items));
for (ProfitLossStatementQueryDto a : items) {
try {
processPL(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdatePL 利润表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdatePLprc(List<ProfitLossStatementPrcQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdatePLprc 利润表PRC");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS ProfitLossStatement 利润表PRC response, skip processing");
return;
}
logger.debug("requestPLItems 利润表PRC条目:" + JSON.toJSONString(items));
for (ProfitLossStatementPrcQueryDto a : items) {
try {
processPLprc(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdatePLprc 利润表PRC,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateOAR(List<OrganizationAccountingRateQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateOAR 汇率表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS OrganizationAccountingRate 汇率表 response, skip processing");
return;
}
logger.debug("requestPLItems 汇率表:" + JSON.toJSONString(items));
for (OrganizationAccountingRateQueryDto a : items) {
try {
processOAR(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateOAR 汇率表,took [{}] ms", System.currentTimeMillis() - start);
}
@Override
public void queryRemoteServerThenUpdateOrg(List<OrganizationQueryDto> items) {
long start = System.currentTimeMillis();
logger.debug("start queryRemoteServerThenUpdateOrg 机构表");
//判断数据是否存在
if (items.size() == 0) {
logger.error("empty EBS Organization 机构表 response, skip processing");
return;
}
logger.debug("organization 汇率表:" + JSON.toJSONString(items));
for (OrganizationQueryDto a : items) {
try {
processORG(a);
} catch (Exception e) {
logger.error("break loop as catch:" + e, e);
}
}
logger.debug("end queryRemoteServerThenUpdateOrg 机构表,took [{}] ms", System.currentTimeMillis() - start);
}
private void processORG(OrganizationQueryDto a) {
// 机构信息
OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andTaxPayerNumberEqualTo(a.getTaxPayerNumber());
List<Organization> orgs = organizationMapper.selectByExample(organizationExample);
Organization org = beanUtil.copyProperties(a,new Organization());
OrganizationExample orgExample = new OrganizationExample();
orgExample.createCriteria().andNameEqualTo(a.getParentName());
List<Organization> orgParents = organizationMapper.selectByExample(organizationExample);
String orgId = "";
if(orgParents.size()>0){
org.setParentId(orgParents.get(0).getId());
}
if(orgs.size()<1){
orgId = UUID.randomUUID().toString();
org.setId(orgId);
org.setApiUpdateFlag(true);
organizationMapper.insertSelective(org);
}else{
orgId = orgs.get(0).getId();
org.setId(orgs.get(0).getId());
org.setApiUpdateFlag(true);
org.setUpdateTime(new Date());
organizationMapper.updateByPrimaryKeySelective(org);
}
// 机构其他信息
OrganizationExtraExample organizationExtraExample = new OrganizationExtraExample();
organizationExtraExample.createCriteria().andOrganizationIdEqualTo(org.getId());
List<OrganizationExtra> orgExs = organizationExtraMapper.selectByExample(organizationExtraExample);
OrganizationExtra orgEx = beanUtil.copyProperties(a,new OrganizationExtra());
orgEx.setReportingCurrency(a.getCurrencyCode());
if(orgExs.size()<1){
orgEx.setId(distributedIdService.nextId());
orgEx.setOrganizationId(orgId);
organizationExtraMapper.insertSelective(orgEx);
}else{
orgEx.setId(orgExs.get(0).getId());
orgEx.setOrganizationId(orgId);
orgEx.setUpdateTime(new Date());
organizationExtraMapper.updateByExampleSelective(orgEx,organizationExtraExample);
}
// 账套ID
/*if(StringUtils.isNotEmpty(a.getEnterpriseAccountCode())){
EnterpriseAccountSet eas = new EnterpriseAccountSet();
String easId = UUID.randomUUID().toString();
eas.setIsActive(false);
eas.setId(easId);
eas.setCode(a.getEnterpriseAccountCode());
eas.setCreatorId("66933E7B-DA75-4B2E-B7D6-AB65DCA20D50");
enterpriseAccountSetMapper.insertSelective(eas);
EnterpriseAccountSetOrg easo = new EnterpriseAccountSetOrg();
easo.setId(UUID.randomUUID().toString());
easo.setOrganizationId(orgId);
easo.setEnterpriseAccountSetId(easId);
enterpriseAccountSetOrgMapper.insertSelective(easo);
}*/
// 雇员信息
OrganizationEmployee oe = new OrganizationEmployee();
oe.setId(distributedIdService.nextId());
oe.setOrganizationId(orgId);
oe.setEmployeesNumEnd(a.getStaffSize());
organizationEmployeeMapper.insertSelective(oe);
}
private void processJE(JournalEntryQueryDto item) {
JournalEntryExample journalEntryExample = new JournalEntryExample();
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum());
List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample);
//唯一则更新否则插入
JournalEntry journalEntry = new JournalEntry();
if (journalEntryList.size() == 1) {
logger.info("exit and update journalEntry headerId:{},lineNum:{}", item.getHeaderId(), item.getLineNum());
journalEntry = journalEntryList.get(0);
populateFieldsJE(item, journalEntry);
journalEntry.setId(journalEntryList.get(0).getId());
journalEntryMapper.updateByPrimaryKey(journalEntry);
} else {
logger.info("miss and insert journalEntry headerId:{},lineNum:{}", item.getHeaderId(), item.getLineNum());
populateFieldsJE(item, journalEntry);
journalEntry.setId(distributedIdService.nextId());
journalEntry.setCreatedBy("");
journalEntry.setCreatedDate(new Date());
journalEntry.setCreateTime(new Date());
journalEntryMapper.insertSelective(journalEntry);
}
}
private void processTB(TrialBalanceQueryDto item) {
TrialBalanceExample example = new TrialBalanceExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(item.getPeriod());
List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example);
//唯一则更新否则插入
TrialBalance result = new TrialBalance();
if (itemList.size() == 1) {
logger.info("exit and update TrialBalance OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsTB(item, result);
result.setId(itemList.get(0).getId());
trialBalanceMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update TrialBalance OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsTB(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
result.setCreateTime(new Date());
trialBalanceMapper.insertSelective(result);
}
}
private void processCF(CashFlowQueryDto item) {
CashFlowExample example = new CashFlowExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<CashFlow> itemList = cashFlowMapper.selectByExample(example);
//唯一则更新否则插入
CashFlow result = new CashFlow();
if (itemList.size() == 1) {
logger.info("exit and update CashFlow OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsCF(item, result);
result.setId(itemList.get(0).getId());
cashFlowMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update CashFlow OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsCF(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
cashFlowMapper.insertSelective(result);
}
}
private void processBS(BalanceSheetQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
if (itemList.size() == 1) {
logger.info("exit and update BalanceSheet OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsBS(item, result);
result.setId(itemList.get(0).getId());
balanceSheetMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update BalanceSheet OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsBS(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
balanceSheetMapper.insertSelective(result);
}
}
private void processBSprc(BalanceSheetPrcQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
if (itemList.size() == 1) {
logger.info("exit and update BalanceSheetPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsBSprc(item, result);
result.setId(itemList.get(0).getId());
balanceSheetMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update BalanceSheetPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsBSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy("");
result.setCreateTime(new Date());
balanceSheetMapper.insertSelective(result);
}
}
private void processPL(ProfitLossStatementQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
if (itemList.size() == 1) {
logger.info("exit and update ProfitLossStatement OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsPLS(item, result);
result.setId(itemList.get(0).getId());
profitLossStatementMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update ProfitLossStatement OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsPLS(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
profitLossStatementMapper.insertSelective(result);
}
}
private void processPLprc(ProfitLossStatementPrcQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(item.getPeriod());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
if (itemList.size() == 1) {
logger.info("exit and update ProfitLossStatementPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsPLSprc(item, result);
result.setId(itemList.get(0).getId());
profitLossStatementMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update ProfitLossStatementPrc OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsPLSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
profitLossStatementMapper.insertSelective(result);
}
}
private void processOAR(OrganizationAccountingRateQueryDto item) {
OrganizationAccountingRateExample example = new OrganizationAccountingRateExample();
//修改期间
item.setPeriod(convertPeriod(item.getPeriod()));
//TODO 汇率表更新依据未知
//期间
example.createCriteria().andPeriodEqualTo(item.getPeriod());
List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example);
//唯一则更新否则插入
OrganizationAccountingRate result = new OrganizationAccountingRate();
if (itemList.size() == 1) {
logger.info("exit and update OrganizationAccountingRate OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
result = itemList.get(0);
populateFieldsOAR(item, result);
result.setId(itemList.get(0).getId());
organizationAccountingRateMapper.updateByPrimaryKey(result);
} else {
logger.info("exit and update OrganizationAccountingRate OrganizationId:{},Period:{}", item.getOrganizationId(), item.getPeriod());
populateFieldsOAR(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy("");
organizationAccountingRateMapper.insertSelective(result);
}
}
private void populateFieldsJE(JournalEntryQueryDto item, JournalEntry result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setCurrencyCode(trimLimit(item.getCurrencyCode(), 20));
result.setStatus(trimLimit(item.getStatus(), 10));
result.setHeaderId(trimLimit(item.getHeaderId(), 128));
result.setLineNum(trimLimit(item.getLineNum(), 300));
result.setApprovalStatus(trimLimit(item.getApprovalStatus(), 20));
result.setPostedStatus(trimLimit(item.getPostedStatus(), 20));
result.setPeriod(StringUtils.isBlank(item.getPeriod().toString()) ? 0 : item.getPeriod());
result.setAccountingDate(item.getAccountingDate());
result.setJournalSource(trimLimit(item.getJournalSource(), 20));
result.setCategory(trimLimit(item.getCategory(), 50));
result.setName(trimLimit(item.getName(), 300));
result.setVoucherNum(trimLimit(item.getVoucherNum(), 128));
result.setDescription(trimLimit(item.getDescription(), 500));
result.setSegment1(trimLimit(item.getSegment1(), 300));
result.setSegment2(trimLimit(item.getSegment2(), 300));
result.setSegment3(trimLimit(item.getSegment3(), 300));
result.setSegment4(trimLimit(item.getSegment4(), 300));
result.setSegment5(trimLimit(item.getSegment5(), 300));
result.setSegment6(trimLimit(item.getSegment6(), 300));
result.setSegment7(trimLimit(item.getSegment7(), 300));
result.setSegment8(trimLimit(item.getSegment8(), 300));
result.setSegment9(trimLimit(item.getSegment9(), 300));
result.setSegment10(trimLimit(item.getSegment10(), 300));
result.setSegment1Name(trimLimit(item.getSegment1Name(), 300));
result.setSegment2Name(trimLimit(item.getSegment2Name(), 300));
result.setSegment3Name(trimLimit(item.getSegment3Name(), 300));
result.setSegment4Name(trimLimit(item.getSegment4Name(), 300));
result.setSegment5Name(trimLimit(item.getSegment5Name(), 300));
result.setSegment6Name(trimLimit(item.getSegment6Name(), 300));
result.setSegment7Name(trimLimit(item.getSegment7Name(), 300));
result.setSegment8Name(trimLimit(item.getSegment8Name(), 300));
result.setSegment9Name(trimLimit(item.getSegment9Name(), 300));
result.setSegment10Name(trimLimit(item.getSegment10Name(), 300));
result.setJournalCurrencyCode(trimLimit(item.getJournalCurrencyCode(), 20));
result.setSobCurrencyCode(trimLimit(item.getSobCurrencyCode(), 20));
result.setAccountedDr(Optional.ofNullable(item.getAccountedDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setAccountedCr(Optional.ofNullable(item.getAccountedCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEnteredDr(Optional.ofNullable(item.getEnteredDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEnteredCr(Optional.ofNullable(item.getEnteredCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setCfItem(trimLimit(item.getCfItem(), 50));
result.setAttribute1(trimLimit(item.getAttribute1(), 300));
result.setAttribute2(item.getAttribute2());
result.setAttribute3(trimLimit(item.getAttribute3(), 300));
result.setAttribute4(trimLimit(item.getAttribute4(), 300));
result.setAttribute5(trimLimit(item.getAttribute5(), 300));
result.setAttribute6(trimLimit(item.getAttribute6(), 300));
result.setAttribute7(trimLimit(item.getAttribute7(), 300));
result.setAttribute8(trimLimit(item.getAttribute8(), 300));
result.setAttribute9(trimLimit(item.getAttribute9(), 300));
result.setAttribute10(trimLimit(item.getAttribute10(), 300));
result.setAttribute11(trimLimit(item.getAttribute11(), 300));
result.setAttribute12(trimLimit(item.getAttribute12(), 300));
result.setAttribute13(trimLimit(item.getAttribute13(), 300));
result.setAttribute14(trimLimit(item.getAttribute14(), 300));
result.setAttribute15(trimLimit(item.getAttribute15(), 300));
result.setAttribute16(trimLimit(item.getAttribute16(), 300));
result.setLateUpdatedBy("");
result.setLateUpdatedDate(new Date());
result.setUpdateTime(new Date());
}
private void populateFieldsTB(TrialBalanceQueryDto item, TrialBalance result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getSegment1()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getSegment1(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setCurrencyCode(trimLimit(item.getCurrencyCode(), 20));
result.setStatus(trimLimit(item.getStatus(), 20));
result.setCategory(trimLimit(item.getCategory(), 10));
result.setAccountCategory(trimLimit(item.getAccountCategory(), 20));
result.setAcctCode1(trimLimit(item.getAcctCode1(), 300));
result.setAcctName1(trimLimit(item.getAcctName1(), 300));
result.setAcctName2(trimLimit(item.getAcctName2(), 300));
result.setAcctName3(trimLimit(item.getAcctName3(), 300));
result.setSegment1(trimLimit(item.getSegment1(), 300));
result.setSegment2(trimLimit(item.getSegment2(), 300));
result.setSegment3(trimLimit(item.getSegment3(), 300));
result.setSegment4(trimLimit(item.getSegment4(), 300));
result.setSegment5(trimLimit(item.getSegment5(), 300));
result.setSegment6(trimLimit(item.getSegment6(), 300));
result.setSegment7(trimLimit(item.getSegment7(), 300));
result.setSegment8(trimLimit(item.getSegment8(), 300));
result.setSegment9(trimLimit(item.getSegment9(), 300));
result.setSegment10(trimLimit(item.getSegment10(), 300));
result.setSegment1Name(trimLimit(item.getSegment1Name(), 300));
result.setSegment2Name(trimLimit(item.getSegment2Name(), 300));
result.setSegment3Name(trimLimit(item.getSegment3Name(), 300));
result.setSegment4Name(trimLimit(item.getSegment4Name(), 300));
result.setSegment5Name(trimLimit(item.getSegment5Name(), 300));
result.setSegment6Name(trimLimit(item.getSegment6Name(), 300));
result.setSegment7Name(trimLimit(item.getSegment7Name(), 300));
result.setSegment8Name(trimLimit(item.getSegment8Name(), 300));
result.setSegment9Name(trimLimit(item.getSegment9Name(), 300));
result.setSegment10Name(trimLimit(item.getSegment10Name(), 300));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodDr(Optional.ofNullable(item.getPeriodDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodCr(Optional.ofNullable(item.getPeriodCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdDr(Optional.ofNullable(item.getQtdDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdCr(Optional.ofNullable(item.getQtdCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdDr(Optional.ofNullable(item.getYtdDr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdCr(Optional.ofNullable(item.getYtdCr())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBalBeq(Optional.ofNullable(item.getBegBalBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodDrBeq(Optional.ofNullable(item.getPeriodDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPeriodCrBeq(Optional.ofNullable(item.getPeriodCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setEndBalBeq(Optional.ofNullable(item.getEndBalBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdDrBeq(Optional.ofNullable(item.getQtdDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setQtdCrBeq(Optional.ofNullable(item.getQtdCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdDrBeq(Optional.ofNullable(item.getYtdDrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdCrBeq(Optional.ofNullable(item.getYtdCrBeq())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsCF(CashFlowQueryDto item, CashFlow result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 128));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 128));
result.setEntityCode(trimLimit(item.getEntityCode(), 128));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setItemName2(trimLimit(item.getItemName2(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsBS(BalanceSheetQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheet result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setEndBal(Optional.ofNullable(item.getEndBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setBegBal(Optional.ofNullable(item.getBegBal())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
private void populateFieldsPLS(ProfitLossStatementQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateTime(new Date());
result.setUpdateBy("");
}
private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatement result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
result.setProjectId(getProjectByEbsCodeAndPeriod(item.getEntityCode(),item.getPeriod()).getId());
result.setDate(item.getDate());
result.setSource(trimLimit(item.getSource(), 20));
result.setTmsPeriod(item.getTmsPeriod());
result.setPeriod(item.getPeriod());
result.setStatus(trimLimit(item.getStatus(), 10));
result.setLedgerId(trimLimit(item.getLedgerId(), 128));
result.setLedgerName(trimLimit(item.getLedgerName(), 300));
result.setLedgerCurrencyCode(trimLimit(item.getLedgerCurrencyCode(), 20));
result.setEntityCode(trimLimit(item.getEntityCode(), 300));
result.setEntityName(trimLimit(item.getEntityName(), 300));
result.setCategory(trimLimit(item.getCategory(), 300));
result.setFrequency(trimLimit(item.getFrequency(), 300));
result.setItemName(trimLimit(item.getItemName(), 300));
result.setPeriodAmt(Optional.ofNullable(item.getPeriodAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setYtdAmt(Optional.ofNullable(item.getYtdAmt())
.map(x -> x.setScale(4, RoundingMode.HALF_UP))
.orElse(BigDecimal.ZERO));
result.setPrcFlag(item.getPrcFlag());
result.setUpdateTime(new Date());
result.setUpdateBy("");
}
private void populateFieldsOAR(OrganizationAccountingRateQueryDto item, OrganizationAccountingRate result) {
beanUtil.copyProperties(item, result);
result.setOrganizationId("");
result.setPeriod(item.getPeriod());
result.setConvertionType(trimLimit(item.getConvertionType(), 100));
result.setCurrencyFrom(trimLimit(item.getCurrencyFrom(), 10));
result.setCurrencyTo(trimLimit(item.getCurrencyTo(), 10));
result.setRate(item.getRate());
result.setUpdateBy("");
result.setUpdateTime(new Date());
}
/**对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码查询到具体机构
* @param code
* @return
*/
private Organization getOrganizationByEbsCode(String code){
OrganizationExample example=new OrganizationExample();
example.createCriteria().andCodeEqualTo(code);
List<Organization> list=organizationMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Organization();
}
/**
* *对拓展字段进行查询赋值
* 根据Ebs返回的数据机构编码和期间查询到具体机构,期间到年yyyy=period/100
* @param code
* @param period
* @return
*/
private Project getProjectByEbsCodeAndPeriod(String code,Integer period){
ProjectExample example=new ProjectExample();
example.createCriteria().andCodeEqualTo(code).andYearEqualTo(period);
List<Project> list=projectMapper.selectByExample(example);
if(list.size()>0){
return list.get(0);
}
return new Project();
}
/**
* 期间格式转换yyyy13均改为yyyy12
* @param period
* @return
*/
private Integer convertPeriod(Integer period){
if(period%100==13){
period--;
}
return period;
}
/**
* Trim字符串,并限定字符串的长度. 如果是输入值是空指针,会返回空字符串
*/
public String trimLimit(String str, int limit) {
if (Strings.isBlank(str)) {
return "";
}
String tmp = str.trim();
String result = cutString(tmp, limit);
if (result == null) {
result = "";
}
return result;
}
/**
* 限定字符串的长度.
*/
public String cutString(String s, int length) {
if (Lang.isEmpty(length) || Lang.isEmpty(s)) {
return "";
} else if (s.length() <= length) {
return s;
} else {
return s.substring(0, length);
}
}
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import org.junit.Test;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class EbsApiServiceImplTest extends CommonIT {
@Resource
private EbsApiService ebsApiService;
@Resource
private DistributedIdService distributedIdService;
@Test
public void queryRemoteServerThenUpdateJE(){
List<JournalEntryQueryDto> items=new ArrayList<>();
for(int i=0;i<10;i++){
JournalEntryQueryDto journalEntryQueryDto =new JournalEntryQueryDto();
journalEntryQueryDto.setId(distributedIdService.nextId());
journalEntryQueryDto.setOrganizationId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setProjectId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setDate(new Date());
journalEntryQueryDto.setSource("来源");
journalEntryQueryDto.setLedgerId("账套ID");
journalEntryQueryDto.setLedgerName("账套名称");
journalEntryQueryDto.setCurrencyCode("账套币种");
journalEntryQueryDto.setStatus("关账标识");
journalEntryQueryDto.setHeaderId("日记账头ID");
journalEntryQueryDto.setLineNum("日记账行号");
journalEntryQueryDto.setApprovalStatus("审批状态");
journalEntryQueryDto.setPostedStatus("过账");
journalEntryQueryDto.setPeriod(20180102+i);
journalEntryQueryDto.setAccountingDate(new Date());
journalEntryQueryDto.setJournalSource("日记账来源");
journalEntryQueryDto.setCategory("日记账类别");
journalEntryQueryDto.setName("日记账名称");
journalEntryQueryDto.setVoucherNum("凭证编号");
journalEntryQueryDto.setDescription("摘要");
journalEntryQueryDto.setSegment1("主体代码");
journalEntryQueryDto.setSegment2("成本中心");
journalEntryQueryDto.setSegment3("科目代码");
journalEntryQueryDto.setSegment4("辅助科目");
journalEntryQueryDto.setSegment5("利润中心");
journalEntryQueryDto.setSegment6("产品");
journalEntryQueryDto.setSegment7("项目");
journalEntryQueryDto.setSegment8("公司间");
journalEntryQueryDto.setSegment9("备用1");
journalEntryQueryDto.setSegment10("备用2");
journalEntryQueryDto.setSegment1Name("主体说明");
journalEntryQueryDto.setSegment2Name("成本中心说明");
journalEntryQueryDto.setSegment3Name("科目说明");
journalEntryQueryDto.setSegment4Name("辅助科目说明");
journalEntryQueryDto.setSegment5Name("利润中心说明");
journalEntryQueryDto.setSegment6Name("产品说明");
journalEntryQueryDto.setSegment7Name("项目说明");
journalEntryQueryDto.setSegment8Name("公司间说明");
journalEntryQueryDto.setSegment9Name("备用1说明");
journalEntryQueryDto.setSegment10Name("备用2说明");
journalEntryQueryDto.setJournalCurrencyCode("币种");
journalEntryQueryDto.setSobCurrencyCode("本位币币种");
journalEntryQueryDto.setAccountedDr(new BigDecimal("123"));
journalEntryQueryDto.setAccountedCr(new BigDecimal("120.2"));
journalEntryQueryDto.setEnteredDr(new BigDecimal("1231.0231"));
journalEntryQueryDto.setEnteredCr(new BigDecimal("120.122"));
journalEntryQueryDto.setCfItem("现金流量表项");
journalEntryQueryDto.setAttribute1("城市");
journalEntryQueryDto.setAttribute2(new Date());
journalEntryQueryDto.setAttribute3("对方银行账号");
journalEntryQueryDto.setAttribute4("银行流水号");
journalEntryQueryDto.setAttribute5("供应商编号");
journalEntryQueryDto.setAttribute6("交易单号");
journalEntryQueryDto.setAttribute7("供应商名称");
journalEntryQueryDto.setAttribute8("接收编码");
journalEntryQueryDto.setAttribute9("制单人");
journalEntryQueryDto.setAttribute10("审核人");
journalEntryQueryDto.setAttribute11("成本中心部门描述1");
journalEntryQueryDto.setAttribute12("成本中心部门描述2");
journalEntryQueryDto.setAttribute13("成本中心部门描述3");
journalEntryQueryDto.setAttribute14("成本中心部门描述4");
journalEntryQueryDto.setAttribute15("成本中心部门描述5");
journalEntryQueryDto.setAttribute16("成本中心部门描述6");
items.add(journalEntryQueryDto);
}
String a=JSON.toJSONString(items);
System.out.println(a);
//ebsApiService.queryRemoteServerThenUpdateJE(items);
}
@Test
public void queryRemoteServerThenUpdateTB() {
List<TrialBalanceQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
TrialBalanceQueryDto result = new TrialBalanceQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setCurrencyCode("账套币种");
result.setStatus("关账标识");
result.setCategory("主体性质");
result.setAccountCategory("科目性质");
result.setAcctCode1("一级科目代码");
result.setAcctName1("一级科目说明");
result.setAcctName2("二级科目说明");
result.setAcctName3("三级科目说明");
result.setSegment1("主体代码");
result.setSegment2("成本中心代码");
result.setSegment3("科目代码");
result.setSegment4("辅助科目代码");
result.setSegment5("利润中心代码");
result.setSegment6("产品代码");
result.setSegment7("项目代码");
result.setSegment8("公司间代码");
result.setSegment9("备用1代码");
result.setSegment10("备用2代码");
result.setSegment1Name("主体说明");
result.setSegment2Name("成本中心说明");
result.setSegment3Name("科目说明");
result.setSegment4Name("辅助科目说明");
result.setSegment5Name("利润中心说明");
result.setSegment6Name("产品说明");
result.setSegment7Name("项目说明");
result.setSegment8Name("公司间说明");
result.setSegment9Name("备用1说明");
result.setSegment10Name("备用2说明");
result.setBegBal(new BigDecimal("110"));
result.setPeriodDr(new BigDecimal("110"));
result.setPeriodCr(new BigDecimal("110"));
result.setEndBal(new BigDecimal("110"));
result.setQtdDr(new BigDecimal("110"));
result.setQtdCr(new BigDecimal("110"));
result.setYtdDr(new BigDecimal("110"));
result.setYtdCr(new BigDecimal("110"));
result.setBegBalBeq(new BigDecimal("110"));
result.setPeriodDrBeq(new BigDecimal("110"));
result.setPeriodCrBeq(new BigDecimal("110"));
result.setEndBalBeq(new BigDecimal("110"));
result.setQtdDrBeq(new BigDecimal("110"));
result.setQtdCrBeq(new BigDecimal("110"));
result.setYtdDrBeq(new BigDecimal("110"));
result.setYtdCrBeq(new BigDecimal("110"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateCF() {
List<CashFlowQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
CashFlowQueryDto result = new CashFlowQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目中文名称");
result.setItemName2("项目英文名称");
result.setPeriodAmt(new BigDecimal("1000.0454"));
result.setYtdAmt(new BigDecimal("1000.0454"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBS() {
List<BalanceSheetQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetQueryDto result = new BalanceSheetQueryDto();
result.setDate(new Date());
result.setPeriod(201812);
result.setStatus("关账标识");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBSprc() {
List<BalanceSheetPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetPrcQueryDto result = new BalanceSheetPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201804);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePL() {
List<ProfitLossStatementQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementQueryDto result = new ProfitLossStatementQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201904);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePLprc() {
List<ProfitLossStatementPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementPrcQueryDto result = new ProfitLossStatementPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201905);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateOAR() {
List<OrganizationAccountingRateQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
OrganizationAccountingRateQueryDto result = new OrganizationAccountingRateQueryDto();
result.setPeriod(2018);
result.setConvertionType("汇率类型名称");
result.setCurrencyFrom("原币种");
result.setCurrencyTo("目标币种");
result.setStartDate(new Date());
result.setEndDate(new Date());
result.setRate(3.4f);
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import org.junit.Test;
import pwc.taxtech.atms.CommonIT;
import pwc.taxtech.atms.dto.ebsdto.*;
import pwc.taxtech.atms.service.EbsApiService;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class EbsApiServiceImplTest extends CommonIT {
@Resource
private EbsApiService ebsApiService;
@Resource
private DistributedIdService distributedIdService;
@Test
public void queryRemoteServerThenUpdateJE(){
List<JournalEntryQueryDto> items=new ArrayList<>();
for(int i=0;i<10;i++){
JournalEntryQueryDto journalEntryQueryDto =new JournalEntryQueryDto();
journalEntryQueryDto.setId(distributedIdService.nextId());
journalEntryQueryDto.setOrganizationId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setProjectId("44250A49-F3EF-4A1E-89E0-165BB89A94D0");
journalEntryQueryDto.setDate(new Date());
journalEntryQueryDto.setSource("来源");
journalEntryQueryDto.setLedgerId("账套ID");
journalEntryQueryDto.setLedgerName("账套名称");
journalEntryQueryDto.setCurrencyCode("账套币种");
journalEntryQueryDto.setStatus("关账标识");
journalEntryQueryDto.setHeaderId("日记账头ID");
journalEntryQueryDto.setLineNum("日记账行号");
journalEntryQueryDto.setApprovalStatus("审批状态");
journalEntryQueryDto.setPostedStatus("过账");
journalEntryQueryDto.setPeriod(20180102+i);
journalEntryQueryDto.setAccountingDate(new Date());
journalEntryQueryDto.setJournalSource("日记账来源");
journalEntryQueryDto.setCategory("日记账类别");
journalEntryQueryDto.setName("日记账名称");
journalEntryQueryDto.setVoucherNum("凭证编号");
journalEntryQueryDto.setDescription("摘要");
journalEntryQueryDto.setSegment1("主体代码");
journalEntryQueryDto.setSegment2("成本中心");
journalEntryQueryDto.setSegment3("科目代码");
journalEntryQueryDto.setSegment4("辅助科目");
journalEntryQueryDto.setSegment5("利润中心");
journalEntryQueryDto.setSegment6("产品");
journalEntryQueryDto.setSegment7("项目");
journalEntryQueryDto.setSegment8("公司间");
journalEntryQueryDto.setSegment9("备用1");
journalEntryQueryDto.setSegment10("备用2");
journalEntryQueryDto.setSegment1Name("主体说明");
journalEntryQueryDto.setSegment2Name("成本中心说明");
journalEntryQueryDto.setSegment3Name("科目说明");
journalEntryQueryDto.setSegment4Name("辅助科目说明");
journalEntryQueryDto.setSegment5Name("利润中心说明");
journalEntryQueryDto.setSegment6Name("产品说明");
journalEntryQueryDto.setSegment7Name("项目说明");
journalEntryQueryDto.setSegment8Name("公司间说明");
journalEntryQueryDto.setSegment9Name("备用1说明");
journalEntryQueryDto.setSegment10Name("备用2说明");
journalEntryQueryDto.setJournalCurrencyCode("币种");
journalEntryQueryDto.setSobCurrencyCode("本位币币种");
journalEntryQueryDto.setAccountedDr(new BigDecimal("123"));
journalEntryQueryDto.setAccountedCr(new BigDecimal("120.2"));
journalEntryQueryDto.setEnteredDr(new BigDecimal("1231.0231"));
journalEntryQueryDto.setEnteredCr(new BigDecimal("120.122"));
journalEntryQueryDto.setCfItem("现金流量表项");
journalEntryQueryDto.setAttribute1("城市");
journalEntryQueryDto.setAttribute2(new Date());
journalEntryQueryDto.setAttribute3("对方银行账号");
journalEntryQueryDto.setAttribute4("银行流水号");
journalEntryQueryDto.setAttribute5("供应商编号");
journalEntryQueryDto.setAttribute6("交易单号");
journalEntryQueryDto.setAttribute7("供应商名称");
journalEntryQueryDto.setAttribute8("接收编码");
journalEntryQueryDto.setAttribute9("制单人");
journalEntryQueryDto.setAttribute10("审核人");
journalEntryQueryDto.setAttribute11("成本中心部门描述1");
journalEntryQueryDto.setAttribute12("成本中心部门描述2");
journalEntryQueryDto.setAttribute13("成本中心部门描述3");
journalEntryQueryDto.setAttribute14("成本中心部门描述4");
journalEntryQueryDto.setAttribute15("成本中心部门描述5");
journalEntryQueryDto.setAttribute16("成本中心部门描述6");
items.add(journalEntryQueryDto);
}
String a=JSON.toJSONString(items);
System.out.println(a);
//ebsApiService.queryRemoteServerThenUpdateJE(items);
}
@Test
public void queryRemoteServerThenUpdateOrg(){
List<OrganizationQueryDto> items = Lists.newArrayList();
for(int i=0;i<2;i++){
OrganizationQueryDto dto = new OrganizationQueryDto();
dto.setTaxPayerNumber("sadsafsdf3232");
dto.setCode("ceshi0009");
dto.setName("测试成功");
dto.setEnterpriseAccountCode("test");
dto.setLegalPersonName("周杰伦");
dto.setRegistrationCapital("100万");
dto.setPaidInCapital("200万");
dto.setLegalPersonPhoneNumber("1239512312");
dto.setLegalPersonLandlineNum("1234678");
dto.setLegalPersonEmailAddress("didi@qq.com");
dto.setRegFinancialOfficerName("周杰伦");
dto.setRegFinancialOfficerPhoneNum("123141231");
dto.setRegFinancialOfficerLandlineNum("123213124");
dto.setRegFinancialOfficerEmailAddress("滴滴大厦");
dto.setCurrencyCode("CNY");
dto.setRegisterAddress("滴滴大厦");
dto.setParentName("滴滴测试");
dto.setStaffSize(12345);
items.add(dto);
}
String res=JSON.toJSONString(items);
System.out.println(res);
// ebsApiService.queryRemoteServerThenUpdateOrg(items);
}
@Test
public void queryRemoteServerThenUpdateTB() {
List<TrialBalanceQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
TrialBalanceQueryDto result = new TrialBalanceQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setCurrencyCode("账套币种");
result.setStatus("关账标识");
result.setCategory("主体性质");
result.setAccountCategory("科目性质");
result.setAcctCode1("一级科目代码");
result.setAcctName1("一级科目说明");
result.setAcctName2("二级科目说明");
result.setAcctName3("三级科目说明");
result.setSegment1("主体代码");
result.setSegment2("成本中心代码");
result.setSegment3("科目代码");
result.setSegment4("辅助科目代码");
result.setSegment5("利润中心代码");
result.setSegment6("产品代码");
result.setSegment7("项目代码");
result.setSegment8("公司间代码");
result.setSegment9("备用1代码");
result.setSegment10("备用2代码");
result.setSegment1Name("主体说明");
result.setSegment2Name("成本中心说明");
result.setSegment3Name("科目说明");
result.setSegment4Name("辅助科目说明");
result.setSegment5Name("利润中心说明");
result.setSegment6Name("产品说明");
result.setSegment7Name("项目说明");
result.setSegment8Name("公司间说明");
result.setSegment9Name("备用1说明");
result.setSegment10Name("备用2说明");
result.setBegBal(new BigDecimal("110"));
result.setPeriodDr(new BigDecimal("110"));
result.setPeriodCr(new BigDecimal("110"));
result.setEndBal(new BigDecimal("110"));
result.setQtdDr(new BigDecimal("110"));
result.setQtdCr(new BigDecimal("110"));
result.setYtdDr(new BigDecimal("110"));
result.setYtdCr(new BigDecimal("110"));
result.setBegBalBeq(new BigDecimal("110"));
result.setPeriodDrBeq(new BigDecimal("110"));
result.setPeriodCrBeq(new BigDecimal("110"));
result.setEndBalBeq(new BigDecimal("110"));
result.setQtdDrBeq(new BigDecimal("110"));
result.setQtdCrBeq(new BigDecimal("110"));
result.setYtdDrBeq(new BigDecimal("110"));
result.setYtdCrBeq(new BigDecimal("110"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateCF() {
List<CashFlowQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
CashFlowQueryDto result = new CashFlowQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201803);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目中文名称");
result.setItemName2("项目英文名称");
result.setPeriodAmt(new BigDecimal("1000.0454"));
result.setYtdAmt(new BigDecimal("1000.0454"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBS() {
List<BalanceSheetQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetQueryDto result = new BalanceSheetQueryDto();
result.setDate(new Date());
result.setPeriod(201812);
result.setStatus("关账标识");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateBSprc() {
List<BalanceSheetPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
BalanceSheetPrcQueryDto result = new BalanceSheetPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201804);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setEndBal(new BigDecimal("1220.2980"));
result.setBegBal(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePL() {
List<ProfitLossStatementQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementQueryDto result = new ProfitLossStatementQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201904);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdatePLprc() {
List<ProfitLossStatementPrcQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
ProfitLossStatementPrcQueryDto result = new ProfitLossStatementPrcQueryDto();
result.setDate(new Date());
result.setSource("来源");
result.setPeriod(201905);
result.setStatus("关账标识");
result.setLedgerId("账套ID");
result.setLedgerName("账套名称");
result.setLedgerCurrencyCode("账套币种");
result.setEntityCode("机构编码");
result.setEntityName("机构名称");
result.setCategory("主体性质");
result.setFrequency("频度");
result.setItemName("项目名称");
result.setPeriodAmt(new BigDecimal("1220.2980"));
result.setYtdAmt(new BigDecimal("1220.2980"));
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
@Test
public void queryRemoteServerThenUpdateOAR() {
List<OrganizationAccountingRateQueryDto> items=new ArrayList<>();
for(int i=0;i<2;i++) {
OrganizationAccountingRateQueryDto result = new OrganizationAccountingRateQueryDto();
result.setPeriod(2018);
result.setConvertionType("汇率类型名称");
result.setCurrencyFrom("原币种");
result.setCurrencyTo("目标币种");
result.setStartDate(new Date());
result.setEndDate(new Date());
result.setRate(3.4f);
items.add(result);
}
String a=JSON.toJSONString(items);
System.out.println(a);
}
}
\ No newline at end of file
......@@ -111,6 +111,8 @@ public class OrganizationDto {
private String regStatus;
private String enterpriseAccountCode;
private Date logoutTime;
private Boolean oversea;
......@@ -717,6 +719,14 @@ public class OrganizationDto {
this.taxControlDiskList = taxControlDiskList;
}
public String getEnterpriseAccountCode() {
return enterpriseAccountCode;
}
public void setEnterpriseAccountCode(String enterpriseAccountCode) {
this.enterpriseAccountCode = enterpriseAccountCode;
}
@Override
public int hashCode() {
final int prime = 31;
......
......@@ -21,6 +21,8 @@ public class Organization extends BaseEntity implements Serializable {
private String id;
/**
* Database Column Remarks:
* 目前无实际用途
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column organization.client_code
......@@ -39,6 +41,8 @@ public class Organization extends BaseEntity implements Serializable {
private String name;
/**
* Database Column Remarks:
* 机构代码/机构编码 滴滴项目机构key为这个字段或taxPayerNumber
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column organization.code
......@@ -300,6 +304,8 @@ public class Organization extends BaseEntity implements Serializable {
private String registrationLocation;
/**
* Database Column Remarks:
* 注册资本
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column organization.registration_capital
......@@ -476,6 +482,8 @@ public class Organization extends BaseEntity implements Serializable {
*/
private Boolean engageNationalProhibitIndustry;
private String enterpriseAccountCode;
/**
* Database Column Remarks:
* 注销时间。
......@@ -1723,6 +1731,29 @@ public class Organization extends BaseEntity implements Serializable {
this.logoutTime = logoutTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column organization.enterprise_account_code
*
* @return the value of organization.enterprise_account_code
*
* @mbg.generated
*/
public String getEnterpriseAccountCode() {
return enterpriseAccountCode;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column organization.enterprise_account_code
*
* @param enterpriseAccountCode the value for organization.enterprise_account_code
*
* @mbg.generated
*/
public void setEnterpriseAccountCode(String enterpriseAccountCode) {
this.enterpriseAccountCode = enterpriseAccountCode == null ? null : enterpriseAccountCode.trim();
}
public Area getArea() {
......@@ -1741,6 +1772,7 @@ public class Organization extends BaseEntity implements Serializable {
this.businessUnit = businessUnit;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table organization
......@@ -1803,6 +1835,7 @@ public class Organization extends BaseEntity implements Serializable {
sb.append(", nationalEconomicIndustry=").append(nationalEconomicIndustry);
sb.append(", engageNationalProhibitIndustry=").append(engageNationalProhibitIndustry);
sb.append(", logoutTime=").append(logoutTime);
sb.append(", enterpriseAccountCode=").append(enterpriseAccountCode);
sb.append("]");
return sb.toString();
}
......
......@@ -3544,6 +3544,76 @@ public class OrganizationExample {
addCriterion("logout_time not between", value1, value2, "logoutTime");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeIsNull() {
addCriterion("enterprise_account_code is null");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeIsNotNull() {
addCriterion("enterprise_account_code is not null");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeEqualTo(String value) {
addCriterion("enterprise_account_code =", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeNotEqualTo(String value) {
addCriterion("enterprise_account_code <>", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeGreaterThan(String value) {
addCriterion("enterprise_account_code >", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeGreaterThanOrEqualTo(String value) {
addCriterion("enterprise_account_code >=", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeLessThan(String value) {
addCriterion("enterprise_account_code <", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeLessThanOrEqualTo(String value) {
addCriterion("enterprise_account_code <=", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeLike(String value) {
addCriterion("enterprise_account_code like", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeNotLike(String value) {
addCriterion("enterprise_account_code not like", value, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeIn(List<String> values) {
addCriterion("enterprise_account_code in", values, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeNotIn(List<String> values) {
addCriterion("enterprise_account_code not in", values, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeBetween(String value1, String value2) {
addCriterion("enterprise_account_code between", value1, value2, "enterpriseAccountCode");
return (Criteria) this;
}
public Criteria andEnterpriseAccountCodeNotBetween(String value1, String value2) {
addCriterion("enterprise_account_code not between", value1, value2, "enterpriseAccountCode");
return (Criteria) this;
}
}
/**
......
......@@ -56,6 +56,7 @@
<result column="national_economic_industry" jdbcType="VARCHAR" property="nationalEconomicIndustry" />
<result column="engage_national_prohibit_industry" jdbcType="BIT" property="engageNationalProhibitIndustry" />
<result column="logout_time" jdbcType="TIMESTAMP" property="logoutTime" />
<result column="enterprise_account_code" jdbcType="VARCHAR" property="enterpriseAccountCode" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -137,7 +138,7 @@
legal_code, vehicleroutinglocation, business_scope, architecture_type, num_of_branches,
api_update_flag, effec_time_of_general_taxpayers, registration_location_en, paid_in_capital,
general_tax_payer_effective_time, oversea, reg_status, national_economic_industry,
engage_national_prohibit_industry, logout_time
engage_national_prohibit_industry, logout_time, enterprise_account_code
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.entity.OrganizationExample" resultMap="BaseResultMap">
<!--
......@@ -208,7 +209,7 @@
registration_location_en, paid_in_capital,
general_tax_payer_effective_time, oversea, reg_status,
national_economic_industry, engage_national_prohibit_industry,
logout_time)
logout_time, enterprise_account_code)
values (#{id,jdbcType=VARCHAR}, #{clientCode,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{code,jdbcType=VARCHAR}, #{parentId,jdbcType=VARCHAR}, #{taxPayerNumber,jdbcType=VARCHAR},
#{regionId,jdbcType=VARCHAR}, #{structureId,jdbcType=VARCHAR}, #{industryId,jdbcType=VARCHAR},
......@@ -227,7 +228,7 @@
#{registrationLocationEn,jdbcType=VARCHAR}, #{paidInCapital,jdbcType=VARCHAR},
#{generalTaxPayerEffectiveTime,jdbcType=TIMESTAMP}, #{oversea,jdbcType=BIT}, #{regStatus,jdbcType=VARCHAR},
#{nationalEconomicIndustry,jdbcType=VARCHAR}, #{engageNationalProhibitIndustry,jdbcType=BIT},
#{logoutTime,jdbcType=TIMESTAMP})
#{logoutTime,jdbcType=TIMESTAMP}, #{enterpriseAccountCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.Organization">
<!--
......@@ -386,6 +387,9 @@
<if test="logoutTime != null">
logout_time,
</if>
<if test="enterpriseAccountCode != null">
enterprise_account_code,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -538,6 +542,9 @@
<if test="logoutTime != null">
#{logoutTime,jdbcType=TIMESTAMP},
</if>
<if test="enterpriseAccountCode != null">
#{enterpriseAccountCode,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.entity.OrganizationExample" resultType="java.lang.Long">
......@@ -707,6 +714,9 @@
<if test="record.logoutTime != null">
logout_time = #{record.logoutTime,jdbcType=TIMESTAMP},
</if>
<if test="record.enterpriseAccountCode != null">
enterprise_account_code = #{record.enterpriseAccountCode,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -767,7 +777,8 @@
reg_status = #{record.regStatus,jdbcType=VARCHAR},
national_economic_industry = #{record.nationalEconomicIndustry,jdbcType=VARCHAR},
engage_national_prohibit_industry = #{record.engageNationalProhibitIndustry,jdbcType=BIT},
logout_time = #{record.logoutTime,jdbcType=TIMESTAMP}
logout_time = #{record.logoutTime,jdbcType=TIMESTAMP},
enterprise_account_code = #{record.enterpriseAccountCode,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -791,9 +802,6 @@
<if test="parentId != null">
parent_id = #{parentId,jdbcType=VARCHAR},
</if>
<if test="parentId == null">
parent_id = NULL,
</if>
<if test="taxPayerNumber != null">
tax_payer_number = #{taxPayerNumber,jdbcType=VARCHAR},
</if>
......@@ -929,6 +937,9 @@
<if test="logoutTime != null">
logout_time = #{logoutTime,jdbcType=TIMESTAMP},
</if>
<if test="enterpriseAccountCode != null">
enterprise_account_code = #{enterpriseAccountCode,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
......@@ -986,7 +997,8 @@
reg_status = #{regStatus,jdbcType=VARCHAR},
national_economic_industry = #{nationalEconomicIndustry,jdbcType=VARCHAR},
engage_national_prohibit_industry = #{engageNationalProhibitIndustry,jdbcType=BIT},
logout_time = #{logoutTime,jdbcType=TIMESTAMP}
logout_time = #{logoutTime,jdbcType=TIMESTAMP},
enterprise_account_code = #{enterpriseAccountCode,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entity.OrganizationExample" resultMap="BaseResultMap">
......
......@@ -186,12 +186,12 @@
"EnterpriseAccountErrorCodeList": "科目代码明细",
"EnterpriseAccountImportDataFormatError": "企业科目导入数据格式有误",
"EnterpriseAccountList": "企业科目列表",
"EnterpriseAccountManage": "账套管理",
"EnterpriseAccountManage": "科目表管理",
"EnterpriseAccountName": "企业科目名称",
"EnterpriseAccountNameEmpty": "企业科目名字为空",
"EnterpriseAccountNameMaxLength": "企业科目名称过长",
"EnterpriseAccountNameRequired": "请输入企业科目名称",
"EnterpriseAccountNameShort": "账套名",
"EnterpriseAccountNameShort": "科目表名",
"EnterpriseAccountParentDisable": "请先启用父节点",
"EnterpriseAccountRepeat": "企业科目代码已经存在",
"EnterpriseAccountSetCode": "账套代码",
......
......@@ -7,10 +7,17 @@ controller('editUserModalController', ['$scope', '$log', '$translate', 'uiGridCo
$scope.isAdd = true;
$scope.editUserModel = {};
$scope.editUserModel.isAdmin = false;
//按滴滴需求设置用户所属机构默认为滴滴集团
$scope.editUserModel.OrganizationID = "BCFA0E77-9F6B-42B3-A486-A003536832CF";
$scope.editUserModel.orgName = "滴滴集团";
resetErrorStatus();
$('.edit-user-modal-wrapper .modal').modal('show');
};
// loadUser
var loadUser = function(userId) {
$scope.isAdd = false;
......@@ -40,11 +47,11 @@ controller('editUserModalController', ['$scope', '$log', '$translate', 'uiGridCo
hasError = true;
}
if (!$scope.editUserModel.OrganizationID) {
/*if (!$scope.editUserModel.OrganizationID) {
$scope.editUserModel.organizationIDError = $translate.instant('SelectOrg');
$('#dropdownMenu1').addClass('error-button');
hasError = true;
}
}*/
// if (!$scope.editUserModel.isAdmin) {
if (!$scope.editUserModel.RoleIDs || $scope.editUserModel.RoleIDs.length === 0) {
......@@ -268,6 +275,7 @@ controller('editUserModalController', ['$scope', '$log', '$translate', 'uiGridCo
//Disable user
$scope.disableUser = disableUser;
})();
}
]);
......@@ -34,9 +34,10 @@
<div class="form-group">
<label class="control-label col-sm-3"><span class="red-color">*</span><span translate="Company"></label>
<div class="col-sm-9">
<org-selector selected-org-name="editUserModel.OrgName" selected-org-id="editUserModel.OrganizationID" component-selected-org="" is-show-all="false" is-require="true"
<input id="orgName" type="text" name="orgName" maxlength="100" class="form-control" style="width: 300px;" ng-model="editUserModel.orgName" required>
<!--<org-selector selected-org-name="editUserModel.OrgName" selected-org-id="editUserModel.OrganizationID" component-selected-org="" is-show-all="false" is-require="true"
style="width: 300px;"></org-selector>
<label class="error-label" style="font-size:12px;" ng-show="editUserModel.organizationIDError">{{editUserModel.organizationIDError}}</label>
<label class="error-label" style="font-size:12px;" ng-show="editUserModel.organizationIDError">{{editUserModel.organizationIDError}}</label>-->
</div>
</div>
<div class="form-group">
......
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