Commit f8eba103 authored by sherlock's avatar sherlock

Merge branch 'dev_oracle_sherlock' into 'dev_oracle'

bug:app-overview:listView\cardView

See merge request root/atms!176
parents 786164b8 9d8a5dcf
......@@ -92,6 +92,7 @@ public class CellTemplateServiceImpl extends AbstractService {
cellTemplate.setComment(cellTemplateConfig.getFormulaDescription());
cellTemplate.setRowName(cellTemplateConfig.getRowName());
cellTemplate.setColumnName(cellTemplateConfig.getColumnName());
cellTemplateMapper.updateByPrimaryKey(cellTemplate);
CellTemplateConfigExample example = new CellTemplateConfigExample();
example.createCriteria().andCellTemplateIdEqualTo(Long.parseLong(cellTemplateConfig.getCellTemplateId()));
List<CellTemplateConfig> cellTemplateConfigs = cellTemplateConfigMapper.selectByExample(example);
......
......@@ -35,16 +35,15 @@ import pwc.taxtech.atms.entity.TemplateExample;
import pwc.taxtech.atms.entity.TemplateGroup;
import pwc.taxtech.atms.entity.TemplateGroupExample;
import pwc.taxtech.atms.exception.ServiceException;
import pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper;
import pwc.taxtech.atms.vat.entity.PeriodCellData;
import pwc.taxtech.atms.vat.entity.PeriodDataSource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
......@@ -67,7 +66,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
private CellTemplateConfigMapper cellTemplateConfigMapper;
@Autowired
private CellTemplateConfigDao cellTemplateConfigDao;
@Autowired
private PeriodDataSourceMapper periodDataSourceMapper;
public List<TemplateGroupDto> get() {
List<TemplateGroup> templateGroups = templateGroupMapper.selectByExample(new TemplateGroupExample());
......@@ -236,6 +236,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateMapper.insertSelective(template);
List<CellTemplate> cellTemplateList = Lists.newArrayList();
List<CellTemplateConfig> cellTemplateConfigList = Lists.newArrayList();
List<PeriodDataSource> periodDataSourceList = Lists.newArrayList();
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
......@@ -271,10 +272,26 @@ public class TemplateGroupServiceImpl extends AbstractService {
config.setDataSourceType(1);//todo 枚举
config.setFormula(POIUtil.getCellFormulaString(cell));
// config.setFormula(cell.getCellFormula());
// config.setFormulaDataSource(); //todo KV相关
config.setFormulaDataSource("报表数据"); //todo KV相关
config.setUpdateTime(now);
config.setUpdateBy(authUserHelper.getCurrentUserId());
cellTemplateConfigList.add(config);
PeriodDataSource pds = new PeriodDataSource();
pds.setAmount(BigDecimal.ZERO);
pds.setUpdateBy("Admin");
pds.setUpdateTime(new Date());
pds.setId(distributedIdService.nextId());
pds.setCreateTime(new Date());
pds.setCellTemplateId(cellTemplate.getId());
pds.setCreateBy("Admin");
pds.setDescription(" ");
pds.setName("ReportDataSource");
Calendar cal = Calendar.getInstance();
pds.setPeriod(cal.get(Calendar.MONTH) + 1);
pds.setType(5);
pds.setColumnIndex(cell.getColumnIndex());
pds.setRowIndex(cell.getRowIndex());
periodDataSourceList.add(pds);
}
}
}
......@@ -282,6 +299,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
tmpList.forEach(list -> cellTemplateMapper.batchInsert2(list));
List<List<CellTemplateConfig>> tmpConfigList = CommonUtils.subListWithLen(cellTemplateConfigList, CommonUtils.BATCH_NUM);
tmpConfigList.forEach(list -> cellTemplateConfigMapper.batchInsert(list));
List<List<PeriodDataSource>> tmpPeriodList = CommonUtils.subListWithLen(periodDataSourceList, CommonUtils.BATCH_NUM);
tmpPeriodList.forEach(list -> periodDataSourceMapper.batchInsert(list));
}
} catch (Exception e) {
......@@ -336,6 +355,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateMapper.insertSelective(template);
List<CellTemplate> cellTemplateList = Lists.newArrayList();
List<CellTemplateConfig> cellTemplateConfigList = Lists.newArrayList();
List<PeriodDataSource> periodDataSourceList = Lists.newArrayList();
for (int r = sheet.getFirstRowNum(); r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
for (int c = row.getFirstCellNum(); c <= row.getLastCellNum(); c++) {
......@@ -364,10 +384,26 @@ public class TemplateGroupServiceImpl extends AbstractService {
config.setDataSourceType(1);//todo 枚举
config.setFormula(POIUtil.getCellFormulaString(cell));
// config.setFormula(cell.getCellFormula());
// config.setFormulaDataSource(); //todo KV相关
config.setFormulaDataSource("报表数据"); //todo KV相关
config.setUpdateTime(now);
config.setUpdateBy(authUserHelper.getCurrentUserId());
cellTemplateConfigList.add(config);
PeriodDataSource pds = new PeriodDataSource();
pds.setAmount(BigDecimal.ZERO);
pds.setUpdateBy("Admin");
pds.setUpdateTime(new Date());
pds.setId(distributedIdService.nextId());
pds.setCreateTime(new Date());
pds.setCellTemplateId(cellTemplate.getId());
pds.setCreateBy("Admin");
pds.setDescription(" ");
pds.setName("ReportDataSource");
Calendar cal = Calendar.getInstance();
pds.setPeriod(cal.get(Calendar.MONTH) + 1);
pds.setType(5);
pds.setColumnIndex(cell.getColumnIndex());
pds.setRowIndex(cell.getRowIndex());
periodDataSourceList.add(pds);
}
}
}
......@@ -376,6 +412,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
tmpList.forEach(list -> cellTemplateDao.batchInsert(list));//todo 批量插入优化
List<List<CellTemplateConfig>> tmpConfigList = CommonUtils.subListWithLen(cellTemplateConfigList, CommonUtils.BATCH_NUM);
tmpConfigList.forEach(list -> cellTemplateConfigDao.batchInsert(list));
List<List<PeriodDataSource>> tmpPeriodList = CommonUtils.subListWithLen(periodDataSourceList, CommonUtils.BATCH_NUM);
tmpPeriodList.forEach(list -> periodDataSourceMapper.batchInsert(list));
}
} catch (Exception e) {
logger.error("importTemplateExcelFile error.", e);
......
......@@ -137,4 +137,6 @@ public interface PeriodDataSourceMapper extends MyVatMapper {
List<DataSourceExtendDto> getManualDataSource(Long cellDataID);
DataSourceCellDataDto getManualDataSource2(Long dataSourceID);
int batchInsert(List<PeriodDataSource> list);
}
\ No newline at end of file
......@@ -338,4 +338,158 @@
WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} AND ROWNUM = 1
</select>
<insert id="batchInsert" parameterType="pwc.taxtech.atms.vat.entity.PeriodDataSource">
INSERT ALL
<foreach collection="list" item="item">
INTO PERIOD_DATA_SOURCE VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.id != null">
#{item.id,jdbcType=BIGINT},
</when>
</choose>
<choose>
<when test="item.type != null">
#{item.type,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.name != null">
#{item.name,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.amount != null">
#{item.amount,jdbcType=DECIMAL},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.description != null">
#{item.description,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.keyValueDataId != null">
#{item.keyValueDataId,jdbcType=VARCHAR},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.createBy != null">
#{item.createBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.createTime != null">
#{item.createTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
<when test="item.updateBy != null">
#{item.updateBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.updateTime != null">
#{item.updateTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
<when test="item.rowName != null">
#{item.rowName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.columnName != null">
#{item.columnName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.rowIndex != null">
#{item.rowIndex,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.remapBatchId != null">
#{item.remapBatchId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="item.columnIndex != null">
#{item.columnIndex,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.cellTemplateId != null">
#{item.cellTemplateId,jdbcType=BIGINT},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.period != null">
#{item.period,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when test="item.projectId != null">
#{item.projectId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</insert>
</mapper>
\ No newline at end of file
<div class="admin-home-page">
<div class="center-title" ng-mouseover="open=true" ng-mouseleave="open = false">
<span><h1 translate="WelcomeATMS-Longi"></h1></span>
<div ng-if="hasAdminPermission" class="import-title" ng-show="open"><a ng-click="showUploadModal()" href="#adminHomePage">{{'ImportBasicDataOneTime' |translate}}</a></div>
<!--<div ng-if="hasAdminPermission" class="import-title" ng-show="open"><a ng-click="showUploadModal()" href="#adminHomePage">{{'ImportBasicDataOneTime' |translate}}</a></div>-->
</div>
......
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