优化代码

This commit is contained in:
jinqiming 2021-09-30 15:59:21 +08:00
parent fe2c647102
commit 93df70d6cc
20 changed files with 625 additions and 219 deletions

View File

@ -6,8 +6,10 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelReader;
import com.alibaba.excel.read.metadata.ReadSheet;
import com.snow.framework.excel.FinanceAlipayFlowListener;
import com.snow.framework.excel.FinanceWeChartFlowListener;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.FinanceAlipayFlowImport;
import com.snow.system.domain.FinanceWeChatFlowImport;
import com.snow.system.domain.SysUser;
import com.snow.system.mapper.FinanceAlipayFlowMapper;
import com.snow.system.mapper.SysUserMapper;
@ -141,19 +143,37 @@ public class FinanceFlowController extends BaseController
}
@Log(title = "财务支付宝流水", businessType = BusinessType.IMPORT)
@Log(title = "财务账单流水", businessType = BusinessType.IMPORT)
@RequiresPermissions("system:flow:import")
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, String tradeRealName,String tradeAccount,String billType) throws Exception
{
SysUser sysUser = ShiroUtils.getSysUser();
FinanceAlipayFlowListener financeAlipayFlowListener = new FinanceAlipayFlowListener(financeAlipayFlowService, sysUser, tradeAccount,tradeRealName,Integer.parseInt(billType));
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), FinanceAlipayFlowImport.class, financeAlipayFlowListener).build();
ReadSheet readSheet = EasyExcel.readSheet(0).build();
excelReader.read(readSheet);
// 这里千万别忘记关闭读的时候会创建临时文件到时磁盘会崩的
excelReader.finish();
if(billType.equals("1")){
FinanceAlipayFlowListener financeAlipayFlowListener = new FinanceAlipayFlowListener(financeAlipayFlowService, sysUser, tradeAccount,tradeRealName,Integer.parseInt(billType));
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), FinanceAlipayFlowImport.class, financeAlipayFlowListener).build();
ReadSheet readSheet = EasyExcel.readSheet(0)
// 这里可以设置1因为头就是一行如果多行头可以设置其他值不传入也可以因为默认会根据DemoData 来解析他没有指定头也就是默认1行
.headRowNumber(5).build();
excelReader.read(readSheet);
// 这里千万别忘记关闭读的时候会创建临时文件到时磁盘会崩的
excelReader.finish();
}else if(billType.equals("2")){
FinanceWeChartFlowListener financeWeChartFlowListener = new FinanceWeChartFlowListener(financeAlipayFlowService, sysUser, tradeAccount,tradeRealName,Integer.parseInt(billType));
ExcelReader excelReader = EasyExcel.read(file.getInputStream(), FinanceWeChatFlowImport.class, financeWeChartFlowListener).build();
//微信账单是从第十五行开始读的
ReadSheet readSheet = EasyExcel.readSheet(0)
// 这里可以设置1因为头就是一行如果多行头可以设置其他值不传入也可以因为默认会根据DemoData 来解析他没有指定头也就是默认1行
.headRowNumber(17).build();
excelReader.read(readSheet);
// 这里千万别忘记关闭读的时候会创建临时文件到时磁盘会崩的
excelReader.finish();
}
return AjaxResult.success("导入成功");
}
}

View File

@ -7,10 +7,19 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-flow-add">
<div class="form-group">
<label class="col-sm-3 control-label">账单类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('bill_type')}">
<input type="radio" th:id="${'billType_' + dict.dictCode}" name=" billType" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'billType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易号:</label>
<div class="col-sm-8">
<input name="tradeNo" class="form-control" type="text">
<input name="tradeNo" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
@ -23,8 +32,7 @@
<label class="col-sm-3 control-label">交易创建时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="tradeCreateTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input name="tradeCreateTime" class="datetime-input form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text" required>
</div>
</div>
</div>
@ -32,17 +40,55 @@
<label class="col-sm-3 control-label">交易支付时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="payTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input name="payTime" class="datetime-input form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text" required>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">最近修改时间</label>
<div class="form-group">
<label class="col-sm-3 control-label">收支类型</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="lastModifyTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<div class="radio-box" th:each="dict : ${@dict.getType('income_expenditure_type')}">
<input type="radio" th:id="${'incomeExpenditureType_' + dict.dictCode}" name="incomeExpenditureType" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'incomeExpenditureType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">真实收支类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('finance_real_sz_type')}">
<input type="radio" th:id="${'realIncomeExpenditureType_' + dict.dictCode}" name="realIncomeExpenditureType" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'realIncomeExpenditureType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">商品:</label>
<div class="col-sm-8">
<input name="goodsName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易金额:</label>
<div class="col-sm-8">
<input name="tradePrice" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">财务用途:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('real_finance_type')}">
<input type="radio" th:id="${'realFinanceType_' + dict.dictCode}" name="realFinanceType" th:value="${dict.dictValue}" th:checked="${dict.default}" >
<label th:for="${'realFinanceType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('trade_status_type')}">
<input type="radio" th:id="${'tradeStatus_' + dict.dictCode}" name="tradeStatus" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'tradeStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
@ -61,36 +107,14 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易对方:</label>
<div class="col-sm-8">
<input name="counterparty" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易金额:</label>
<div class="col-sm-8">
<input name="tradePrice" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('trade_status_type')}">
<input type="radio" th:id="${'tradeStatus_' + dict.dictCode}" name="tradeStatus" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'tradeStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">收支类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('income_expenditure_type')}">
<input type="radio" th:id="${'incomeExpenditureType_' + dict.dictCode}" name="incomeExpenditureType" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'incomeExpenditureType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">服务费:</label>
<div class="col-sm-8">
@ -112,12 +136,6 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属人:</label>
<div class="col-sm-8">
<input name="belongUserId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易主体账户:</label>
<div class="col-sm-8">
@ -147,7 +165,7 @@
}
$("input[name='tradeCreateTime']").datetimepicker({
format: "yyyy-mm-dd",
format: "yyyy-mm-dd hh:mm:ss",
minView: "month",
autoclose: true
});

