收款单导出功能完成

This commit is contained in:
weizhiqiang 2019-10-29 10:15:22 +08:00
parent fdaedbce74
commit e792b4e38a
8 changed files with 90 additions and 5 deletions

View file

@ -91,4 +91,17 @@ public class ReceivablesController {
public void queryReceivablesByDetail(InputObject inputObject, OutputObject outputObject) throws Exception{
receivablesService.queryReceivablesByDetail(inputObject, outputObject);
}
/**
* 导出Excel
* @param inputObject
* @param outputObject
* @throws Exception
*/
@RequestMapping("/post/ReceivablesController/queryMationToExcel")
@ResponseBody
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception{
receivablesService.queryMationToExcel(inputObject, outputObject);
}
}

View file

@ -35,5 +35,7 @@ public interface ReceivablesDao {
public int deleteReceivablesItemById(Map<String, Object> params) throws Exception;
public List<Map<String, Object>> queryUserInfoById(Map<String, Object> bean) throws Exception;
public List<Map<String, Object>> queryMationToExcel(Map<String, Object> params) throws Exception;
}

View file

@ -21,5 +21,7 @@ public interface ReceivablesService {
public void deleteReceivablesById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryReceivablesByDetail(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception;
}

View file

@ -14,6 +14,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.ExcelUtil;
import com.skyeye.common.util.ToolUtil;
import com.skyeye.dao.ReceivablesDao;
import com.skyeye.erp.util.ErpConstants;
@ -237,4 +238,23 @@ public class ReceivablesServiceImpl implements ReceivablesService {
outputObject.setreturnMessage("该数据已不存在.");
}
}
/**
* 导出Excel
* @param inputObject
* @param outputObject
* @throws Exception
*/
@SuppressWarnings("static-access")
@Override
public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> params = inputObject.getParams();
params.put("userId", inputObject.getLogParams().get("id"));
List<Map<String, Object>> beans = receivablesDao.queryMationToExcel(params);
String[] key = new String[]{"billNo", "supplierName", "totalPrice", "hansPersonName", "billTime"};
String[] column = new String[]{"单据编号", "付款单位", "合计金额", "经手人", "单据日期"};
String[] dataType = new String[]{"", "data", "data", "data", "data"};
//收款单信息导出
ExcelUtil.createWorkBook("收款单", "收款单详细", beans, key, column, dataType, inputObject.getResponse());
}
}

View file

@ -165,5 +165,31 @@
WHERE
INSTR(CONCAT(',', #{handsPersonId}, ','), CONCAT(',', a.user_id, ','))
</select>
<select id="queryMationToExcel" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.change_amount changeAmount,
FORMAT(a.total_price, 2) totalPrice,
a.bill_no billNo,
CONVERT (a.bill_time, CHAR) billTime,
(SELECT group_concat(distinct m.user_name) FROM sys_eve_user_staff m WHERE INSTR(CONCAT(',', a.hands_person_id, ','), CONCAT(',', m.user_id, ','))) hansPersonName,
a.remark,
s.supplier supplierName
FROM
erp_accounthead a
LEFT JOIN erp_supplier s ON a.organ_id = s.id
WHERE
a.delete_flag = '0'
AND a.tenant_id = #{userId}
AND a.type = '3'
<if test="billNo != '' and billNo != null">
AND a.bill_no LIKE '%${billNo}%'
</if>
<if test="startTime != '' and startTime != null and endTime != '' and endTime != null">
AND a.bill_time >= #{startTime} AND #{endTime} >= a.bill_time
</if>
ORDER BY a.bill_time DESC, a.id ASC
</select>
</mapper>

View file

@ -449,6 +449,11 @@
<url id="receivables006" path="/post/ReceivablesController/queryReceivablesByDetail" val="查询收款单详情" allUse="2">
<property id="rowId" name="id" ref="required" var="收款单Id"></property>
</url>
<url id="receivables007" path="/post/ReceivablesController/queryMationToExcel" val="导出Excel" allUse="1">
<property id="billNo" name="billNo" ref="" var="单据编号" />
<property id="startTime" name="startTime" ref="" var="开始日期" />
<property id="endTime" name="endTime" ref="" var="结束日期" />
</url>
<!-- 收款单管理结束 -->
<!-- 付款单管理开始 -->

View file

@ -15,7 +15,8 @@ layui.config({
form = layui.form,
laydate = layui.laydate,
table = layui.table;
authBtn('1571810865614');
authBtn('1571810865614');//新增
authBtn('1572314972518');//导出
laydate.render({
elem: '#billTime', //指定元素
@ -42,7 +43,6 @@ layui.config({
{ field: 'totalPrice', title: '合计金额', align: 'left', width: 120},
{ field: 'hansPersonName', title: '经手人', align: 'left', width: 100},
{ field: 'billTime', title: '单据日期', align: 'center', width: 140 },
{ field: 'remark', title: '备注', align: 'center', width: 140 },
{ title: '操作', fixed: 'right', align: 'center', width: 200, toolbar: '#tableBar'}
]]
});
@ -142,7 +142,7 @@ layui.config({
$("body").on("click", "#formSearch", function () {
refreshTable();
})
});
//刷新
function loadTable(){
@ -153,7 +153,7 @@ layui.config({
startTime = $("#billTime").val().split('~')[0].trim() + ' 00:00:00';
endTime = $("#billTime").val().split('~')[1].trim() + ' 23:59:59';
}
table.reload("messageTable", {where:{billNo: $("#billNo").val(), material: $("#material").val(), startTime: startTime, endTime: endTime}});
table.reload("messageTable", {where:{billNo: $("#billNo").val(), startTime: startTime, endTime: endTime}});
}
//搜索
@ -165,8 +165,24 @@ layui.config({
startTime = $("#billTime").val().split('~')[0].trim() + ' 00:00:00';
endTime = $("#billTime").val().split('~')[1].trim() + ' 23:59:59';
}
table.reload("messageTable", {page: {curr: 1}, where:{billNo: $("#billNo").val(), material: $("#material").val(), startTime: startTime, endTime: endTime}})
table.reload("messageTable", {page: {curr: 1}, where:{billNo: $("#billNo").val(), startTime: startTime, endTime: endTime}})
}
//导出excel
$("body").on("click", "#downloadExcel", function () {
if(isNull($("#billTime").val())){//一定要记得当createTime为空时
startTime = "";
endTime = "";
}else {
startTime = $("#billTime").val().split('~')[0].trim() + ' 00:00:00';
endTime = $("#billTime").val().split('~')[1].trim() + ' 23:59:59';
}
postDownLoadFile({
url : reqBasePath + 'receivables007?userToken=' + getCookie('userToken') + '&loginPCIp=' + returnCitySN["cip"],
params: {billNo: $("#billNo").val(), startTime: startTime, endTime: endTime},
method : 'post'
});
});
exports('receivableslist', {});
});

View file

@ -30,6 +30,7 @@
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn" auth="1571810865614"><i class="fa fa-plus" aria-hidden="true"></i>新增</button>
<button id="downloadExcel" class="winui-toolbtn" auth="1572314972518"><i class="fa fa-download" aria-hidden="true"></i>导出Excel</button>
</div>
</div>
<div style="margin:auto 10px;">