Commit 5e4f4c09 authored by zhkwei's avatar zhkwei

CIT数据预览导出及资产导入bug

parent 38745fe5
......@@ -53,20 +53,27 @@ public class JxlsUtils {
public static <T> void export(ExportDto exportDto){
toPackageOs(exportDto.getResponse(), exportDto.getFileName());
try {
exportExcel(exportDto.getList(), exportDto.getResponse().getOutputStream(), toPackageIn(exportDto.getTemplateUrl()), exportDto.getRelation());
exportExcel(exportDto.getList(), exportDto.getResponse().getOutputStream(), toPackageIn(exportDto.getTemplateUrl()), exportDto.getRelation(),exportDto.getSheetNameTemp());
} catch (IOException e) {
e.printStackTrace();
}
}
public static <T> void exportExcel(List<T> list, ServletOutputStream os ,
InputStream in, Object relation ){
InputStream in, Object relation ){
exportExcel( list, os ,in, relation , null);
}
public static <T> void exportExcel(List<T> list, ServletOutputStream os ,
InputStream in, Object relation, String sheetName1 ){
String sn = sheetName;
if(sheetName1 != null)
sn = sheetName1;
long exportExcelBegin = System.currentTimeMillis();
log.warn("exportExcel begin: " + exportExcelBegin);
Context context = new Context();
context.putVar("list", list);
if(relation != null)
context.putVar("relation", relation);
if(relation != null) context.putVar("relation", relation);
Map<String , Object> myFunction = new HashMap<String , Object>();
myFunction.put("util", new JxlsUtils());
......@@ -83,7 +90,8 @@ public class JxlsUtils {
List<Area> areaList = areaBuilder.build();
//"汇总表!A1"
areaList.get(0).applyAt(new CellRef( sheetName + "!A1"), context);
areaList.get(0).applyAt(new CellRef( sn + "!A1"), context);
try {
trans.write();
......
......@@ -14,6 +14,7 @@ public class ExportDto<T> {
private Object relation;
private String templateUrl;
private String fileName;
private String sheetNameTemp;
public HttpServletResponse getResponse() {
return response;
......@@ -64,6 +65,14 @@ public class ExportDto<T> {
this.fileName = fileName;
}
public String getSheetNameTemp() {
return sheetNameTemp;
}
public void setSheetNameTemp(String sheetNameTemp) {
this.sheetNameTemp = sheetNameTemp;
}
@Override
public String toString() {
return "ExportDto{" +
......
......@@ -109,7 +109,7 @@ public class AssetListServiceImpl extends BaseService {
}
Page page = PageHelper.startPage(citAssetsListDto.getPageInfo().getPageIndex(),citAssetsListDto.getPageInfo().getPageSize());
List<CitAssetsList> citAssetsLists = assetListMapper.selectByExample(assetListExample);
CitAssetSumDataDto sumData = assetListMapper.getSumData(citAssetsListDto.getProjectId());
CitAssetSumDataDto sumData = assetListMapper.getSumData(citAssetsListDto.getProjectId(),citAssetsListDto.getAssetType());
List<CitAssetsListDto> citAssetsListDtos = new ArrayList<>();
for (CitAssetsList citAssetsList:citAssetsLists){
CitAssetsListDto temp = new CitAssetsListDto();
......
......@@ -149,11 +149,12 @@ public class CitDataPreviewServiceImpl extends BaseService {
return 0;
}
ExportDto exportDto = new ExportDto();
exportDto.setFileName("日记账合并版");
exportDto.setFileName("日记账");
exportDto.setTemplateUrl(Constant.citTemplateUrl + "/citJournalEntryAdjust.xlsx");
exportDto.setResponse(response);
exportDto.setList(journalMerges);
exportDto.setRelation(null);
exportDto.setSheetNameTemp("日记账");
JxlsUtils.export(exportDto);
return 1;
}
......@@ -274,6 +275,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
exportDto.setResponse(response);
exportDto.setList(citTbList);
exportDto.setRelation(null);
exportDto.setSheetNameTemp("试算平衡表生成版");
JxlsUtils.export(exportDto);
return 1;
}
......@@ -391,6 +393,7 @@ public class CitDataPreviewServiceImpl extends BaseService {
exportDto.setResponse(response);
exportDto.setList(citTbList);
exportDto.setRelation(citTbList.get(0));
exportDto.setSheetNameTemp("试算平衡表Mapping版");
JxlsUtils.export(exportDto);
return 1;
}
......
......@@ -144,13 +144,35 @@ public class CitPreviewDataServiceImpl extends BaseService {
exportDto.setResponse(response);
exportDto.setList(list);
exportDto.setRelation(null);
exportDto.setSheetNameTemp("EAM资产处置金额");
JxlsUtils.export(exportDto);
return 1;
}
public int exportDataSalaryAdvance(CitSalaryDataDto citSalaryDataDto , HttpServletResponse response) {
CitEAMAssetsDisposalExample example = new CitEAMAssetsDisposalExample();
List<CitSalaryAdvance> list = citSalaryAdvanceMapper.selectByCondition(citSalaryDataDto);
CitSalaryAdvanceExample example = new CitSalaryAdvanceExample();
CitSalaryAdvanceExample.Criteria criteria = example.createCriteria();
if(!"".equals(citSalaryDataDto.getPoSubjectName()) && citSalaryDataDto.getPoSubjectName() != null){//根据PO主体名称进行查询
criteria.andPoSubjectNameEqualTo(citSalaryDataDto.getPoSubjectName());
}
Integer periodStart = null;
Integer periodEnd = null;
if(citSalaryDataDto.getPeriodStart() != null && !"".equals(citSalaryDataDto.getPeriodStart())){
periodStart = citSalaryDataDto.getPeriodStart();
}
if(citSalaryDataDto.getPeriodEnd() != null &&!"".equals(citSalaryDataDto.getPeriodEnd())){
periodEnd = citSalaryDataDto.getPeriodEnd();
}
if(periodEnd != null && periodStart!= null){
criteria.andPeriodBetween(periodStart, periodEnd);
}
if(periodStart == null && periodEnd!= null){
criteria.andPeriodLessThanOrEqualTo(periodEnd);
}
if(periodStart != null && periodEnd == null ){
criteria.andPeriodGreaterThanOrEqualTo(periodStart);
}
List<CitSalaryAdvance> list = citSalaryAdvanceMapper.selectByExample(example);
if(list.size()==0){
return 0;
}
......@@ -160,6 +182,7 @@ public class CitPreviewDataServiceImpl extends BaseService {
exportDto.setResponse(response);
exportDto.setList(list);
exportDto.setRelation(null);
exportDto.setSheetNameTemp("预提重分类数据源");
JxlsUtils.export(exportDto);
return 1;
}
......
......@@ -1488,7 +1488,9 @@ public class CitReportServiceImpl extends BaseService {
temp.setUpdateTime(null);
// citAssetEamMappingMapper.insertSelective(temp);
}
citAssetEamMappingMapper.insertBatch(citAssetEamMappings);
if(citAssetEamMappings !=null && citAssetEamMappings.size()>0){
citAssetEamMappingMapper.insertBatch(citAssetEamMappings);
}
return 0;
}
......
......@@ -123,5 +123,5 @@ public interface CitAssetsListMapper extends MyMapper {
@Param("assetDetailType") Integer assetDetailType,
@Param("projectId") String projectId);
CitAssetSumDataDto getSumData(@Param("projectId") String projectId);
CitAssetSumDataDto getSumData(@Param("projectId") String projectId,@Param("assetType") Integer assetType);
}
\ No newline at end of file
......@@ -50,7 +50,15 @@
<insert id="insertBatch" parameterType="java.util.List">
insert into assets_list
(<include refid="Base_Column_List"/>)
( id, project_id, period, asset_number, serial_number, asset_group_name, asset_detail_group_id,
asset_description, buy_date, depreciation_date, depreciation_period, acquisition_value,
adjustment_value, disposed_date,residual_rate, year_depreciation_amount, year_adjustment_amount,
year_end_value, status, account_acquisition_value, account_month_depreciation_amount,
account_year_depreciation_amount, account_total_depreciation_amount, tax_depreciation_period,
tax_to_last_year_depreciation_period, tax_to_current_year_depreciation_period, tax_year_depreciation_period,
tax_month_depreciation_amount, tax_to_current_year_depreciation_amount, tax_current_year_depreciation_amount,
total_difference_amount, year_difference_amount, is_retain, asset_type, create_time,
update_time, tax_account_compare, tax_group_name, scrap_type)
values
<foreach collection="list" item="item" index="index" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -108,7 +116,7 @@
</choose>
<choose>
<when test="item.disposedDate != null">#{item.disposedDate,jdbcType=TIMESTAMP},</when>
<otherwise>CURRENT_TIMESTAMP,</otherwise>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.residualRate != null">#{item.residualRate,jdbcType=DECIMAL},</when>
......@@ -304,7 +312,7 @@
AND asset_detail_group.asset_group_type = #{assetType,jdbcType=INTEGER}
AND asset_detail_group.detail_group_type = #{assetDetailType,jdbcType=INTEGER}
</select>
<select id="getSumData" resultType="pwc.taxtech.atms.dpo.CitAssetSumDataDto">
select
sum(account_acquisition_value) as totalAccountAcquisitionValue,
......@@ -314,6 +322,7 @@
from assets_list
where status = 1
and project_id = #{projectId,jdbcType=VARCHAR}
and asset_type = #{assetType,jdbcType=INTEGER}
</select>
</mapper>
\ No newline at end of file
......@@ -153,7 +153,7 @@
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '日记账信息.xlsx');
vatExportService.exportToExcel(data, status, headers, '日记账信息.xlsx',true);
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
......
......@@ -140,7 +140,7 @@
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '试算平衡表信息.xlsx');
vatExportService.exportToExcel(data, status, headers, '试算平衡表信息.xlsx',true);
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
......
......@@ -144,7 +144,7 @@
SweetAlert.warning("没有数据可以下载");
return;
}
vatExportService.exportToExcel(data, status, headers, '试算平衡表+Mapping信息.xlsx');
vatExportService.exportToExcel(data, status, headers, '试算平衡表+Mapping信息.xlsx',true);
}).error(function () {
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
});
......
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