View File

@ -11,20 +11,47 @@
<div class="form-group">
<label class="col-sm-3 control-label">交易号:</label>
<div class="col-sm-8">
<input name="tradeNo" th:field="*{tradeNo}" class="form-control" type="text">
<input name="tradeNo" th:field="*{tradeNo}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">商家订单号:</label>
<div class="col-sm-8">
<input name="orderNo" th:field="*{orderNo}" class="form-control" type="text">
<input name="orderNo" th:field="*{orderNo}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">商品:</label>
<div class="col-sm-8">
<input name="goodsName" th:field="*{goodsName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易对方:</label>
<div class="col-sm-8">
<input name="counterparty" th:field="*{counterparty}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易金额:</label>
<div class="col-sm-8">
<input name="tradePrice" th:field="*{tradePrice}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">财务用途:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('real_finance_type')}">
<input type="radio" th:id="${'realFinanceType_' + dict.dictCode}" name="realFinanceType" th:value="${dict.dictValue}" th:field="*{realFinanceType}">
<label th:for="${'realFinanceType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易创建时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="tradeCreateTime" th:value="${#dates.format(financeAlipayFlow.tradeCreateTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<input name="tradeCreateTime" th:value="${#dates.format(financeAlipayFlow.tradeCreateTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
@ -33,16 +60,7 @@
<label class="col-sm-3 control-label">交易支付时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="payTime" th:value="${#dates.format(financeAlipayFlow.payTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">最近修改时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="lastModifyTime" th:value="${#dates.format(financeAlipayFlow.lastModifyTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<input name="payTime" th:value="${#dates.format(financeAlipayFlow.payTime, 'yyyy-MM-dd hh:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly="readonly">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
@ -62,19 +80,8 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易对方:</label>
<div class="col-sm-8">
<input name="counterparty" th:field="*{counterparty}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易金额:</label>
<div class="col-sm-8">
<input name="tradePrice" th:field="*{tradePrice}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<div class="form-group">
<label class="col-sm-3 control-label">交易状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('trade_status_type')}">
@ -92,6 +99,15 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">真实收支类型:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('finance_real_sz_type')}">
<input type="radio" th:id="${'realIncomeExpenditureType_' + dict.dictCode}" name="realIncomeExpenditureType" th:value="${dict.dictValue}" th:field="*{realIncomeExpenditureType}">
<label th:for="${'realIncomeExpenditureType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">服务费:</label>
<div class="col-sm-8">
@ -113,18 +129,6 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属人:</label>
<div class="col-sm-8">
<input name="belongUserId" th:field="*{belongUserId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易主体账户:</label>
<div class="col-sm-8">
<input name="tradeAccount" th:field="*{tradeAccount}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">交易真实姓名:</label>
<div class="col-sm-8">
@ -147,18 +151,6 @@
}
}
$("input[name='tradeCreateTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='payTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='lastModifyTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

View File

@ -17,7 +17,7 @@
<input type="text" name="tradeNo"/>
</li>
<li>
<label>商家订单号:</label>
<label>订单号:</label>
<input type="text" name="orderNo"/>
</li>
<li>
@ -39,16 +39,16 @@
</select>
</li>
<li>
<label>收支类型</label>
<select name="incomeExpenditureType" th:with="type=${@dict.getType('income_expenditure_type')}">
<label>真实收支:</label>
<select name="realIncomeExpenditureType" th:with="type=${@dict.getType('real_income_expenditure_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>资金状态</label>
<select name="capitalStatus" th:with="type=${@dict.getType('capital_status')}">
<label>财务用途</label>
<select name="realFinanceType" th:with="type=${@dict.getType('real_finance_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
@ -76,8 +76,14 @@
<a class="btn btn-info" onclick="$.table.importExcelAlipay()" shiro:hasPermission="system:flow:import">
<i class="fa fa-upload"></i> 导入
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:flow:export">
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:flow:export">
<i class="fa fa-download"></i> 导出
</a>-->
<a class="btn btn-primary" onclick="designDicType('127')" shiro:hasPermission="system:flow:designTradeType">
<i class="fa fa-sort-numeric-desc"></i> 设计收支类型
</a>
<a class="btn btn-warning" onclick="designDicType('128')" shiro:hasPermission="system:flow:designTradeType">
<i class="fa fa-cny"></i> 设计财务用途
</a>
</div>
<div class="col-sm-12 select-table table-striped">
@ -93,6 +99,8 @@
var tradeTypeDatas = [[${@dict.getType('trade_type')}]];
var tradeStatusDatas = [[${@dict.getType('trade_status_type')}]];
var incomeExpenditureTypeDatas = [[${@dict.getType('income_expenditure_type')}]];
var realIncomeExpenditureTypeDatas = [[${@dict.getType('finance_real_sz_type')}]];
var realFinanceTypeDatas = [[${@dict.getType('real_finance_type')}]];
var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var billTypeDatas = [[${@dict.getType('bill_type')}]];
var prefix = ctx + "system/flow";
@ -107,7 +115,10 @@
importUrl: prefix + "/importData",
importTemplateUrl: prefix + "/importTemplate",
modalName: "财务账单流水",
columns: [{
showFooter: true,
footerStyle: footerStyle,
columns:
[{
checkbox: true
},
{
@ -119,11 +130,7 @@
field: 'tradeNo',
title: '交易号',
formatter: function(value, row, index) {
if(value==null||value==''){
return '';
}else {
return value.substr(0,8);
}
return $.table.tooltip(value);
}
},
@ -131,25 +138,28 @@
field: 'orderNo',
title: '商家订单号',
formatter: function(value, row, index) {
if(value==null||value==''){
return '';
}else {
return value.substr(0,8);
}
return $.table.tooltip(value);
}
},
{
field: 'goodsName',
title: '商品',
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'goodsName',
title: '商品'
},
{
field: 'tradePrice',
title: '交易金额'
field: 'realFinanceType',
title: '财务用途',
formatter: function(value, row, index) {
return $.table.selectDictLabel(realFinanceTypeDatas, value);
}
},
{
field: 'payTime',
title: '交易支付时间'
},
field: 'tradePrice',
title: '交易金额(元)'
},
{
field: 'billType',
title: '账单类型',
@ -166,7 +176,10 @@
},
{
field: 'counterparty',
title: '交易对方'
title: '交易对方',
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
@ -178,16 +191,60 @@
},
{
field: 'incomeExpenditureType',
title: '收支类型',
title: '账单收支类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(incomeExpenditureTypeDatas, value);
},
footerFormatter:function (value) {
var tradePrice = 0;
for (var i in value) {
//支出
if(value[i].realIncomeExpenditureType==2){
tradePrice+=parseFloat(value[i].tradePrice);
}
}
return "总收入:" + tradePrice;
}
},
{
field: 'realIncomeExpenditureType',
title: '真实收支类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(realIncomeExpenditureTypeDatas, value);
},
footerFormatter:function (value) {
var tradePrice = 0;
for (var i in value) {
//支出
if(value[i].realIncomeExpenditureType==1){
tradePrice+=parseFloat(value[i].tradePrice);
}
}
return "总支出:" + tradePrice;
}
},
{
field: 'payTime',
title: '交易时间',
footerFormatter:function (value) {
var tradePrice = 0;
for (var i in value) {
//支出
if(value[i].realIncomeExpenditureType==1){
tradePrice-=parseFloat(value[i].tradePrice);
}else if(value[i].realIncomeExpenditureType==2){
tradePrice += parseFloat(value[i].tradePrice);
}
}
return "总金额:" + tradePrice;
}
},
/*
{
field: 'belongUserName',
title: '所属人'
},
},*/
{
title: '操作',
align: 'center',
@ -201,6 +258,23 @@
};
$.table.init(options);
});
function importTemplate(fileName) {
window.location.href = "/common/downloadExcel?fileName="+fileName;
}
/*字典列表-详细*/
function designDicType(dictId) {
var url = '/system/dict/detail/' + dictId;
$.modal.openTab("字典数据", url);
}
function footerStyle(column) {
return {
tradePrice: {
css: { color: 'red', 'font-weight': 'normal' }
}
}[column.field]
}
</script>
</body>
<!-- 导入区域 -->
@ -209,12 +283,20 @@
<div class="col-xs-offset-1">
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label">导入数据</label>
<div class="col-sm-4">
<input type="file" id="file" name="file"/>
<label class="col-sm-3 control-label">下载模板</label>
<div class="col-sm-3">
<a onclick="importTemplate('alipay_record_excel.xlsx')" class="btn btn-xs btn-danger"><i class="fa fa-file-excel-o"></i> 下载支付宝模板</a>
</div>
<div class="col-sm-4">
<a onclick="$.table.importTemplate()" class="btn btn-xs btn-danger"><i class="fa fa-file-excel-o"></i> 下载模板</a>
<div class="col-sm-3">
<a onclick="importTemplate('wechat_excel')" class="btn btn-xs btn-danger"><i class="fa fa-file-excel-o"></i> 下载微信模板</a>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<label class="col-sm-3 control-label">导入数据:</label>
<div class="col-sm-5">
<input type="file" id="file" name="file"/>
</div>
</div>
</div>
@ -246,7 +328,7 @@
</div>
</div>
<font color="red" class="pull-left mt10">
提示仅允许导入“xls”或“xlsx”格式文件
提示仅允许导入“xls”或“xlsx”格式文件支付宝和微信导出的账单是csv格式请转换成支持的格式再导入。<h4>切记:千万不要直接改文件后缀名字!!!</h4>
</font>
</div>
</form>

