Commit ec72a43d authored by frank.xa.zhang's avatar frank.xa.zhang

add apis for report configuration function

parent 8622b313
package pwc.taxtech.atms.constant.enums;
public enum ApplyScope {
FinancialStatement(1),
TaxReturn (2),
AnalyticsModel (3);
private Integer code;
ApplyScope(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
......@@ -53,4 +53,10 @@ public class CellTemplateController {
return new OperationResultDto<>();
}
@RequestMapping(value = "config",method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto PostConfig(@RequestBody CellTemplateConfigDto cellTemplateConfigDto){
return cellTemplateService.saveOrEdit(cellTemplateConfigDto);
}
}
......@@ -31,7 +31,7 @@ public class RuleEngineeConfigController {
@RequestMapping(value = "taxPayerReportMapping", method = RequestMethod.GET)
public @ResponseBody List<TaxPayerReportRuleDto> GetTaxPayerReportMapping() {
logger.debug("RuleEngineeConfigController GetTaxPayerReportMapping");
return ruleEngineeConfigService.GetTaxPayerReportMapping();
return ruleEngineeConfigService.getTaxPayerReportMapping();
}
@ApiOperation(value="Get TaxRuleSetting",notes="Return TaxRuleSetting")
......@@ -39,7 +39,7 @@ public class RuleEngineeConfigController {
public @ResponseBody List<TaxRuleSettingDto> GetTaxRuleSetting()
{
logger.debug("RuleEngineeConfigController GetTaxRuleSetting");
return ruleEngineeConfigService.GetTaxRuleSetting();
return ruleEngineeConfigService.getTaxRuleSetting();
}
@ApiOperation(value="",notes="")
......
......@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.service.TemplateGroupService;
......@@ -22,16 +23,23 @@ public class TemplateGroupController {
@ApiOperation(value = "获取所有的模板分组")
@RequestMapping(value = "getall", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<TemplateGroupDto> Get() {
List<TemplateGroupDto> get() {
logger.debug("TemplateGroupController Get");
return templateGroupService.Get();
return templateGroupService.get();
}
@ApiOperation(value = "根据服务类型和行业获取模板分组")
@RequestMapping(value = "getByIndustry/{serviceTypeID}/{industryID}",method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "getByIndustry/{serviceTypeID}/{industryID}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
List<TemplateGroupDto> getTemplateGroupByIndustry(@PathVariable int serviceTypeID, @RequestParam Integer taxPayType, @PathVariable String industryID) {
return templateGroupService.Get(serviceTypeID, taxPayType, industryID);
return templateGroupService.get(serviceTypeID, taxPayType, industryID);
}
@RequestMapping(value = "updateTemplateGroupName", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody
OperationResultDto<Object> updateTemplateGroupName(TemplateGroupDto templateGroupDto) {
return templateGroupService.updateTemplateGroupName(templateGroupDto);
}
}
package pwc.taxtech.atms.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
......@@ -9,6 +8,9 @@ import pwc.taxtech.atms.dto.ModelProfileDto;
import pwc.taxtech.atms.entitiy.ModelConfig;
import pwc.taxtech.atms.entitiy.ModelConfigExample;
import java.util.List;
import java.util.Map;
@Mapper
public interface ModelConfigMapper extends MyMapper {
/**
......@@ -107,5 +109,5 @@ public interface ModelConfigMapper extends MyMapper {
*/
int updateByPrimaryKey(ModelConfig record);
List<ModelProfileDto> GetModelListByIndustry(@Param("serviceTypeID")String serviceTypeID, @Param("industryID")String industryID);
List<ModelProfileDto> GetModelListByIndustry(Map<String,Object> map);
}
\ No newline at end of file
......@@ -4,274 +4,275 @@ import java.util.List;
public class CellTemplateConfigDto {
private String CellTemplateID;
private String TemplateID;
private int RowIndex;
private String RowName;
private int ColumnIndex;
private String ColumnName;
private Integer DataType;
private Integer IsReadOnly;
private boolean HasFormula;
private String Formula;
private String ParsedFormula;
private String FormulaDescription;
private boolean HasVoucher;
private List<String> AccountCodes;
private boolean HasInvoice;
private Integer InvoiceType;
private List<String> TaxRate;
private boolean HasKeyIn;
private String Creator;
private String Updater;
private Integer InvoiceAmountType;
private boolean HasModel;
private List<String> ModelIDs;
private List<Integer> InvoiceCategory;
private String FormulaDataSource;
private boolean HasValidation;
private String Validation;
private String ParsedValidation;
private String ValidationDescription;
private String VoucherKeyword;
private String cellTemplateID;
private String templateID;
private int rowIndex;
private String rowName;
private int columnIndex;
private String columnName;
private Integer dataType;
private Integer isReadOnly;
private boolean hasFormula;
private String formula;
private String parsedFormula;
private String formulaDescription;
private boolean hasVoucher;
private List<String> accountCodes;
private boolean hasInvoice;
private Integer invoiceType;
private List<String> taxRate;
private boolean hasKeyIn;
private String creator;
private String updater;
private Integer invoiceAmountType;
private boolean hasModel;
private List<String> modelIDs;
private List<Integer> invoiceCategory;
private String formulaDataSource;
private boolean hasValidation;
private String validation;
private String parsedValidation;
private String validationDescription;
private String voucherKeyword;
public String getCellTemplateID() {
return CellTemplateID;
return cellTemplateID;
}
public void setCellTemplateID(String cellTemplateID) {
CellTemplateID = cellTemplateID;
this.cellTemplateID = cellTemplateID;
}
public String getTemplateID() {
return TemplateID;
return templateID;
}
public void setTemplateID(String templateID) {
TemplateID = templateID;
this.templateID = templateID;
}
public int getRowIndex() {
return RowIndex;
return rowIndex;
}
public void setRowIndex(int rowIndex) {
RowIndex = rowIndex;
this.rowIndex = rowIndex;
}
public String getRowName() {
return RowName;
return rowName;
}
public void setRowName(String rowName) {
RowName = rowName;
this.rowName = rowName;
}
public int getColumnIndex() {
return ColumnIndex;
return columnIndex;
}
public void setColumnIndex(int columnIndex) {
ColumnIndex = columnIndex;
this.columnIndex = columnIndex;
}
public String getColumnName() {
return ColumnName;
return columnName;
}
public void setColumnName(String columnName) {
ColumnName = columnName;
this.columnName = columnName;
}
public Integer getDataType() {
return DataType;
return dataType;
}
public void setDataType(Integer dataType) {
DataType = dataType;
this.dataType = dataType;
}
public Integer getIsReadOnly() {
return IsReadOnly;
return isReadOnly;
}
public void setIsReadOnly(Integer isReadOnly) {
IsReadOnly = isReadOnly;
this.isReadOnly = isReadOnly;
}
public boolean isHasFormula() {
return HasFormula;
public boolean getHasFormula() {
return hasFormula;
}
public void setHasFormula(boolean hasFormula) {
HasFormula = hasFormula;
this.hasFormula = hasFormula;
}
public String getFormula() {
return Formula;
return formula;
}
public void setFormula(String formula) {
Formula = formula;
this.formula = formula;
}
public String getParsedFormula() {
return ParsedFormula;
return parsedFormula;
}
public void setParsedFormula(String parsedFormula) {
ParsedFormula = parsedFormula;
this.parsedFormula = parsedFormula;
}
public String getFormulaDescription() {
return FormulaDescription;
return formulaDescription;
}
public void setFormulaDescription(String formulaDescription) {
FormulaDescription = formulaDescription;
this.formulaDescription = formulaDescription;
}
public boolean isHasVoucher() {
return HasVoucher;
public boolean getHasVoucher() {
return hasVoucher;
}
public void setHasVoucher(boolean hasVoucher) {
HasVoucher = hasVoucher;
this.hasVoucher = hasVoucher;
}
public List<String> getAccountCodes() {
return AccountCodes;
return accountCodes;
}
public void setAccountCodes(List<String> accountCodes) {
AccountCodes = accountCodes;
this.accountCodes = accountCodes;
}
public boolean isHasInvoice() {
return HasInvoice;
public boolean getHasInvoice() {
return hasInvoice;
}
public void setHasInvoice(boolean hasInvoice) {
HasInvoice = hasInvoice;
this.hasInvoice = hasInvoice;
}
public Integer getInvoiceType() {
return InvoiceType;
return invoiceType;
}
public void setInvoiceType(Integer invoiceType) {
InvoiceType = invoiceType;
this.invoiceType = invoiceType;
}
public List<String> getTaxRate() {
return TaxRate;
return taxRate;
}
public void setTaxRate(List<String> taxRate) {
TaxRate = taxRate;
this.taxRate = taxRate;
}
public boolean isHasKeyIn() {
return HasKeyIn;
public boolean getHasKeyIn() {
return hasKeyIn;
}
public void setHasKeyIn(boolean hasKeyIn) {
HasKeyIn = hasKeyIn;
this.hasKeyIn = hasKeyIn;
}
public String getCreator() {
return Creator;
return creator;
}
public void setCreator(String creator) {
Creator = creator;
this.creator = creator;
}
public String getUpdater() {
return Updater;
return updater;
}
public void setUpdater(String updater) {
Updater = updater;
this.updater = updater;
}
public Integer getInvoiceAmountType() {
return InvoiceAmountType;
return invoiceAmountType;
}
public void setInvoiceAmountType(Integer invoiceAmountType) {
InvoiceAmountType = invoiceAmountType;
this.invoiceAmountType = invoiceAmountType;
}
public boolean isHasModel() {
return HasModel;
public boolean getHasModel() {
return hasModel;
}
public void setHasModel(boolean hasModel) {
HasModel = hasModel;
this.hasModel = hasModel;
}
public List<String> getModelIDs() {
return ModelIDs;
return modelIDs;
}
public void setModelIDs(List<String> modelIDs) {
ModelIDs = modelIDs;
this.modelIDs = modelIDs;
}
public List<Integer> getInvoiceCategory() {
return InvoiceCategory;
return invoiceCategory;
}
public void setInvoiceCategory(List<Integer> invoiceCategory) {
InvoiceCategory = invoiceCategory;
this.invoiceCategory = invoiceCategory;
}
public String getFormulaDataSource() {
return FormulaDataSource;
return formulaDataSource;
}
public void setFormulaDataSource(String formulaDataSource) {
FormulaDataSource = formulaDataSource;
this.formulaDataSource = formulaDataSource;
}
public boolean isHasValidation() {
return HasValidation;
public boolean getHasValidation() {
return hasValidation;
}
public void setHasValidation(boolean hasValidation) {
HasValidation = hasValidation;
this.hasValidation = hasValidation;
}
public String getValidation() {
return Validation;
return validation;
}
public void setValidation(String validation) {
Validation = validation;
this.validation = validation;
}
public String getParsedValidation() {
return ParsedValidation;
return parsedValidation;
}
public void setParsedValidation(String parsedValidation) {
ParsedValidation = parsedValidation;
this.parsedValidation = parsedValidation;
}
public String getValidationDescription() {
return ValidationDescription;
return validationDescription;
}
public void setValidationDescription(String validationDescription) {
ValidationDescription = validationDescription;
this.validationDescription = validationDescription;
}
public String getVoucherKeyword() {
return VoucherKeyword;
return voucherKeyword;
}
public void setVoucherKeyword(String voucherKeyword) {
VoucherKeyword = voucherKeyword;
this.voucherKeyword = voucherKeyword;
}
}
......@@ -5,18 +5,18 @@ import java.util.Map;
public class KeyValueConfigDisplayDto {
private String ID;
private String KeyCode;
private String Name;
private String Formula;
private String Description;
private String ScopeSummary;
private String ServiceTypes;
private String Industrys;
private List<String> ServiceTypeIds;
private List<String> IndustryIds;
private Integer KeyValueType;
private String DataSource;
private Map<Integer, Integer> ScopeCount;
private String keyCode;
private String name;
private String formula;
private String description;
private String scopeSummary;
private String serviceTypes;
private String industrys;
private List<String> serviceTypeIds;
private List<String> industryIds;
private Integer keyValueType;
private String dataSource;
private Map<Integer, Integer> scopeCount;
public String getID() {
return ID;
......@@ -26,99 +26,100 @@ public class KeyValueConfigDisplayDto {
this.ID = ID;
}
public String getKeyCode() {
return KeyCode;
return keyCode;
}
public void setKeyCode(String keyCode) {
KeyCode = keyCode;
this.keyCode = keyCode;
}
public String getName() {
return Name;
return name;
}
public void setName(String name) {
Name = name;
this.name = name;
}
public String getFormula() {
return Formula;
return formula;
}
public void setFormula(String formula) {
Formula = formula;
this.formula = formula;
}
public String getDescription() {
return Description;
return description;
}
public void setDescription(String description) {
Description = description;
this.description = description;
}
public String getScopeSummary() {
return ScopeSummary;
return scopeSummary;
}
public void setScopeSummary(String scopeSummary) {
ScopeSummary = scopeSummary;
this.scopeSummary = scopeSummary;
}
public String getServiceTypes() {
return ServiceTypes;
return serviceTypes;
}
public void setServiceTypes(String serviceTypes) {
ServiceTypes = serviceTypes;
this.serviceTypes = serviceTypes;
}
public String getIndustrys() {
return Industrys;
return industrys;
}
public void setIndustrys(String industrys) {
Industrys = industrys;
this.industrys = industrys;
}
public List<String> getServiceTypeIds() {
return ServiceTypeIds;
return serviceTypeIds;
}
public void setServiceTypeIds(List<String> serviceTypeIds) {
ServiceTypeIds = serviceTypeIds;
this.serviceTypeIds = serviceTypeIds;
}
public List<String> getIndustryIds() {
return IndustryIds;
return industryIds;
}
public void setIndustryIds(List<String> industryIds) {
IndustryIds = industryIds;
this.industryIds = industryIds;
}
public Integer getKeyValueType() {
return KeyValueType;
return keyValueType;
}
public void setKeyValueType(Integer keyValueType) {
KeyValueType = keyValueType;
this.keyValueType = keyValueType;
}
public String getDataSource() {
return DataSource;
return dataSource;
}
public void setDataSource(String dataSource) {
DataSource = dataSource;
this.dataSource = dataSource;
}
public Map<Integer, Integer> getScopeCount() {
return ScopeCount;
return scopeCount;
}
public void setScopeCount(Map<Integer, Integer> scopeCount) {
ScopeCount = scopeCount;
this.scopeCount = scopeCount;
}
}
......@@ -9,4 +9,6 @@ public interface CellTemplateService {
OperationResultDto<List<CellTemplateConfigDto>> getCellConfigList(String templateID);
OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID);
OperationResultDto saveOrEdit(CellTemplateConfigDto cellTemplateConfig);
}
......@@ -7,9 +7,9 @@ import pwc.taxtech.atms.dto.TaxPayerReportRuleDto;
import pwc.taxtech.atms.dto.TaxRuleSettingDto;
public interface RuleEngineeConfigService {
List<TaxPayerReportRuleDto> GetTaxPayerReportMapping();
List<TaxPayerReportRuleDto> getTaxPayerReportMapping();
List<TaxRuleSettingDto> GetTaxRuleSetting();
List<TaxRuleSettingDto> getTaxRuleSetting();
void savetaxrulesettings(BatchUpdateTaxRuleDto batchUpdateTaxRule);
}
package pwc.taxtech.atms.service;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto;
import java.util.List;
public interface TemplateGroupService {
List<TemplateGroupDto> Get();
List<TemplateGroupDto> get();
List<TemplateGroupDto> Get(int serviceTypeID, Integer taxPayType, String industryID);
List<TemplateGroupDto> get(int serviceTypeID, Integer taxPayType, String industryID);
OperationResultDto<Object> updateTemplateGroupName(TemplateGroupDto templateGroupDto);
}
......@@ -121,4 +121,6 @@ public class AbstractService {
protected TemplateMapper templateMapper;
@Autowired
protected TemplateFormulaMapper templateFormulaMapper;
@Autowired
protected FormulaConfigMapper formulaConfigMapper;
}
package pwc.taxtech.atms.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.CellTemplateMapper;
import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.ApplyScope;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.enums.CellDataSourceType;
import pwc.taxtech.atms.dto.CellTemplateConfigDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entitiy.CellTemplate;
import pwc.taxtech.atms.entitiy.CellTemplateConfig;
import pwc.taxtech.atms.entitiy.CellTemplateConfigExample;
import pwc.taxtech.atms.entitiy.CellTemplateExample;
import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.service.CellTemplateService;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
......@@ -47,23 +49,19 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
@Override
public OperationResultDto<CellTemplateConfigDto> getCellConfig(String cellTemplateID) {
OperationResultDto<CellTemplateConfigDto> result = new OperationResultDto<>();
CellTemplate config = cellTemplateMapper.selectByPrimaryKey(cellTemplateID);
if (config.equals(null)) {
if (config == null) {
result.setResultMsg("NoData");
return result;
}
CellTemplateConfigExample example = new CellTemplateConfigExample();
example.createCriteria().andCellTemplateIDEqualTo(cellTemplateID);
List<CellTemplateConfig> configList = cellTemplateConfigMapper.selectByExample(example);
result.setData(GetConfigDto(config, configList));
if (result.getData().equals(null)) {
if (result.getData() == null) {
result.setResultMsg("NoData");
return result;
}
......@@ -72,6 +70,219 @@ public class CellTemplateServiceImpl extends AbstractService implements CellTemp
return result;
}
@Override
@Transactional
public OperationResultDto saveOrEdit(CellTemplateConfigDto cellTemplateConfig) {
OperationResultDto result = new OperationResultDto();
CellTemplate cellTemplate = cellTemplateMapper.selectByPrimaryKey(cellTemplateConfig.getCellTemplateID());
if (cellTemplate == null) {
result.setResultMsg("Nodata");
return result;
}
cellTemplate.setComment(cellTemplateConfig.getFormulaDescription());
cellTemplate.setRowName(cellTemplateConfig.getRowName());
cellTemplate.setColumnName(cellTemplateConfig.getColumnName());
CellTemplateConfigExample example = new CellTemplateConfigExample();
example.createCriteria().andCellTemplateIDEqualTo(cellTemplateConfig.getCellTemplateID());
List<CellTemplateConfig> cellTemplateConfigs = cellTemplateConfigMapper.selectByExample(example);
if (!cellTemplateConfigs.isEmpty()) {
for (CellTemplateConfig templateConfig : cellTemplateConfigs) {
cellTemplateConfigMapper.deleteByPrimaryKey(templateConfig.getID());
}
}
List<String> keyValues = new ArrayList<>();
OperationResultDto<List<CellTemplateConfig>> configResult = GetConfigList(cellTemplateConfig, keyValues);
if (configResult.getResult()) {
configResult.getData().forEach(a -> cellTemplateConfigMapper.insert(a));
}
if (keyValues != null && keyValues.size() > 0) {
keyValues.forEach(a -> {
KeyValueReference keyValueReferenceData = new KeyValueReference();
keyValueReferenceData.setID(CommonUtils.getUUID());
keyValueReferenceData.setKeyValueConfigID(a);
keyValueReferenceData.setScope(ApplyScope.TaxReturn.value());
keyValueReferenceData.setCellTemplateID(cellTemplate.getID());
keyValueReferenceMapper.insert(keyValueReferenceData);
});
}
result.setResult(true);
result.setResultMsg(configResult.getResultMsg());
return result;
}
private OperationResultDto<List<CellTemplateConfig>> GetConfigList(CellTemplateConfigDto cellTemplateConfigDto, List<String> keyValueIds) {
OperationResultDto<List<CellTemplateConfig>> operationResultDto = new OperationResultDto<>();
List<CellTemplateConfig> cellTemplateConfigList = new ArrayList<>();
if (cellTemplateConfigDto.getHasFormula()) {
operationResultDto.setResultMsg(GetFormulaDataSource(cellTemplateConfigDto.getFormula(), keyValueIds));
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(CellDataSourceType.Formula.getCode());
cellTemplateConfig.setFormulaDataSource(operationResultDto.getResultMsg());
cellTemplateConfig.setFormula(cellTemplateConfigDto.getFormula());
cellTemplateConfig.setFormulaDescription(cellTemplateConfigDto.getFormulaDescription());
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasVoucher()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(CellDataSourceType.Voucher.getCode());
cellTemplateConfig.setVoucherKeyword(cellTemplateConfigDto.getVoucherKeyword());
cellTemplateConfig.setAccountCodes(GetJoinString(cellTemplateConfigDto.getAccountCodes()));
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasInvoice()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(getInvoiceType(cellTemplateConfigDto.getInvoiceType()).getCode());
cellTemplateConfig.setInvoiceType(cellTemplateConfigDto.getInvoiceType());
cellTemplateConfig.setInvoiceAmountType(cellTemplateConfigDto.getInvoiceAmountType());
cellTemplateConfig.setTaxRate(GetJoinString(cellTemplateConfigDto.getTaxRate()));
cellTemplateConfig.setInvoiceCategory(GetJoinString(cellTemplateConfigDto.getInvoiceCategory().stream().map(String::valueOf).collect(Collectors.toList())));
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasKeyIn()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(CellDataSourceType.KeyIn.getCode());
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasModel()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(CellDataSourceType.RelatedModel.getCode());
cellTemplateConfig.setModelIDs(GetJoinString(cellTemplateConfigDto.getModelIDs()));
cellTemplateConfigList.add(cellTemplateConfig);
}
if (cellTemplateConfigDto.getHasValidation()) {
CellTemplateConfig cellTemplateConfig = new CellTemplateConfig();
cellTemplateConfig.setID(CommonUtils.getUUID());
cellTemplateConfig.setCellTemplateID(cellTemplateConfigDto.getCellTemplateID());
cellTemplateConfig.setReportTemplateID(cellTemplateConfigDto.getTemplateID());
cellTemplateConfig.setCreator(cellTemplateConfigDto.getCreator());
cellTemplateConfig.setUpdater(cellTemplateConfigDto.getUpdater());
cellTemplateConfig.setUpdateTime(new Date());
cellTemplateConfig.setCreateTime(new Date());
cellTemplateConfig.setDataSourceType(CellDataSourceType.Validation.getCode());
cellTemplateConfig.setValidation(cellTemplateConfigDto.getValidation());
cellTemplateConfig.setValidationDescription(cellTemplateConfigDto.getValidationDescription());
cellTemplateConfigList.add(cellTemplateConfig);
}
operationResultDto.setResult(true);
operationResultDto.setData(cellTemplateConfigList);
return operationResultDto;
}
private CellDataSourceType getInvoiceType(Integer invoiceType) {
if (invoiceType == null) {
return CellDataSourceType.InputInvoice;
}
if (invoiceType.intValue() == 1) {
return CellDataSourceType.InputInvoice;
} else if (invoiceType.intValue() == 2) {
return CellDataSourceType.OutputInvoice;
} else if (invoiceType.intValue() == 3) {
return CellDataSourceType.CustomInvoice;
}
return CellDataSourceType.InputInvoice;
}
private String GetJoinString(List<String> array) {
if (array != null && array.size() > 0) {
StringBuilder sb = new StringBuilder();
for (String s : array) {
sb.append(s + ",");
}
String tempStr = sb.toString();
return tempStr.substring(0, tempStr.length() - 2);
}
return null;
}
private String GetFormulaDataSource(String formula, List<String> keyValueConfigIDs) {
FormulaConfigExample example = new FormulaConfigExample();
example.setOrderByClause("LENGTH(FormulaName) desc");
List<FormulaConfig> dataSourceList = formulaConfigMapper.selectByExample(example);
List<String> nameList = new ArrayList<>();
FormulaHelper formulaHelper = new FormulaHelper();
String tmpFormula = formulaHelper.FormatFormula(formula).toUpperCase();
for (FormulaConfig dataSource : dataSourceList) {
if (tmpFormula.contains(dataSource.getFormulaName().toUpperCase() + "(") && !nameList.contains(dataSource.getDataSourceName())) {
nameList.add(dataSource.getDataSourceName());
}
}
String keyValueMethodName = "KEYVALUE(";
if (tmpFormula.contains(keyValueMethodName)) {
KeyValueConfigExample keyValueConfigExample = new KeyValueConfigExample();
keyValueConfigExample.setOrderByClause("LENGTH(KeyCode) desc");
List<KeyValueConfig> keyValueList = keyValueConfigMapper.selectByExample(keyValueConfigExample);
for (KeyValueConfig keyValueConfig : keyValueList) {
if (tmpFormula.contains(keyValueMethodName + "\"" + keyValueConfig.getKeyCode().toUpperCase() + "\")")) {
if (!StringUtils.isBlank(keyValueConfig.getDataSource())) {
String dataSourceName = keyValueConfig.getDataSource().split("_")[1];
if (!nameList.contains(dataSourceName)) {
nameList.add(dataSourceName);
}
}
if (keyValueConfigIDs.contains(keyValueConfig.getID())) {
keyValueConfigIDs.add(keyValueConfig.getID());
}
}
}
}
if (nameList.isEmpty()) {
return formula;
} else {
return String.join("+", nameList);
}
}
private CellTemplateConfigDto GetConfigDto(CellTemplate cellTemplate, List<CellTemplateConfig> configList) {
CellTemplateConfigDto cellTemplateConfigDto = CellConfigTranslater.GetConfigDto(cellTemplate, configList);
cellTemplateConfigDto.setCellTemplateID(cellTemplate.getID());
......
......@@ -49,10 +49,10 @@ public class KeyValueConfigServiceImpl extends AbstractService implements KeyVal
dtoObj.setServiceTypeIds(Arrays.asList(keyValueConfig.getServiceTypeIDs().split(",")));
List<KeyValueReference> selectScopeList = scopes.stream()
.filter(item -> item.getKeyValueConfigID().equals(item.getID())).collect(Collectors.toList());
List<Integer> selectScopes = selectScopeList.stream().map(item -> item.getScope()).distinct()
List<Integer> selectScopes = selectScopeList.stream().map(KeyValueReference::getScope).distinct()
.collect(Collectors.toList());
Map<Integer, Integer> scopeCount = new HashMap<>();
if(selectScopeList!=null&&selectScopeList.size()>0) {
if(selectScopeList.size() > 0) {
for(Integer selectScope :selectScopes) {
Integer count = (int)(selectScopeList.stream().filter(a-> a.getScope().equals(selectScope)).count());
scopeCount.put(selectScope, count);
......
package pwc.taxtech.atms.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
......@@ -12,7 +14,10 @@ public class ModelConfigurationServiceImpl extends AbstractService implements Mo
@Override
public List<ModelProfileDto> GetModelListByIndustry(String serviceTypeID, String industryID) {
return modelConfigMapper.GetModelListByIndustry(serviceTypeID, industryID);
Map<String,Object> map = new HashMap<>();
map.put("serviceTypeID",serviceTypeID);
map.put("industryID",industryID);
return modelConfigMapper.GetModelListByIndustry(map);
}
}
......@@ -40,7 +40,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
private AuthUserHelper authUserHelper;
@Override
public List<TaxPayerReportRuleDto> GetTaxPayerReportMapping() {
public List<TaxPayerReportRuleDto> getTaxPayerReportMapping() {
List<String> orgIDs = organizationMapper.selectOnlyIDAndParentID().stream().map(OrganizationDto::getID)
.collect(Collectors.toList());
List<TaxPayerReportRule> rules = taxPayerReportRuleMapper.selectByExample(new TaxPayerReportRuleExample());
......@@ -72,7 +72,7 @@ public class RuleEngineeConfigServiceImpl extends AbstractService implements Rul
}
@Override
public List<TaxRuleSettingDto> GetTaxRuleSetting() {
public List<TaxRuleSettingDto> getTaxRuleSetting() {
List<TaxRuleSettingDto> trsdList = taxRuleSettingMapper.GetTaxRuleSetting();
List<String> orgIDs = trsdList.stream().map(TaxRuleSettingDto::getOrganizationID).collect(Collectors.toList());
......
......@@ -3,6 +3,7 @@ package pwc.taxtech.atms.service.impl;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.constant.enums.TemplateGroupType;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.TemplateGroupDto;
import pwc.taxtech.atms.entitiy.TemplateGroup;
import pwc.taxtech.atms.entitiy.TemplateGroupExample;
......@@ -15,7 +16,7 @@ import java.util.List;
public class TemplateGroupServiceImpl extends AbstractService implements TemplateGroupService {
@Override
public List<TemplateGroupDto> Get() {
public List<TemplateGroupDto> get() {
List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
List<TemplateGroupDto> templateGroupDtos = new ArrayList<>();
for (TemplateGroup templateGroup : templateGroups) {
......@@ -27,7 +28,7 @@ public class TemplateGroupServiceImpl extends AbstractService implements Templat
}
@Override
public List<TemplateGroupDto> Get(int serviceTypeID, Integer taxPayType, String industryID) {
public List<TemplateGroupDto> get(int serviceTypeID, Integer taxPayType, String industryID) {
TemplateGroupExample example = new TemplateGroupExample();
TemplateGroupExample.Criteria criteria = example.createCriteria();
......@@ -48,4 +49,30 @@ public class TemplateGroupServiceImpl extends AbstractService implements Templat
return templateGroupDtos;
}
@Override
public OperationResultDto<Object> updateTemplateGroupName(TemplateGroupDto templateGroupDto) {
TemplateGroup entity = templateGroupMapper.selectByPrimaryKey(templateGroupDto.getID());
TemplateGroupExample example = new TemplateGroupExample();
example.createCriteria().andNameEqualTo(templateGroupDto.getName()).andIDNotEqualTo(templateGroupDto.getID()).andServiceTypeIDEqualTo(entity.getServiceTypeID()).andIndustryIDsEqualTo(entity.getIndustryIDs()).andPayTaxTypeEqualTo(entity.getPayTaxType());
List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(example);
if (!templateGroups.isEmpty()) {
OperationResultDto<Object> result = new OperationResultDto<>();
result.setResult(false);
result.setResultMsg(TemplateGroupMessage.TemplateGroupNameExist);
}
entity.setName(templateGroupDto.getName());
templateGroupMapper.updateByPrimaryKey(entity);
OperationResultDto<Object> result = new OperationResultDto<>();
result.setResult(true);
return result;
}
public class TemplateGroupMessage {
public static final String TemplateGroupNameExist = "TemplateGroupNameExist";
public static final String SystemTypeCannotDelete = "SystemTypeCannotDelete";
public static final String OrganizationUsedTemplateGroup = "OrganizationUsedTemplateGroup";
}
}
......@@ -277,21 +277,21 @@
<resultMap id="GetModelListByIndustryResult" type="pwc.taxtech.atms.dto.ModelProfileDto">
<id column="ID" jdbcType="VARCHAR" property="ID" />
<result column="Name" jdbcType="VARCHAR" property="name" />
<result column="CategoryID" jdbcType="VARCHAR" property="CategoryID" />
<result column="CategoryString" jdbcType="VARCHAR" property="CategoryString" />
<result column="OrgID" jdbcType="VARCHAR" property="OrgID" />
<result column="OrganizationName" jdbcType="VARCHAR" property="OrganizationName" />
<result column="Type" jdbcType="INTEGER" property="Type" />
<result column="Feature" jdbcType="INTEGER" property="Feature" />
<result column="IsStatus" jdbcType="INTEGER" property="IsStatus" />
<result column="Code" jdbcType="VARCHAR" property="Code" />
<result column="IndustyId" jdbcType="VARCHAR" property="IndustyId" />
<result column="IndustryName" jdbcType="VARCHAR" property="IndustryName" />
<result column="Description" jdbcType="VARCHAR" property="Description" />
<result column="RuleType" jdbcType="INTEGER" property="RuleType" />
<result column="IsFilter" jdbcType="INTEGER" property="IsFilter" />
<result column="ServiceTypeID" jdbcType="VARCHAR" property="ServiceTypeID" />
<result column="ServiceTypeName" jdbcType="VARCHAR" property="ServiceTypeName" />
<result column="CategoryID" jdbcType="VARCHAR" property="categoryID" />
<result column="CategoryString" jdbcType="VARCHAR" property="categoryString" />
<result column="OrgID" jdbcType="VARCHAR" property="orgID" />
<result column="OrganizationName" jdbcType="VARCHAR" property="organizationName" />
<result column="Type" jdbcType="INTEGER" property="type" />
<result column="Feature" jdbcType="INTEGER" property="feature" />
<result column="IsStatus" jdbcType="INTEGER" property="isStatus" />
<result column="Code" jdbcType="VARCHAR" property="code" />
<result column="IndustryId" jdbcType="VARCHAR" property="industryID" />
<result column="IndustryName" jdbcType="VARCHAR" property="industryName" />
<result column="Description" jdbcType="VARCHAR" property="description" />
<result column="RuleType" jdbcType="INTEGER" property="ruleType" />
<result column="IsFilter" jdbcType="INTEGER" property="isFilter" />
<result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID" />
<result column="ServiceTypeName" jdbcType="VARCHAR" property="serviceTypeName" />
</resultMap>
<select id="GetModelListByIndustry" parameterType="map" resultMap="GetModelListByIndustryResult">
SELECT
......@@ -305,7 +305,7 @@
m.Feature,
m.IsStatus,
m.Code,
org.IndustryID AS IndustyId,
org.IndustryID AS IndustryId,
i.Name AS IndustryName,
m.Description,
m.RuleType,
......
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