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

finished fsjz function

parent 0f67a6e0
...@@ -197,8 +197,8 @@ ...@@ -197,8 +197,8 @@
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>2.5</version> <version>3.0.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
......
...@@ -23,7 +23,7 @@ public class DatabaseAgent { ...@@ -23,7 +23,7 @@ public class DatabaseAgent {
public int createDatabase(String dbName) { public int createDatabase(String dbName) {
try { try {
jdbcTemplate.execute("CREATE DATABASE " + dbName + " default charset utf8 COLLATE utf8_general_ci"); jdbcTemplate.execute("CREATE DATABASE " + dbName + " default charset utf8mb4 COLLATE utf8mb4_general_ci");
return CREATE_DB_SUCCESS; return CREATE_DB_SUCCESS;
} catch (Exception exception) { } catch (Exception exception) {
if (exception.getCause() instanceof SQLException) { if (exception.getCause() instanceof SQLException) {
......
...@@ -9,6 +9,8 @@ import org.apache.commons.pool2.impl.DefaultPooledObject; ...@@ -9,6 +9,8 @@ import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.Properties;
public class DataSourceFactory implements KeyedPooledObjectFactory<String, DruidDataSource> { public class DataSourceFactory implements KeyedPooledObjectFactory<String, DruidDataSource> {
private static final Logger logger = LoggerFactory.getLogger(DataSourceFactory.class); private static final Logger logger = LoggerFactory.getLogger(DataSourceFactory.class);
private DataSourceConfig dataSourceConfig; private DataSourceConfig dataSourceConfig;
...@@ -28,6 +30,11 @@ public class DataSourceFactory implements KeyedPooledObjectFactory<String, Druid ...@@ -28,6 +30,11 @@ public class DataSourceFactory implements KeyedPooledObjectFactory<String, Druid
dynamicDataSource.setUrl(url); dynamicDataSource.setUrl(url);
dynamicDataSource.setUsername(dataSourceConfig.getUsername()); dynamicDataSource.setUsername(dataSourceConfig.getUsername());
dynamicDataSource.setPassword(dataSourceConfig.getPassword()); dynamicDataSource.setPassword(dataSourceConfig.getPassword());
//dynamicDataSource.init();
// Properties properties = new Properties();
// properties.setProperty("useUnicode","true");
// properties.setProperty("characterEncoding","utf8");
// dynamicDataSource.setConnectProperties(properties);
return new DefaultPooledObject<>(dynamicDataSource); return new DefaultPooledObject<>(dynamicDataSource);
} }
......
...@@ -106,5 +106,22 @@ public interface DataSourceMapper extends MyVatMapper { ...@@ -106,5 +106,22 @@ public interface DataSourceMapper extends MyVatMapper {
*/ */
int updateByPrimaryKey(DataSource record); int updateByPrimaryKey(DataSource record);
void clearDataWithPeriod(@Param("period")Integer period,@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs); void clearFormulaBlockWithPeriod(@Param("period")Integer period);
void clearTaxRuleSettingWithPeriod(@Param("period")Integer period);
void clearCellTemplateWithPeriod(@Param("period")Integer period,@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearCellTemplateConfigWithPeriod(@Param("period")Integer period,@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearTemplateWithPeriod(@Param("period")Integer period,@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
void clearTaxPayerReportWithPeriod(@Param("period")Integer period);
void clearDataSourceWithPeriod(@Param("period")Integer period);
void clearDataSourceDetailWithPeriod(@Param("period")Integer period);
void clearCellDataWithPeriod(@Param("exceptReportTemplateIDs") String exceptReportTemplateIDs);
} }
\ No newline at end of file
...@@ -103,7 +103,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -103,7 +103,15 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
Long templateGroupID = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode()); Long templateGroupID = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.VAT.getCode());
if (templateGroupID != null && templateGroupID != 0) { if (templateGroupID != null && templateGroupID != 0) {
// 先进行数据清理,包括period开头的所有报表配置表 条件Period // 先进行数据清理,包括period开头的所有报表配置表 条件Period
dataSourceMapper.clearDataWithPeriod(period, strExceptTemplateIDs); dataSourceMapper.clearFormulaBlockWithPeriod(period);
dataSourceMapper.clearTaxRuleSettingWithPeriod(period);
dataSourceMapper.clearCellTemplateWithPeriod(period, strExceptTemplateIDs);
dataSourceMapper.clearCellTemplateConfigWithPeriod(period, strExceptTemplateIDs);
dataSourceMapper.clearTemplateWithPeriod(period, strExceptTemplateIDs);
dataSourceMapper.clearTaxPayerReportWithPeriod(period);
dataSourceMapper.clearDataSourceWithPeriod(period);
dataSourceMapper.clearDataSourceDetailWithPeriod(period);
dataSourceMapper.clearCellDataWithPeriod( strExceptTemplateIDs);
// 根据templategroupid 把 template 插入到 periodTemplate // 根据templategroupid 把 template 插入到 periodTemplate
TemplateExample example = new TemplateExample(); TemplateExample example = new TemplateExample();
...@@ -131,7 +139,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -131,7 +139,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
periodTemplateList.add(periodTemplate); periodTemplateList.add(periodTemplate);
} }
List<Long> templateIDList = periodTemplateList.stream().map(PeriodTemplate::getId).collect(Collectors.toList()); List<Long> templateIDList = periodTemplateList.stream().map(PeriodTemplate::getTemplateId).collect(Collectors.toList());
CellTemplateExample cellTemplateExample = new CellTemplateExample(); CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdIn(templateIDList); cellTemplateExample.createCriteria().andReportTemplateIdIn(templateIDList);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(cellTemplateExample); List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(cellTemplateExample);
...@@ -157,7 +165,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -157,7 +165,7 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
periodCellTemplateList.add(periodCellTemplate); periodCellTemplateList.add(periodCellTemplate);
} }
List<Long> cellTemplateIDList = periodCellTemplateList.stream().map(PeriodCellTemplate::getId).collect(Collectors.toList()); List<Long> cellTemplateIDList = periodCellTemplateList.stream().map(PeriodCellTemplate::getCellTemplateId).collect(Collectors.toList());
CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample(); CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample();
cellTemplateConfigExample.createCriteria().andReportTemplateIdIn(templateIDList).andCellTemplateIdIn(cellTemplateIDList); cellTemplateConfigExample.createCriteria().andReportTemplateIdIn(templateIDList).andCellTemplateIdIn(cellTemplateIDList);
List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample); List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
...@@ -219,7 +227,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -219,7 +227,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
result.setResultMsg("there is no templateGroup"); result.setResultMsg("there is no templateGroup");
return result; return result;
} }
return null; result.setResult(true);
return result;
} }
@Override @Override
......
...@@ -35,8 +35,6 @@ import java.util.List; ...@@ -35,8 +35,6 @@ import java.util.List;
public class FSJZ extends FunctionBase implements FreeRefFunction { public class FSJZ extends FunctionBase implements FreeRefFunction {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
public FSJZ(FormulaContext formulaContext) { public FSJZ(FormulaContext formulaContext) {
super(formulaContext); super(formulaContext);
} }
...@@ -163,8 +161,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -163,8 +161,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
} }
//save formulablock //save formulablock
Long cellTemplateID = FormulaHelper Long cellTemplateID = getCellTemplateID(period,ec);
.getCellTemplateIDWithTemplateCodeAndColumnIndexAndRowIndex(ec.getWorkbook().getSheetName(ec.getSheetIndex()),ec.getColumnIndex(),ec.getRowIndex(),period,formulaContext);
PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock(); PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock();
periodFormulaBlock.setId(formulaContext.getFormulaAgent().distributedIDService.nextId()); periodFormulaBlock.setId(formulaContext.getFormulaAgent().distributedIDService.nextId());
...@@ -266,8 +263,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -266,8 +263,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
} }
//save formulablock //save formulablock
Long cellTemplateID = FormulaHelper Long cellTemplateID = getCellTemplateID(period,ec);
.getCellTemplateIDWithTemplateCodeAndColumnIndexAndRowIndex(ec.getWorkbook().getSheetName(ec.getSheetIndex()),ec.getColumnIndex(),ec.getRowIndex(),period,formulaContext);
PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock(); PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock();
periodFormulaBlock.setId(formulaContext.getFormulaAgent().distributedIDService.nextId()); periodFormulaBlock.setId(formulaContext.getFormulaAgent().distributedIDService.nextId());
......
...@@ -4,8 +4,12 @@ import org.apache.poi.ss.formula.OperationEvaluationContext; ...@@ -4,8 +4,12 @@ import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.EvaluationException; import org.apache.poi.ss.formula.eval.EvaluationException;
import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FunctionBase { public class FunctionBase {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
protected FormulaContext formulaContext; protected FormulaContext formulaContext;
public FunctionBase(FormulaContext formulaContext){ public FunctionBase(FormulaContext formulaContext){
...@@ -35,4 +39,9 @@ public class FunctionBase { ...@@ -35,4 +39,9 @@ public class FunctionBase {
return null; return null;
} }
} }
public Long getCellTemplateID(int period, OperationEvaluationContext ec){
return FormulaHelper
.getCellTemplateIDWithTemplateCodeAndColumnIndexAndRowIndex(ec.getWorkbook().getSheetName(ec.getSheetIndex()),ec.getColumnIndex(),ec.getRowIndex(),period,formulaContext);
}
} }
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.vat.entity.PeriodFormulaBlock;
import java.util.Calendar;
import java.util.Date;
/// <summary>
/// 名称:ND
/// 功能:获取某一年度值
/// 备注:只有一个参数: “0”表示当年,“1”表示下一年度,“-1”表示上一年度,“-2”前两年 如当前年度为2017=ND(0), 2016=ND(-1), 2015=ND(-2)
/// </summary>
/// <param name="v">本年度的相对值</param>
/// <returns></returns>
public class ND extends FunctionBase implements FreeRefFunction {
public ND(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
Calendar calendar = Calendar.getInstance();
Date creatTime = calendar.getTime();
int value = getIntParam(args[0],ec);
int currentYear = calendar.get(Calendar.YEAR);
value = value+currentYear;
Long cellTemplateID = getCellTemplateID(formulaContext.getPeriod(),ec);
String formulaExpression = "ND("+value+")";
logger.debug(formulaExpression);
PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock();
periodFormulaBlock.setId(formulaContext.getFormulaAgent().distributedIDService.nextId());
periodFormulaBlock.setPeriod(formulaContext.getPeriod());
periodFormulaBlock.setReportId(0L);
periodFormulaBlock.setCellTemplateId(cellTemplateID);
periodFormulaBlock.setFormulaExpression(formulaExpression);
periodFormulaBlock.setData(Integer.toString(value));
periodFormulaBlock.setCreateBy("Admin");
periodFormulaBlock.setCreateTime(creatTime);
periodFormulaBlock.setUpdateTime(creatTime);
periodFormulaBlock.setUpdateBy("Admin");
formulaContext.getFormulaAgent().periodFormulaBlockMapper.insertSelective(periodFormulaBlock);
return new NumberEval(value);
}
}
\ No newline at end of file
...@@ -751,16 +751,16 @@ DEFAULT CHARACTER SET = utf8mb4; ...@@ -751,16 +751,16 @@ DEFAULT CHARACTER SET = utf8mb4;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `DBKeyword_ProjectDbName`.`Report` -- Table `DBKeyword_ProjectDbName`.`Report`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`Report` ( CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`report` (
`ID` VARCHAR(128) NOT NULL, `id` bigint(18) unsigned NOT NULL,
`TemplateID` VARCHAR(128) NOT NULL, `template_id` bigint(18) unsigned NOT NULL DEFAULT '0',
`Period` INT(11) NOT NULL, `period` int(11) unsigned NOT NULL DEFAULT '0',
`ProjectID` VARCHAR(128) NULL DEFAULT NULL, `project_id` varchar(128) NOT NULL DEFAULT '',
`Creator` VARCHAR(128) NOT NULL, `create_by` varchar(128) NOT NULL DEFAULT '',
`CreateTime` DATETIME NOT NULL, `create_time` datetime NOT NULL DEFAULT '1970-01-01 08:00:00',
`Updater` VARCHAR(128) NOT NULL, `update_by` varchar(128) NOT NULL DEFAULT '',
`UpdateTime` DATETIME NOT NULL, `update_time` datetime NOT NULL DEFAULT '1970-01-01 08:00:00',
PRIMARY KEY (`ID`)) PRIMARY KEY (`id`))
ENGINE = InnoDB ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4; DEFAULT CHARACTER SET = utf8mb4;
...@@ -1010,6 +1010,7 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`period_cell_template_confi ...@@ -1010,6 +1010,7 @@ CREATE TABLE IF NOT EXISTS `DBKeyword_ProjectDbName`.`period_cell_template_confi
`parsed_validation` varchar(1000) NOT NULL DEFAULT '' COMMENT '解析验证信息', `parsed_validation` varchar(1000) NOT NULL DEFAULT '' COMMENT '解析验证信息',
`validation_description` varchar(1000) NOT NULL DEFAULT '' COMMENT '验证信息描述', `validation_description` varchar(1000) NOT NULL DEFAULT '' COMMENT '验证信息描述',
`voucher_keyword` varchar(1000) NOT NULL DEFAULT '' COMMENT '票证关键字', `voucher_keyword` varchar(1000) NOT NULL DEFAULT '' COMMENT '票证关键字',
`cell_template_config_id` bigint(18) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
......
...@@ -445,13 +445,50 @@ ...@@ -445,13 +445,50 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<delete id="clearDataWithPeriod" > <delete id="clearFormulaBlockWithPeriod" >
DELETE d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER}; DELETE FROM period_formula_block WHERE period=#{period,jdbcType=INTEGER};
delete from period_formula_block where period=#{period,jdbcType=INTEGER};
delete from period_tax_payer_report_rule where period=#{period,jdbcType=INTEGER};
delete from period_tax_rule_setting where period=#{period,jdbcType=INTEGER};
delete from period_cell_template where period=#{period,jdbcType=INTEGER} and report_template_id not in (#{exceptReportTemplateIDs,jdbcType=VARCHAR});
delete from period_cell_template_config where period=#{period,jdbcType=INTEGER} and report_template_id not in (#{exceptReportTemplateIDs,jdbcType=VARCHAR});
delete from period_template where period=#{period,jdbcType=INTEGER} and id not in (#{exceptReportTemplateIDs,jdbcType=VARCHAR});
</delete> </delete>
<delete id="clearTaxRuleSettingWithPeriod" >
DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};
</delete>
<delete id="clearCellTemplateWithPeriod" >
DELETE FROM period_cell_template WHERE period=#{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
and id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete id="clearCellTemplateConfigWithPeriod" >
DELETE FROM period_cell_template_config WHERE period=#{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
and id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete id="clearTemplateWithPeriod" >
DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER}
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
and id not in (${exceptReportTemplateIDs});
</if>
</delete>
<delete id="clearTaxPayerReportWithPeriod" >
DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};
</delete>
<delete id="clearDataSourceWithPeriod" >
DELETE d FROM data_source d JOIN period_formula_block f ON d.id = f.data_source_id WHERE f.Period = #{period,jdbcType=INTEGER};
</delete>
<delete id="clearDataSourceDetailWithPeriod" >
DELETE d FROM data_source_detail d JOIN period_formula_block f ON d.data_source_id = f.data_source_id WHERE f.Period = #{period,jdbcType=INTEGER};
</delete>
<delete id="clearCellDataWithPeriod" >
DELETE FROM cell_data
<if test="exceptReportTemplateIDs!=null and exceptReportTemplateIDs!=''">
WHERE report_id not in (${exceptReportTemplateIDs});
</if>
</delete>
<!--DELETE FROM period_tax_rule_setting WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE FROM period_cell_template WHERE period=#{period,jdbcType=INTEGER} and report_template_id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_cell_template_config WHERE period=#{period,jdbcType=INTEGER} and report_template_id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_template WHERE period=#{period,jdbcType=INTEGER} and id not in (${exceptReportTemplateIDs});-->
<!--DELETE FROM period_tax_payer_report_rule WHERE period=#{period,jdbcType=INTEGER};-->
<!--DELETE d FROM data_source d JOIN period_formula_block f ON d.key_value_data_id = f.id WHERE f.Period = #{period,jdbcType=INTEGER};-->
<!--</delete>-->
</mapper> </mapper>
\ No newline at end of file
...@@ -463,23 +463,23 @@ ...@@ -463,23 +463,23 @@
</select> </select>
<insert id="batchInsert"> <insert id="batchInsert">
INSERT INTO period_cell_template INSERT INTO period_cell_template
(id, (id,
period, period,
report_template_id, report_template_id,
row_index, row_index,
row_name, row_name,
column_index, column_index,
column_name, `column_name`,
'comment', `comment`,
create_time, create_time,
update_time, update_time,
cell_template_id, cell_template_id,
data_type, data_type,
is_read_only, is_read_only,
copy_from_id, copy_from_id,
create_by, create_by,
update_by update_by
) )
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=INTEGER} (#{item.id,jdbcType=INTEGER}
......
...@@ -482,9 +482,9 @@ ...@@ -482,9 +482,9 @@
update_by update_by
) )
VALUES VALUES
<foreach collection="periodTemplateList" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=INTEGER} (#{item.id,jdbcType=INTEGER}
,#{item.peiod,jdbcType=INTEGER} ,#{item.period,jdbcType=INTEGER}
,#{item.name,jdbcType=VARCHAR} ,#{item.name,jdbcType=VARCHAR}
,#{item.code,jdbcType=VARCHAR} ,#{item.code,jdbcType=VARCHAR}
,#{item.path,jdbcType=VARCHAR} ,#{item.path,jdbcType=VARCHAR}
......
...@@ -35,6 +35,7 @@ import pwc.taxtech.atms.entitiy.ServiceTypeExample; ...@@ -35,6 +35,7 @@ import pwc.taxtech.atms.entitiy.ServiceTypeExample;
import pwc.taxtech.atms.entitiy.StandardAccountExample; import pwc.taxtech.atms.entitiy.StandardAccountExample;
import pwc.taxtech.atms.entitiy.TemplateGroupExample; import pwc.taxtech.atms.entitiy.TemplateGroupExample;
import pwc.taxtech.atms.service.impl.DistributedIDService; import pwc.taxtech.atms.service.impl.DistributedIDService;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
@WebAppConfiguration @WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
...@@ -150,6 +151,8 @@ public abstract class CommonIT { ...@@ -150,6 +151,8 @@ public abstract class CommonIT {
protected TaxRuleSettingOrganizationMapper taxRuleSettingOrganizationMapper; protected TaxRuleSettingOrganizationMapper taxRuleSettingOrganizationMapper;
@Autowired @Autowired
protected TaxRuleSettingMapper taxRuleSettingMapper; protected TaxRuleSettingMapper taxRuleSettingMapper;
@Autowired
protected PeriodTemplateMapper periodTemplateMapper;
protected void execSqlFile(String sqlFilePath) { protected void execSqlFile(String sqlFilePath) {
......
...@@ -5,8 +5,11 @@ import org.apache.commons.lang3.StringUtils; ...@@ -5,8 +5,11 @@ import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import pwc.taxtech.atms.common.datasource.ShardingContextHolder;
import pwc.taxtech.atms.common.util.DateUtils; import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.entitiy.*; import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.vat.dao.PeriodTemplateMapper;
import pwc.taxtech.atms.vat.entity.PeriodTemplate;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -18,6 +21,8 @@ public class DataMigration extends CommonIT { ...@@ -18,6 +21,8 @@ public class DataMigration extends CommonIT {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
private List<Map<String, Object>> template20180622List; private List<Map<String, Object>> template20180622List;
private List<Map<String, Object>> templateList; private List<Map<String, Object>> templateList;
...@@ -513,4 +518,20 @@ public class DataMigration extends CommonIT { ...@@ -513,4 +518,20 @@ public class DataMigration extends CommonIT {
} }
//todo: ProjectServiceType_20180622 --40 //todo: ProjectServiceType_20180622 --40
@Test
public void insertChieseCharacter(){
ShardingContextHolder.setDataSourceKey("a2100000");
PeriodTemplate periodTemplate = new PeriodTemplate();
periodTemplate.setId(distributedIDService.nextId());
periodTemplate.setUpdateBy("张三");
periodTemplateMapper.insertSelective(periodTemplate);
Template template = new Template();
template.setId(distributedIDService.nextId());
template.setUpdateBy("张三");
templateMapper.insertSelective(template);
}
} }
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