View File

@ -16,8 +16,8 @@ public enum FinanceTradeType {
WX_SINGLE_RED_PACKETS(7, "微信红包(单发)"),
WX_RED_PACKETS_REFUND(8, "微信红包-退款"),
SCANNER_QR_CODE_PAYMENT(9, "扫二维码付款"),
QR_CODE_PAYMENT(10, "二维码收款");
QR_CODE_PAYMENT(10, "二维码收款"),
GROUP_COLLECTION(11, "群收款");
private final Integer code;
private final String info;

View File

@ -3,23 +3,15 @@ package com.snow.common.utils.poi;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.WriteWorkbook;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.snow.common.annotation.Excel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.concurrent.Future;
/**
* @author qimingjin

View File

@ -3,7 +3,9 @@ package com.snow.framework.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.snow.common.enums.FinanceTradeType;
import com.snow.common.exception.BusinessException;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import com.snow.common.utils.bean.BeanUtils;
import com.snow.system.domain.FinanceAlipayFlow;
import com.snow.system.domain.FinanceAlipayFlowImport;
@ -11,7 +13,6 @@ import com.snow.system.domain.SysUser;
import com.snow.system.service.IFinanceAlipayFlowService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
@ -72,12 +73,21 @@ public class FinanceAlipayFlowListener extends AnalysisEventListener<FinanceAlip
@Override
public void invoke(FinanceAlipayFlowImport financeAlipayFlowImport, AnalysisContext analysisContext) {
//没有读取到金额直接返回
if(StringUtils.isNull(financeAlipayFlowImport.getTradePrice())){
return;
}
list.add(financeAlipayFlowImport);
}
//读取excel表头信息
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
String firstHead = headMap.get(0);
Integer rowIndex = context.readRowHolder().getRowIndex();
if(!firstHead.equals("支付宝交易记录明细查询")&&rowIndex==0){
throw new BusinessException("非标准化模板请勿导入,请下载标准模板或使用支付宝导出的原账单模板");
}
System.out.println("表头信息:"+headMap);
}
@ -93,20 +103,25 @@ public class FinanceAlipayFlowListener extends AnalysisEventListener<FinanceAlip
public void saveData(){
List<FinanceAlipayFlow> financeAlipayFlowList = list.stream().map(t -> {
//数据校验交易号
FinanceAlipayFlow financeAlipayFlow1 = financeAlipayFlowService.selectFinanceAlipayFlowByTradeNo(t.getTradeNo());
if(StringUtils.isNotNull(financeAlipayFlow1)){
throw new BusinessException("交易号:【"+t.getTradeNo()+"】已存在请勿重复导入数据");
}
FinanceAlipayFlow financeAlipayFlow = new FinanceAlipayFlow();
BeanUtils.copyProperties(t, financeAlipayFlow);
String payTime = t.getPayTime();
String tradeCreateTime = t.getTradeCreateTime();
String lastModifyTime = t.getLastModifyTime();
if (!StringUtils.isEmpty(payTime)) {
if (StringUtils.isNotEmpty(payTime)) {
Date date = DateUtils.parseDate(payTime);
financeAlipayFlow.setPayTime(date);
}
if (!StringUtils.isEmpty(tradeCreateTime)) {
if (StringUtils.isNotEmpty(tradeCreateTime)) {
Date date = DateUtils.parseDate(tradeCreateTime);
financeAlipayFlow.setTradeCreateTime(date);
}
if (!StringUtils.isEmpty(lastModifyTime)) {
if (StringUtils.isNotEmpty(lastModifyTime)) {
Date date = DateUtils.parseDate(lastModifyTime);
financeAlipayFlow.setLastModifyTime(date);
}
@ -126,10 +141,13 @@ public class FinanceAlipayFlowListener extends AnalysisEventListener<FinanceAlip
String incomeExpenditureType = t.getIncomeExpenditureType();
if (StringUtils.isEmpty(incomeExpenditureType)) {
financeAlipayFlow.setIncomeExpenditureType(0);
financeAlipayFlow.setRealIncomeExpenditureType(0);
} else if (incomeExpenditureType.equals("收入")) {
financeAlipayFlow.setIncomeExpenditureType(2);
financeAlipayFlow.setRealIncomeExpenditureType(2);
} else if (incomeExpenditureType.equals("支出")) {
financeAlipayFlow.setIncomeExpenditureType(1);
financeAlipayFlow.setRealIncomeExpenditureType(1);
}
String tradeStatus = t.getTradeStatus();
if (StringUtils.isEmpty(tradeStatus)) {

View File

@ -0,0 +1,153 @@
package com.snow.framework.excel;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.snow.common.enums.FinanceTradeType;
import com.snow.common.exception.BusinessException;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.bean.BeanUtils;
import com.snow.system.domain.FinanceAlipayFlow;
import com.snow.system.domain.FinanceWeChatFlowImport;
import com.snow.system.domain.SysUser;
import com.snow.system.service.IFinanceAlipayFlowService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class FinanceWeChartFlowListener extends AnalysisEventListener<FinanceWeChatFlowImport> {
private static final Logger log = LoggerFactory.getLogger(FinanceAlipayFlowListener.class);
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
private IFinanceAlipayFlowService financeAlipayFlowService;
/**
* 导入人
*/
private SysUser sysUser;
/** 交易主体账户 */
private String tradeAccount;
/** 交易真实姓名 */
private String tradeRealName;
/**
* 账单类型
*/
private Integer billType;
/**
* 如果使用了spring,请使用这个构造方法每次创建Listener的时候需要把spring管理的类传进来
*
* @param financeAlipayFlowService
*/
public FinanceWeChartFlowListener(IFinanceAlipayFlowService financeAlipayFlowService, SysUser sysUser, String tradeAccount, String tradeRealName, Integer billType) {
this.financeAlipayFlowService = financeAlipayFlowService;
this.sysUser=sysUser;
this.tradeAccount=tradeAccount;
this.tradeRealName=tradeRealName;
this.billType=billType;
}
//创建list集合封装最终的数据
List<FinanceWeChatFlowImport> list = new ArrayList<>();
//一行一行去读取excle内容
@Override
public void invoke(FinanceWeChatFlowImport financeWeChatFlowImport, AnalysisContext analysisContext) {
//没有读取到金额直接返回
if(ObjectUtil.isNull(financeWeChatFlowImport.getTradePrice())){
return;
}
list.add(financeWeChatFlowImport);
}
//读取excel表头信息
@Override
public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
int size = headMap.size();
String firstHead = headMap.get(0);
Integer rowIndex = context.readRowHolder().getRowIndex();
if(!firstHead.equals("微信支付账单明细")&&rowIndex==0){
throw new BusinessException("非标准化模板请勿导入,请下载标准模板或使用微信导出的原账单模板");
}
System.out.println("表头信息:"+headMap);
}
//读取完成后执行
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
saveData();
}
/**
* 保存数据
*/
public void saveData(){
List<FinanceAlipayFlow> financeAlipayFlowList = list.stream().map(t -> {
FinanceAlipayFlow financeAlipayFlow1 = financeAlipayFlowService.selectFinanceAlipayFlowByTradeNo(t.getTradeNo());
if(ObjectUtil.isNotNull(financeAlipayFlow1)){
throw new BusinessException("交易号:【"+t.getTradeNo()+"】已存在请勿重复导入数据");
}
FinanceAlipayFlow financeAlipayFlow = new FinanceAlipayFlow();
BeanUtils.copyProperties(t, financeAlipayFlow);
String payTime = t.getPayTime();
if (!StringUtils.isEmpty(payTime)) {
Date date = DateUtils.parseDate(payTime);
financeAlipayFlow.setPayTime(date);
}
String incomeExpenditureType = t.getIncomeExpenditureType();
if (StringUtils.isEmpty(incomeExpenditureType)) {
financeAlipayFlow.setIncomeExpenditureType(0);
financeAlipayFlow.setRealIncomeExpenditureType(0);
} else if (incomeExpenditureType.equals("收入")) {
financeAlipayFlow.setIncomeExpenditureType(2);
financeAlipayFlow.setRealIncomeExpenditureType(2);
} else if (incomeExpenditureType.equals("支出")) {
financeAlipayFlow.setIncomeExpenditureType(1);
financeAlipayFlow.setRealIncomeExpenditureType(1);
}
String tradeStatus = t.getTradeStatus();
if (StringUtils.isEmpty(tradeStatus)) {
financeAlipayFlow.setTradeStatus(null);
} else if (tradeStatus.equals("交易成功")||tradeStatus.equals("已存入零钱")||tradeStatus.equals("支付成功")||tradeStatus.equals("朋友已收钱")) {
financeAlipayFlow.setTradeStatus(1);
} else if (tradeStatus.equals("交易关闭")) {
financeAlipayFlow.setTradeStatus(2);
} else if (tradeStatus.equals("还款成功")) {
financeAlipayFlow.setTradeStatus(3);
} else if (tradeStatus.equals("退款成功")||tradeStatus.contains("退款")) {
financeAlipayFlow.setTradeStatus(4);
}
String tradeType = t.getTradeType();
if (StringUtils.isEmpty(tradeType)) {
financeAlipayFlow.setTradeType(null);
}else {
Integer financeTradeTypeCode = FinanceTradeType.getFinanceTradeTypeCode(tradeType);
financeAlipayFlow.setTradeType(financeTradeTypeCode);
}
financeAlipayFlow.setCreateBy(sysUser.getUserName());
financeAlipayFlow.setBelongUserId(sysUser.getUserId());
financeAlipayFlow.setTradeRealName(tradeRealName);
financeAlipayFlow.setTradeAccount(tradeAccount);
financeAlipayFlow.setBillType(billType);
log.info("转化后的对象:financeAlipayFlow{}", com.alibaba.fastjson.JSON.toJSONString(financeAlipayFlow));
return financeAlipayFlow;
}).collect(Collectors.toList());
financeAlipayFlowService.insertBatchFinanceAlipayFlow(financeAlipayFlowList);
}
}

