Commit 5e4f4c09 authored by zhkwei's avatar zhkwei

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

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