JOSN示例:
这里记录的对动态表单的支持并非是针对不同的表单创建不同的table,而是处理动态表单的json数据对前端动态表单的功能支撑
动态查询JSON:
{"config":{"version":"1.10","formRef":"elForm","formModel":"form","rules":"rules","size":"medium","labelPosition":"right","labelWidth":80,"formRules":"rules","gutter":15,"disabled":false,"dynamicTableAllowed":true},"list":[{"fieldName":"","id":"row_1705972989204","_id":"row_1705972989204","compType":"row","compName":"栅格布局","ele":"el-row","compIcon":"col","layout":"rowItem","config":true,"flex":"default","justify":"start","align":"top","gutter":0,"columns":[{"index":0,"span":6,"list":[{"id":"staff","_id":"staff","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"名称查询","labelWidth":68,"placeholder":"请输入名称","required":false,"maxLength":50,"gutter":1,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","searchType":"like"}]},{"index":1,"span":6,"list":[{"searchType":"like","fieldName":"","id":"company","_id":"company","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"申请公司","labelWidth":68,"placeholder":"请输入公司名称","required":false,"maxLength":50,"gutter":1,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem"}]},{"index":"[object Object],[object Object]1","span":12,"list":[{"id":"date","_id":"date","compType":"date","ele":"el-date-picker","compName":"日期","compIcon":"date","viewType":"text","config":true,"showLabel":true,"label":"申请日期","labelWidth":68,"placeholder":"请选择","required":false,"maxLength":50,"gutter":12,"span":24,"clearable":true,"disabled":false,"readonly":false,"value":null,"rules":[],"type":"datetimerange","format":"yyyy-MM-dd HH:mm:ss","value-format":"yyyy-MM-dd HH:mm:ss","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期","layout":"colItem","searchType":"between"}]}]}]}
动态属性JSON:
{"config":{"version":"1.10","formRef":"elForm","formModel":"form","rules":"rules","size":"medium","labelPosition":"right","labelWidth":80,"formRules":"rules","gutter":15,"disabled":false,"dynamicTableAllowed":true},"list":[{"fieldName":"","id":"fd_1705993646851","_id":"fd_1705993646851","compType":"divider","ele":"el-divider","compName":"分割线","compIcon":"divider","viewType":"component","config":true,"form":false,"content-position":"left","text":"业务招待报销","showLabel":false,"labelWidth":"0","layout":"colItem"},{"fieldName":"","id":"row_1705982083502","_id":"row_1705982083502","compType":"row","compName":"栅格布局","ele":"el-row","compIcon":"col","layout":"rowItem","config":true,"flex":"default","justify":"start","align":"top","gutter":0,"columns":[{"index":0,"span":12,"list":[{"searchType":"eq","fieldName":"","id":"staff","_id":"staff","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"申请人","labelWidth":80,"placeholder":"请输入文本","required":true,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","isShowInList":true}]},{"index":1,"span":12,"list":[{"searchType":"eq","fieldName":"","id":"date","_id":"date","compType":"date","ele":"el-date-picker","compName":"日期","compIcon":"date","viewType":"text","config":true,"showLabel":true,"label":"申请日期","labelWidth":80,"placeholder":"请选择","required":true,"maxLength":50,"gutter":6,"span":24,"clearable":true,"disabled":false,"readonly":false,"value":"","rules":[],"type":"datetime","format":"yyyy-MM-dd HH:mm:ss","value-format":"yyyy-MM-dd HH:mm:ss","range-separator":"-","start-placeholder":"开始日期","end-placeholder":"结束日期","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object]1","span":12,"list":[{"searchType":"eq","fieldName":"","id":"dept","_id":"dept","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"申请部门","labelWidth":80,"placeholder":"请输入文本","required":true,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","isShowInList":true},{"searchType":"eq","fieldName":"","id":"bx_user","_id":"bx_user","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"报销人","labelWidth":80,"placeholder":"请输入文本","required":true,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object],[object Object]1","span":12,"list":[{"searchType":"eq","fieldName":"","id":"company","_id":"company","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"申请公司","labelWidth":80,"placeholder":"请输入文本","required":true,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object],[object Object],[object Object]1","span":12,"list":[{"searchType":"eq","fieldName":"","id":"cd_dept","_id":"cd_dept","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"费用承担部门","labelWidth":110,"placeholder":"请输入文本","required":true,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object],[object Object],[object Object],[object Object]1","span":12,"list":[{"searchType":"eq","fieldName":"","id":"mobile","_id":"mobile","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"电话","labelWidth":80,"placeholder":"请输入文本","required":false,"maxLength":50,"gutter":6,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[{"rule":"0?(13|14|15|17|18|19)[0-9]{9}","msg":"您输入的电话号码不符合规则"}],"rulesType":"phone","prepend":"","append":"","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]1","span":12,"list":[{"searchType":"eq","fieldName":"","id":"zd_object","_id":"zd_object","compType":"select","compName":"下拉框","ele":"el-select","compIcon":"select","viewType":"component","config":true,"label":"招待对象","placeholder":"请选择","maxLength":50,"span":24,"gutter":6,"labelWidth":80,"showLabel":true,"required":true,"multiple":false,"collapse-tags":false,"disabled":false,"filterable":false,"options":[{"label":"张三","value":1},{"label":"李四","value":2}],"dataType":"static","action":"https://www.fastmock.site/mock/51715c0157535b99010bde55f2df33c8/formDesigner/api/options","clearable":false,"value":"","rules":[],"ruleError":"该字段不能为空","layout":"colItem","isShowInList":true}]},{"index":"[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]1","span":24,"list":[{"id":"remark","_id":"remark","compType":"textarea","ele":"el-input","compName":"多行文本","compIcon":"textarea","viewType":"text","config":true,"showLabel":true,"label":"备注","labelWidth":80,"placeholder":"请输入文本","type":"textarea","required":false,"maxlength":50,"show-word-limit":false,"gutter":6,"span":24,"clearable":true,"disabled":false,"readonly":false,"rows":4,"status":"normal","value":"","rules":[],"ruleError":"该字段不能为空","layout":"colItem","isShowInList":true}]}]},{"fieldName":"","id":"fd_1705993523865","_id":"fd_1705993523865","compType":"divider","ele":"el-divider","compName":"分割线","compIcon":"divider","viewType":"component","config":true,"form":false,"content-position":"left","text":"列表展示","showLabel":false,"labelWidth":"0","layout":"colItem"},{"fieldName":"","id":"goods_table","_id":"goods_table","compType":"dynamicTable","ele":"dynamic-table","compName":"动态表格","layout":"dynamicItem","compIcon":"table","labelWidth":0,"showLabel":false,"config":true,"buttonAdd":true,"buttonDel":true,"showIndex":true,"visible":true,"multiCheck":false,"show-summary":false,"sum-text":"合计","summary-text":"元","columns":[{"searchType":"eq","fieldName":"","id":"goods_attr","_id":"goods_attr","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"属性","labelWidth":80,"placeholder":"请输入文本","required":false,"maxLength":50,"gutter":15,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem"},{"searchType":"eq","fieldName":"","id":"goods_name","_id":"goods_name","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"名称","labelWidth":80,"placeholder":"请输入文本","required":false,"maxLength":50,"gutter":15,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem"},{"searchType":"eq","fieldName":"","id":"goods_num","_id":"goods_num","compType":"input","ele":"el-input","compName":"单行文本","compIcon":"input","viewType":"text","config":true,"showLabel":true,"label":"数量","labelWidth":80,"placeholder":"请输入文本","required":false,"maxLength":50,"gutter":15,"span":24,"width":"100%","clearable":true,"disabled":false,"readonly":false,"status":"normal","prefix-icon":"","suffix-icon":"","value":"","rules":[],"rulesType":"default","prepend":"","append":"","layout":"colItem"}]},{"fieldName":"","id":"fd_1706168664289","_id":"fd_1706168664289","compType":"divider","ele":"el-divider","compName":"分割线","compIcon":"divider","viewType":"component","config":true,"form":false,"content-position":"left","text":"文件","showLabel":false,"labelWidth":"0","layout":"colItem"},{"isShowInList":false,"fieldName":"","id":"fd_file","_id":"fd_1706168691620","compType":"upload","ele":"el-upload","compName":"附件","compIcon":"att","viewType":"component","config":true,"showLabel":true,"label":"附件上传","labelWidth":80,"gutter":15,"span":24,"required":false,"action":"https://jsonplaceholder.typicode.com/posts/","multiple":false,"name":"file","show-file-list":true,"list-type":"text","value":"","width":100,"buttonText":"请上传附件","showTip":false,"tips":"点击按钮上传附件","accept":".pdf, .doc, .docx, .xls, .xlsx","fileSize":10,"headers":{"X-Access-Token":"token"},"layout":"colItem"}]}
功能点一、java解析queryJson构建动态表单动态查询条件
说明:递归解析json根据特定条件构建动态查询条件
//构建查询条件
List<Map<String,String>> queryParam = new ArrayList<>();
String dynamicQuery = query.getDynamicQueryHtml();
if(StringUtils.isNotBlank(dynamicQuery)){
JSONObject queryObject = JSON.parseObject(dynamicQuery);
queryParam = jsonLoopQuery(queryParam,queryObject,sqlParam);
}
//构建方法
private List<Map<String, String>> jsonLoopQuery(List<Map<String, String>> results, Object obj,List<String> sqlParam) {
try {
if (obj != null && obj instanceof JSONArray) {
JSONArray arrayValue = (JSONArray) obj;
for (int i = 0; i < arrayValue.size(); i++) {
Object ojt = arrayValue.get(i);
jsonLoopQuery(results, ojt, sqlParam);
}
} else if (obj != null && obj instanceof JSONObject) {
JSONObject object = (JSONObject) obj;
Set<String> keys = object.keySet();
Iterator it = keys.iterator();
while (it.hasNext()) {
String key = it.next().toString();
Object value = object.get(key);
if (value != null && "searchType".equals(key)) {
String fileName = object.getString("id");
String fileAttr = object.getString("searchType");
if (!sqlParam.contains(fileName)) {
throw new BizException("查询属性和动态表单不匹配,请核实!");
}
if ("between".equals(fileAttr)) {
JSONArray valArray = object.getJSONArray("value");
Map<String, String> betweenStartMap = new HashMap<>();
betweenStartMap.put("fileName", fileName);
betweenStartMap.put("fileAttr", "between-s");
if (valArray != null && valArray.size() > 0) {
String startDate = valArray.getString(0);
betweenStartMap.put("fileVar", startDate);
} else {
betweenStartMap.put("fileVar", "");
}
results.add(betweenStartMap);
Map<String, String> betweenEndMap = new HashMap<>();
betweenEndMap.put("fileName", fileName);
betweenEndMap.put("fileAttr", "between-e");
if (valArray != null && valArray.size() > 0) {
String endDate = valArray.getString(1);
betweenEndMap.put("fileVar", endDate);
} else {
betweenEndMap.put("fileVar", "");
}
results.add(betweenEndMap);
} else {
String fileVar = object.getString("value");
Map<String, String> queryMap = new HashMap<>();
queryMap.put("fileName", fileName);
queryMap.put("fileAttr", fileAttr);
queryMap.put("fileVar", fileVar);
results.add(queryMap);
}
} else {
jsonLoopQuery(results, value, sqlParam);
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw new BizException(e.getMessage());
}
return results;
}
功能点二、java解析fileJson构建动态表单中的动态属性
说明:递归解析json根据特定条件构建动态表单属性
//构建查询属性
List<String> sqlParam = new ArrayList<>();
JSONObject sqlObject = JSON.parseObject(dynamicHtml);
sqlParam = jsonLoopSql(sqlParam,sqlObject);
//构建方法
private List<String> jsonLoopSql(List<String> results, Object obj) {
try {
if (obj != null && obj instanceof JSONArray) {
JSONArray arrayValue = (JSONArray) obj;
for (int i = 0; i < arrayValue.size(); i++) {
Object ojt = arrayValue.get(i);
jsonLoopSql(results, ojt);
}
} else if (obj != null && obj instanceof JSONObject) {
JSONObject object = (JSONObject) obj;
Set<String> keys = object.keySet();
Iterator it = keys.iterator();
while (it.hasNext()) {
String key = it.next().toString();
Object value = object.get(key);
if ("isShowInList".equals(key) && value != null && value instanceof Boolean && (Boolean) value) {
results.add(object.getString("id"));
} else {
jsonLoopSql(results, value);
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw new BizException(e.getMessage());
}
return results;
}
功能点三、mysql解析json获取动态表单分页查询数据
使用的分页插件是PageHelper
1、controller
@PostMapping("/getPageList")
@ApiOperation(value = "分页查询")
public Result getPageList(@RequestBody DynamicFormDataQuery query) {
PageInfo<Map<String,Object>> pageInfo = dynamicFormDataService.getPageList(query);
return Result.ok("分页查询成功", pageInfo);
}
@Data
public class DynamicFormDataQuery extends PageParamVo {
@ApiModelProperty(value = "动态表单ID")
private Long configId;
@ApiModelProperty(value = "动态表单查询code")
private String dynamicQueryHtml;
}
2、service
PageInfo<Map<String,Object>> getPageList(DynamicFormDataQuery query);
3、serviceImpl
@Override
public PageInfo<Map<String,Object>> getPageList(DynamicFormDataQuery query) {
PageInfo<Map<String,Object>> pageResult = new PageInfo<>();
//解析动态表单,获取动态表单查询条件字段及动态表单字段
Long formId = query.getConfigId();
if(formId == null){
throw new BizException("动态表单ID不能为空,请核实!");
}
DynamicFormConfig cfEntity = dynamicFormConfigMapper.selectById(formId);
if(cfEntity != null && cfEntity.getStatus() == 0){
String dynamicHtml = cfEntity.getDynamicHtml();
if(StringUtils.isNotBlank(dynamicHtml)){
//构建查询属性
List<String> sqlParam = new ArrayList<>();
JSONObject sqlObject = JSON.parseObject(dynamicHtml);
sqlParam = jsonLoopSql(sqlParam,sqlObject);
//构建查询条件
List<Map<String,String>> queryParam = new ArrayList<>();
String dynamicQuery = query.getDynamicQueryHtml();
if(StringUtils.isNotBlank(dynamicQuery)){
JSONObject queryObject = JSON.parseObject(dynamicQuery);
queryParam = jsonLoopQuery(queryParam,queryObject,sqlParam);
}
//根据解析后的数据,分页查询动态表单
BuildParamQuery paramQuery = new BuildParamQuery();
paramQuery.setConfigId(formId);
paramQuery.setSqlParam(sqlParam);
paramQuery.setQueryParam(queryParam);
PageHelper.startPage(query.getPageNum(),query.getPageSize());
List<Map<String,Object>> resultList = baseMapper.getPageList(paramQuery);
pageResult = new PageInfo<>(resultList);
}
}
return pageResult;
}
4、baseMapper
List<Map<String,Object>> getPageList(@Param("paramQuery") BuildParamQuery paramQuery);
5、xml
<select id="getPageList" parameterType="com.huim.dyform.query.BuildParamQuery" resultType="java.util.HashMap">
select * from (
SELECT
<foreach collection="paramQuery.sqlParam" separator="," close="," item="item">
REPLACE(json_extract(form_data,CONCAT('$.',#{item})),'"','') as #{item}
</foreach>
create_time,create_user,update_time,update_user,id
FROM dynamic_form_data
WHERE 1=1
AND config_id = #{paramQuery.configId}
ORDER BY create_time DESC) t
WHERE 1=1
<foreach collection="paramQuery.queryParam" separator=" " item="query">
<if test="query.fileAttr == 'like'">
<if test="query.fileVar != null and query.fileVar != ''">
and t.${query.fileName} like CONCAT(CONCAT('%',#{query.fileVar}),'%')
</if>
</if>
<if test="query.fileAttr == 'eq'">
<if test="query.fileVar != null and query.fileVar != ''">
and t.${query.fileName} = #{query.fileVar}
</if>
</if>
<if test="query.fileAttr == 'between-s'">
<if test="query.fileVar != null and query.fileVar != ''">
and STR_TO_DATE(t.${query.fileName}, '%Y-%m-%d %H:%i:%S') >= STR_TO_DATE(#{query.fileVar}, '%Y-%m-%d %H:%i:%S')
</if>
</if>
<if test="query.fileAttr == 'between-e'">
<if test="query.fileVar != null and query.fileVar != ''">
and STR_TO_DATE(t.${query.fileName}, '%Y-%m-%d %H:%i:%S') <= STR_TO_DATE(#{query.fileVar}, '%Y-%m-%d %H:%i:%S')
</if>
</if>
</foreach>
</select>
功能点四、poi动态表单动态导出
因为是动态的表单的导出也就是说返回的对象是动态的不是固定的,所以这里使用poi进行基础操作
1、controller
@PostMapping("/exportData")
@ApiOperation(value = "导出数据")
public Result exportData(@RequestBody DynamicFormDataQuery query, HttpServletResponse response) {
dynamicFormDataService.exportData(query,response);
return Result.okMsg("导出数据成功");
}
2、service
void exportData(DynamicFormDataQuery query, HttpServletResponse response);
3、serviceImpl
@Override
public void exportData(DynamicFormDataQuery query, HttpServletResponse response) {
List<Map<String,Object>> resultList = new ArrayList<>();
//解析动态表单,获取动态表单查询条件字段及动态表单字段
Long formId = query.getConfigId();
if(formId == null){
throw new BizException("动态表单ID不能为空,请核实!");
}
DynamicFormConfig cfEntity = dynamicFormConfigMapper.selectById(formId);
if(cfEntity != null && cfEntity.getStatus() == 0){
String dynamicHtml = cfEntity.getDynamicHtml();
if(StringUtils.isNotBlank(dynamicHtml)){
//构建查询属性
List<String> sqlParam = new ArrayList<>();
JSONObject sqlObject = JSON.parseObject(dynamicHtml);
sqlParam = jsonLoopSql(sqlParam,sqlObject);
//构建查询条件
List<Map<String,String>> queryParam = new ArrayList<>();
String dynamicQuery = query.getDynamicQueryHtml();
if(StringUtils.isNotBlank(dynamicQuery)){
JSONObject queryObject = JSON.parseObject(dynamicQuery);
queryParam = jsonLoopQuery(queryParam,queryObject,sqlParam);
}
//根据解析后的数据,分页查询动态表单
BuildParamQuery paramQuery = new BuildParamQuery();
paramQuery.setConfigId(formId);
paramQuery.setSqlParam(sqlParam);
paramQuery.setQueryParam(queryParam);
resultList = baseMapper.getPageList(paramQuery);
//导出excel
String sheetName = cfEntity.getFormName();
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(sheetName);
//单元格样式
HSSFCellStyle style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
//按列构建数据
HSSFCell cell = null;
List<Map<String, String>> fileList = getDynamicFileList(formId);
HSSFRow rowTitle = sheet.createRow(0);
//构建file列数据
if(!CollectionUtils.isEmpty(fileList)){
int rangenum = 0;//步长
for (int i = 0; i < fileList.size(); i++) {
Map<String, String> fileMap = fileList.get(i);
String lable = fileMap.get("lable");
String fileName = fileMap.get("fileName");
CellRangeAddress cellRangeAddressRQ = new CellRangeAddress(0, 0, rangenum, rangenum+1);
sheet.addMergedRegion(cellRangeAddressRQ);
cell = rowTitle.createCell(rangenum);
cell.setCellValue(lable);
cell.setCellStyle(style);
//构建数据
if(!CollectionUtils.isEmpty(resultList)){
int rownum = 1;//动态行
for (int j = 0; j < resultList.size(); j++) {
Map<String, Object> fileData = resultList.get(j);
HSSFRow dataRow = sheet.getRow(rownum);
if(dataRow == null){
dataRow = sheet.createRow(rownum);
}
CellRangeAddress craRQ = new CellRangeAddress(rownum, rownum, rangenum, rangenum+1);
sheet.addMergedRegion(craRQ);
cell = dataRow.createCell(rangenum);
String cellVal = fileData.get(fileName).toString();
if(StringUtils.isNotBlank(cellVal)){
cell.setCellValue(cellVal);
}else{
cell.setCellValue("");
}
cell.setCellStyle(style);
rownum++;
}
}
rangenum = rangenum + 2;
}
}
try {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
OutputStream os = response.getOutputStream();
wb.write(os);
os.flush();
os.close();
} catch (Exception e) {
e.printStackTrace();
throw new BizException(e.getMessage());
}
}
}
}