View File

@ -5,12 +5,13 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.util.Date;
/**
* 财务支付宝流水对象 finance_alipay_flow
*
*
* @author snow
* @date 2020-11-09
*/
@ -24,6 +25,7 @@ public class FinanceAlipayFlow extends BaseEntity
/** 交易号 */
@ExcelProperty(index = 1)
@NotBlank(message = "交易号不能为空")
private String tradeNo;
/** 商家订单号 */
@ -99,4 +101,15 @@ public class FinanceAlipayFlow extends BaseEntity
private Integer billType;
/**
* 真实账务类型
*/
private Integer realFinanceType;
/**
* 真实收支类型
*/
private Integer realIncomeExpenditureType;
private String year;
}

View File

@ -4,7 +4,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**

View File

@ -0,0 +1,58 @@
package com.snow.system.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 财务微信流水对象 finance_alipay_flow
*/
@Data
public class FinanceWeChatFlowImport {
/** 交易时间 */
@ExcelProperty("交易时间")
private String payTime;
/** 交易类型 */
@ExcelProperty("交易类型")
private String tradeType;
/** 交易创建时间 */
@ExcelProperty("交易对方")
private String counterparty;
/** 商品 */
@ExcelProperty("商品")
private String goodsName;
/** 收/支 */
@ExcelProperty("收/支")
private String incomeExpenditureType;
/** 金额(元) */
@ExcelProperty("金额(元)")
private BigDecimal tradePrice;
/** 支付方式 */
@ExcelProperty( "支付方式")
private String payType;
/** 当前状态 */
@ExcelProperty("当前状态")
private String tradeStatus;
/** 交易单号 */
@ExcelProperty("交易单号")
private String tradeNo;
/** 商户单号 */
@ExcelProperty("商户单号")
private String orderNo;
/** 备注 */
@ExcelProperty("备注")
private String remark;
}

View File

@ -1,9 +1,12 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.FinanceAlipayFlow;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
/**
* 财务支付宝流水Mapper接口
*
@ -20,6 +23,8 @@ public interface FinanceAlipayFlowMapper
*/
public FinanceAlipayFlow selectFinanceAlipayFlowById(Long id);
public FinanceAlipayFlow selectFinanceAlipayFlowByTradeNo(String tradeNo);
/**
* 查询财务支付宝流水列表
*
@ -66,4 +71,11 @@ public interface FinanceAlipayFlowMapper
* @return 结果
*/
public int deleteFinanceAlipayFlowByIds(String[] ids);
/**
*
* @param financeAlipayFlow
* @return
*/
public LinkedHashMap<String,BigDecimal> getFinanceAlipayFlowByYearAndMonth(FinanceAlipayFlow financeAlipayFlow);
}

View File

@ -1,9 +1,12 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.FinanceAlipayFlow;
import com.snow.system.domain.FinanceBillSituationVO;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
/**
* 财务支付宝流水Service接口
*
@ -20,6 +23,8 @@ public interface IFinanceAlipayFlowService
*/
public FinanceAlipayFlow selectFinanceAlipayFlowById(Long id);
public FinanceAlipayFlow selectFinanceAlipayFlowByTradeNo(String tradeNo);
/**
* 查询财务支付宝流水列表
*
@ -73,4 +78,6 @@ public interface IFinanceAlipayFlowService
* @return
*/
public FinanceBillSituationVO getFinanceAlipayFlowSituation(Long userId);
public LinkedHashMap<String,BigDecimal> getFinanceAlipayFlowByYearAndMonth(FinanceAlipayFlow financeAlipayFlow);
}

View File

@ -9,11 +9,12 @@ import com.snow.system.domain.SysUser;
import com.snow.system.mapper.FinanceAlipayFlowMapper;
import com.snow.system.mapper.SysUserMapper;
import com.snow.system.service.IFinanceAlipayFlowService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.LinkedHashMap;
import java.util.List;
/**
@ -23,7 +24,7 @@ import java.util.List;
* @date 2020-11-09
*/
@Service
public class FinanceAlipayFlowServiceImpl implements IFinanceAlipayFlowService
public class FinanceAlipayFlowServiceImpl implements IFinanceAlipayFlowService
{
@Autowired
private FinanceAlipayFlowMapper financeAlipayFlowMapper;
@ -41,6 +42,9 @@ public class FinanceAlipayFlowServiceImpl implements IFinanceAlipayFlowService
{
return financeAlipayFlowMapper.selectFinanceAlipayFlowById(id);
}
public FinanceAlipayFlow selectFinanceAlipayFlowByTradeNo(String tradeNo){
return financeAlipayFlowMapper.selectFinanceAlipayFlowByTradeNo(tradeNo);
}
/**
* 查询财务支付宝流水列表
@ -173,4 +177,10 @@ public class FinanceAlipayFlowServiceImpl implements IFinanceAlipayFlowService
}
return builder.build();
}
@Override
public LinkedHashMap<String,BigDecimal> getFinanceAlipayFlowByYearAndMonth(FinanceAlipayFlow financeAlipayFlow) {
return financeAlipayFlowMapper.getFinanceAlipayFlowByYearAndMonth(financeAlipayFlow);
}
}

View File

@ -1,18 +1,18 @@
package com.snow.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.snow.common.core.text.Convert;
import com.snow.system.domain.SysDingtalkSyncLog;
import com.snow.system.domain.SysDingtalkSyncSituationVO;
import com.snow.system.mapper.SysDingtalkSyncLogMapper;
import com.snow.system.service.ISysDingtalkSyncLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.snow.system.domain.SysDingtalkSyncSituationVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysDingtalkSyncLogMapper;
import com.snow.system.domain.SysDingtalkSyncLog;
import com.snow.system.service.ISysDingtalkSyncLogService;
import com.snow.common.core.text.Convert;
/**
* 钉钉同步日志记录Service业务层处理
*
@ -109,7 +109,7 @@ public class SysDingtalkSyncLogServiceImpl implements ISysDingtalkSyncLogService
List<SysDingtalkSyncLog> sysDingtalkSyncLogs = sysDingtalkSyncLogMapper.selectSysDingtalkSyncLogList(sysDingtalkSyncLog);
SysDingtalkSyncSituationVO.SysDingtalkSyncSituationVOBuilder sysDingtalkSyncSituationVOBuilder = SysDingtalkSyncSituationVO.builder();
if(CollectionUtils.isNotEmpty(sysDingtalkSyncLogs)){
if(CollUtil.isNotEmpty(sysDingtalkSyncLogs)){
long successCount = sysDingtalkSyncLogs.stream().filter(t -> t.getStatus() == 0).count();
long failureCount = sysDingtalkSyncLogs.stream().filter(t -> t.getStatus() == 1).count();
sysDingtalkSyncSituationVOBuilder.successNums(successCount).failureNums(failureCount);

View File

@ -1,21 +1,20 @@
package com.snow.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.mapper.SysMessageTransitionMapper;
import com.snow.system.service.ISysMessageTransitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysMessageTransitionMapper;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.service.ISysMessageTransitionService;
import com.snow.common.core.text.Convert;
/**
* 消息流转中心Service业务层处理
*
@ -56,7 +55,7 @@ public class SysMessageTransitionServiceImpl implements ISysMessageTransitionSer
isReadSysMessageTransition.setMessageType(sysMessageTransition.getMessageType());
isReadSysMessageTransition.setMessageStatus(0L);
List<SysMessageTransition> sysMessageTransitionList = sysMessageTransitionMapper.selectSysMessageTransitionList(isReadSysMessageTransition);
if(CollectionUtils.isNotEmpty(sysMessageTransitionList)){
if(CollUtil.isNotEmpty(sysMessageTransitionList)){
return sysMessageTransitionList.get(0).getMessageReadStatus()==1L;
}
return false;
@ -72,7 +71,7 @@ public class SysMessageTransitionServiceImpl implements ISysMessageTransitionSer
{
sysMessageTransition.setMessageStatus(0L);
List<SysMessageTransition> sysMessageTransitionList= sysMessageTransitionMapper.selectSysMessageTransitionList(sysMessageTransition);
if(CollectionUtils.isNotEmpty(sysMessageTransitionList)){
if(CollUtil.isNotEmpty(sysMessageTransitionList)){
sysMessageTransitionList.forEach(t->{
t.setProducerUser(sysUserService.selectUserById(Long.parseLong(t.getProducerId())));
t.setConsumerUser(sysUserService.selectUserById(Long.parseLong(t.getConsumerId())));

View File

@ -1,15 +1,16 @@
package com.snow.system.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollUtil;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.DateUtils;
import com.snow.common.utils.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import com.snow.system.domain.SysOaCustomer;
import com.snow.system.mapper.SysOaCustomerMapper;
import com.snow.system.service.ISysOaCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysOaCustomerMapper;
import com.snow.system.domain.SysOaCustomer;
import com.snow.system.service.ISysOaCustomerService;
import com.snow.common.core.text.Convert;
import java.util.List;
/**
* 客户Service业务层处理
@ -58,7 +59,7 @@ public class SysOaCustomerServiceImpl implements ISysOaCustomerService
public List<SysOaCustomer> selectSysOaCustomerList(SysOaCustomer sysOaCustomer)
{
List<SysOaCustomer> sysOaCustomerList= sysOaCustomerMapper.selectSysOaCustomerList(sysOaCustomer);
if(CollectionUtils.isNotEmpty(sysOaCustomerList)){
if(CollUtil.isNotEmpty(sysOaCustomerList)){
sysOaCustomerList.forEach(t->{
if(StringUtils.isNotNull(t.getCustomerManager())){
t.setCustomerManagerName(sysUserServicel.selectUserById(Long.parseLong(t.getCustomerManager())).getUserName());

View File

@ -1,25 +1,25 @@
package com.snow.system.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.core.text.Convert;
import com.snow.common.enums.MessageEventType;
import com.snow.common.utils.DateUtils;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.domain.SysOaEmail;
import com.snow.system.domain.SysOaEmailDO;
import com.snow.system.domain.SysOaEmailVO;
import com.snow.system.mapper.SysOaEmailMapper;
import com.snow.system.service.ISysOaEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.date.BetweenFormater;
import cn.hutool.core.date.DateUtil;
import com.snow.common.enums.MessageEventType;
import com.snow.common.utils.DateUtils;
import com.snow.system.domain.SysMessageTransition;
import com.snow.system.domain.SysOaEmailDO;
import com.snow.system.domain.SysOaEmailVO;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysOaEmailMapper;
import com.snow.system.domain.SysOaEmail;
import com.snow.system.service.ISysOaEmailService;
import com.snow.common.core.text.Convert;
/**
* 邮件Service业务层处理
*
@ -71,7 +71,7 @@ public class SysOaEmailServiceImpl implements ISysOaEmailService
sysMessageTransition.setMessageStatus(0L);
sysMessageTransition.setMessageReadStatus(0L);
List<SysMessageTransition> sysMessageTransitions = sysMessageTransitionService.selectSysMessageTransitionList(sysMessageTransition);
if(CollectionUtils.isNotEmpty(sysMessageTransitions)){
if(CollUtil.isNotEmpty(sysMessageTransitions)){
List<String> emailNoList = sysMessageTransitions.stream().map(SysMessageTransition::getMessageOutsideId).collect(Collectors.toList());
SysOaEmail sysOaEmail=new SysOaEmail();
sysOaEmail.setEmailNoList(emailNoList);
@ -90,7 +90,7 @@ public class SysOaEmailServiceImpl implements ISysOaEmailService
{
List<SysOaEmail> sysOaEmailList = sysOaEmailMapper.selectSysOaEmailList(sysOaEmail);
if(CollectionUtils.isNotEmpty(sysOaEmailList)){
if(CollUtil.isNotEmpty(sysOaEmailList)){
sysOaEmailList.forEach(t->{
t.setSpendTime(DateUtil.formatBetween(t.getSendTime(), new Date(), BetweenFormater.Level.SECOND)+"");
SysMessageTransition sysMessageTransition=new SysMessageTransition();
@ -98,7 +98,7 @@ public class SysOaEmailServiceImpl implements ISysOaEmailService
sysMessageTransition.setMessageStatus(0L);
sysMessageTransition.setMessageOutsideId(t.getEmailNo());
List<SysMessageTransition> sysMessageTransitions = sysMessageTransitionService.selectSysMessageTransitionList(sysMessageTransition);
if(CollectionUtils.isNotEmpty(sysMessageTransitions)){
if(CollUtil.isNotEmpty(sysMessageTransitions)){
//生产者只有一个直接get(0)就行了
t.setEmailFromUser(sysMessageTransitions.get(0).getProducerUser());
//消费者存在多个
@ -112,7 +112,7 @@ public class SysOaEmailServiceImpl implements ISysOaEmailService
@Override
public List<SysOaEmailVO> selectEmailList(SysOaEmailDO sysOaEmailDO) {
List<SysOaEmailVO> sysOaEmailVOS = sysOaEmailMapper.selectEmailList(sysOaEmailDO);
if(CollectionUtils.isNotEmpty(sysOaEmailVOS)){
if(CollUtil.isNotEmpty(sysOaEmailVOS)){
sysOaEmailVOS.forEach(t->{
t.setProducerUser(sysUserService.selectUserById(Long.parseLong(t.getProducerId())));
t.setConsumerUser(sysUserService.selectUserById(Long.parseLong(t.getConsumerId())));

View File

@ -1,21 +1,17 @@
package com.snow.system.service.impl;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.stream.Collectors;
import cn.hutool.core.bean.BeanUtil;
import com.snow.common.core.domain.Ztree;
import com.snow.common.core.text.Convert;
import com.snow.common.utils.bean.BeanUtils;
import com.snow.system.domain.RegionTreeVO;
import org.apache.commons.collections.CollectionUtils;
import com.snow.system.domain.SysOaRegion;
import com.snow.system.mapper.SysOaRegionMapper;
import com.snow.system.service.ISysOaRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysOaRegionMapper;
import com.snow.system.domain.SysOaRegion;
import com.snow.system.service.ISysOaRegionService;
import com.snow.common.core.text.Convert;
import java.util.ArrayList;
import java.util.List;
/**
* 地区Service业务层处理

View File

@ -28,10 +28,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="goodsName" column="goods_name" />
<result property="billType" column="bill_type" />
<result property="realFinanceType" column="real_finance_type" />
<result property="realIncomeExpenditureType" column="real_income_expenditure_type" />
</resultMap>
<sql id="selectFinanceAlipayFlowVo">
select id, trade_no, order_no, trade_create_time, pay_time, last_modify_time, trade_source_place, trade_type, counterparty, trade_price, trade_status, income_expenditure_type, service_charge, refund_price, capital_status, remark, belong_user_id, trade_account, trade_real_name, create_time, create_by,goods_name,bill_type from finance_alipay_flow
select id, trade_no, order_no, trade_create_time, pay_time, last_modify_time, trade_source_place, trade_type, counterparty, trade_price, trade_status, income_expenditure_type, service_charge, refund_price, capital_status, remark, belong_user_id, trade_account, trade_real_name, create_time, create_by,goods_name,bill_type,real_finance_type,real_income_expenditure_type from finance_alipay_flow
</sql>
<select id="selectFinanceAlipayFlowList" parameterType="FinanceAlipayFlow" resultMap="FinanceAlipayFlowResult">
@ -48,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tradePrice != null "> and trade_price = #{tradePrice}</if>
<if test="tradeStatus != null "> and trade_status = #{tradeStatus}</if>
<if test="incomeExpenditureType != null "> and income_expenditure_type = #{incomeExpenditureType}</if>
<if test="realIncomeExpenditureType != null "> and real_income_expenditure_type = #{realIncomeExpenditureType}</if>
<if test="realFinanceType != null "> and real_finance_type = #{realFinanceType}</if>
<if test="serviceCharge != null "> and service_charge = #{serviceCharge}</if>
<if test="refundPrice != null "> and refund_price = #{refundPrice}</if>
<if test="capitalStatus != null "> and capital_status = #{capitalStatus}</if>
@ -57,13 +61,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tradeRealName != null and tradeRealName != ''"> and trade_real_name like concat('%', #{tradeRealName}, '%')</if>
<if test="goodsName != null and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
</where>
order by pay_time desc
</select>
<select id="selectFinanceAlipayFlowById" parameterType="Long" resultMap="FinanceAlipayFlowResult">
<include refid="selectFinanceAlipayFlowVo"/>
where id = #{id}
</select>
<select id="selectFinanceAlipayFlowByTradeNo" parameterType="String" resultMap="FinanceAlipayFlowResult">
<include refid="selectFinanceAlipayFlowVo"/>
where trade_no = #{tradeNo}
</select>
<insert id="insertFinanceAlipayFlow" parameterType="FinanceAlipayFlow" useGeneratedKeys="true" keyProperty="id">
insert into finance_alipay_flow
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -89,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by,</if>
<if test="goodsName != null">goods_name,</if>
<if test="billType != null "> bill_type,</if>
<if test="realIncomeExpenditureType != null "> real_income_expenditure_type, </if>
<if test="realFinanceType != null "> real_finance_type, </if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tradeNo != null">#{tradeNo},</if>
@ -113,14 +126,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">#{createBy},</if>
<if test="goodsName != null">#{goodsName},</if>
<if test="billType != null "> #{billType},</if>
<if test="realIncomeExpenditureType != null "> #{realIncomeExpenditureType},</if>
<if test="realFinanceType != null "> #{realFinanceType},</if>
</trim>
</insert>
<insert id="insertBatchFinanceAlipayFlow" parameterType="java.util.List">
insert into finance_alipay_flow (trade_no, order_no, trade_create_time, pay_time, last_modify_time, trade_source_place, trade_type, counterparty, trade_price, trade_status, income_expenditure_type, service_charge, refund_price, capital_status, remark, belong_user_id, trade_account, trade_real_name, create_time, create_by,goods_name,bill_type) values
insert into finance_alipay_flow (trade_no, order_no, trade_create_time, pay_time, last_modify_time, trade_source_place, trade_type, counterparty, trade_price, trade_status, income_expenditure_type, service_charge, refund_price, capital_status, remark, belong_user_id, trade_account, trade_real_name, create_time, create_by,goods_name,bill_type,real_income_expenditure_type,real_finance_type) values
<foreach collection="financeAlipayFlowList" item="item" separator="," close=";">
(
#{item.tradeNo}, #{item.orderNo}, #{item.tradeCreateTime}, #{item.payTime}, #{item.lastModifyTime}, #{item.tradeSourcePlace}, #{item.tradeType}
,#{item.counterparty}, #{item.tradePrice}, #{item.tradeStatus}, #{item.incomeExpenditureType}, #{item.serviceCharge}, #{item.refundPrice}, #{item.capitalStatus},#{item.remark}, #{item.belongUserId}, #{item.tradeAccount}, #{item.tradeRealName}, now(), #{item.createBy}, #{item.goodsName},#{item.billType}
,#{item.counterparty}, #{item.tradePrice}, #{item.tradeStatus}, #{item.incomeExpenditureType}, #{item.serviceCharge}, #{item.refundPrice}, #{item.capitalStatus},#{item.remark}, #{item.belongUserId}, #{item.tradeAccount}, #{item.tradeRealName}, now(), #{item.createBy}, #{item.goodsName},#{item.billType}, #{item.realIncomeExpenditureType},#{item.realFinanceType}
)
</foreach>
</insert>
@ -149,6 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createBy != null">create_by = #{createBy},</if>
<if test="goodsName != null">goods_name = #{goodsName},</if>
<if test="billType != null "> bill_type = #{billType},</if>
<if test="realIncomeExpenditureType != null "> real_income_expenditure_type = #{realIncomeExpenditureType},</if>
<if test="realFinanceType != null "> real_finance_type = #{realFinanceType},</if>
</trim>
where id = #{id}
</update>
@ -163,5 +180,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="getFinanceAlipayFlowByYearAndMonth" parameterType="FinanceAlipayFlow" resultType="java.util.LinkedHashMap">
select sum(case month(pay_time) when '1' then trade_price else 0 end) as Jan,
sum(case month(pay_time) when '2' then trade_price else 0 end) as Feb,
sum(case month(pay_time) when '3' then trade_price else 0 end) as Mar,
sum(case month(pay_time) when '4' then trade_price else 0 end) as Apr,
sum(case month(pay_time) when '5' then trade_price else 0 end) as May,
sum(case month(pay_time) when '6' then trade_price else 0 end) as June,
sum(case month(pay_time) when '7' then trade_price else 0 end) as July,
sum(case month(pay_time) when '8' then trade_price else 0 end) as Aug,
sum(case month(pay_time) when '9' then trade_price else 0 end) as Sept,
sum(case month(pay_time) when '10' then trade_price else 0 end) as Oct,
sum(case month(pay_time) when '11' then trade_price else 0 end) as Nov,
sum(case month(pay_time) when '12' then trade_price else 0 end) as Dece
from finance_alipay_flow
<where>
<if test="belongUserId != null "> and belong_user_id = #{belongUserId}</if>
<if test="realIncomeExpenditureType != null "> and real_income_expenditure_type = #{realIncomeExpenditureType}</if>
<if test="year != null and year !=''"> and year(pay_time)=#{year} </if>
</where>
</select>
</mapper>