Commit 3ecea36c authored by 耿迪迪's avatar 耿迪迪

借贷结算-还款

parent b6b0768b
...@@ -115,7 +115,7 @@ public class TDebitCreditController extends BaseController ...@@ -115,7 +115,7 @@ public class TDebitCreditController extends BaseController
* @param tDebitCredit 借贷实体 * @param tDebitCredit 借贷实体
*/ */
@PostMapping("/settlementDebitCredit") @PostMapping("/settlementDebitCredit")
public AjaxResult settlementDebitCredit(TDebitCredit tDebitCredit){ public AjaxResult settlementDebitCredit(@RequestBody TDebitCredit tDebitCredit){
try{ try{
return toAjax(tDebitCreditService.settlementDebitCredit(tDebitCredit)); return toAjax(tDebitCreditService.settlementDebitCredit(tDebitCredit));
}catch (BusinessException e){ }catch (BusinessException e){
...@@ -128,7 +128,7 @@ public class TDebitCreditController extends BaseController ...@@ -128,7 +128,7 @@ public class TDebitCreditController extends BaseController
* @param tDebitCredit 借贷实体 * @param tDebitCredit 借贷实体
*/ */
@PostMapping("/repayDebitCredit") @PostMapping("/repayDebitCredit")
public AjaxResult repayDebitCredit(TDebitCredit tDebitCredit){ public AjaxResult repayDebitCredit(@RequestBody TDebitCredit tDebitCredit){
try{ try{
return toAjax(tDebitCreditService.repayDebitCredit(tDebitCredit)); return toAjax(tDebitCreditService.repayDebitCredit(tDebitCredit));
}catch (BusinessException e){ }catch (BusinessException e){
......
...@@ -41,8 +41,8 @@ public class TDebitCredit extends BaseEntity ...@@ -41,8 +41,8 @@ public class TDebitCredit extends BaseEntity
private Long lendDeptManageId; private Long lendDeptManageId;
/** 登记日期 */ /** 登记日期 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "登记日期", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "登记日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date registerTime; private Date registerTime;
/** 使用说明 */ /** 使用说明 */
......
...@@ -11,6 +11,7 @@ import com.zehong.system.service.impl.debitCredit.roles.*; ...@@ -11,6 +11,7 @@ import com.zehong.system.service.impl.debitCredit.roles.*;
import com.zehong.system.service.impl.debitSettlement.SettlementDebit; import com.zehong.system.service.impl.debitSettlement.SettlementDebit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -151,6 +152,7 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService ...@@ -151,6 +152,7 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService
* 借贷结算 * 借贷结算
* @param tDebitCredit 借贷实体 * @param tDebitCredit 借贷实体
*/ */
@Transactional(rollbackFor = Exception.class)
public int settlementDebitCredit(TDebitCredit tDebitCredit){ public int settlementDebitCredit(TDebitCredit tDebitCredit){
//结算 //结算
settlementDebit.settlementDebit(tDebitCredit); settlementDebit.settlementDebit(tDebitCredit);
...@@ -162,6 +164,7 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService ...@@ -162,6 +164,7 @@ public class TDebitCreditServiceImpl implements ITDebitCreditService
* 还款 * 还款
* @param tDebitCredit 借贷实体 * @param tDebitCredit 借贷实体
*/ */
@Transactional(rollbackFor = Exception.class)
public int repayDebitCredit(TDebitCredit tDebitCredit){ public int repayDebitCredit(TDebitCredit tDebitCredit){
//结算 //结算
settlementDebit.repayment(tDebitCredit); settlementDebit.repayment(tDebitCredit);
......
...@@ -56,7 +56,7 @@ public class SettlementDebit { ...@@ -56,7 +56,7 @@ public class SettlementDebit {
this.tDebitCredit = tDebitCredit; this.tDebitCredit = tDebitCredit;
//计算还款日期 //计算还款日期
long time = tDebitCredit.getExpectedRepaymentDate().getTime() - tDebitCredit.getSumInterestDate().getTime(); long time = tDebitCredit.getExpectedRepaymentDate().getTime() - tDebitCredit.getSumInterestDate().getTime();
int days = Math.round(time / 60 / 60 / 24); int days = Math.round(time / 1000 / 60 / 60 / 24);
//还款部门 //还款部门
BigDecimal repayAmount = tDebitCredit.getLittleTotal().multiply( new BigDecimal(1 + 0.08/360 * days)).setScale(2, RoundingMode.HALF_UP); BigDecimal repayAmount = tDebitCredit.getLittleTotal().multiply( new BigDecimal(1 + 0.08/360 * days)).setScale(2, RoundingMode.HALF_UP);
tDebitCredit.setRealPaymentDate(new Date()); tDebitCredit.setRealPaymentDate(new Date());
......
...@@ -65,7 +65,7 @@ export function exportCredit(query) { ...@@ -65,7 +65,7 @@ export function exportCredit(query) {
export function settlementDebitCredit(data) { export function settlementDebitCredit(data) {
return request({ return request({
url: '/debit/credit/settlementDebitCredit', url: '/debit/credit/settlementDebitCredit',
method: 'get', method: 'post',
data: data data: data
}) })
} }
...@@ -74,7 +74,7 @@ export function settlementDebitCredit(data) { ...@@ -74,7 +74,7 @@ export function settlementDebitCredit(data) {
export function repayDebitCredit(data) { export function repayDebitCredit(data) {
return request({ return request({
url: '/debit/credit/repayDebitCredit', url: '/debit/credit/repayDebitCredit',
method: 'get', method: 'post',
data: data data: data
}) })
} }
...@@ -198,6 +198,11 @@ ...@@ -198,6 +198,11 @@
<el-option label="收入" value="1"/> <el-option label="收入" value="1"/>
<el-option label="支出" value="2" /> <el-option label="支出" value="2" />
<el-option label="尾款扣除" value="3" /> <el-option label="尾款扣除" value="3" />
<el-option label="采购支出" value="4" />
<el-option label="出借" value="5" />
<el-option label="借贷" value="6" />
<el-option label="还款" value="7" />
<el-option label="还款进账" value="8" />
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -228,6 +233,11 @@ ...@@ -228,6 +233,11 @@
<span v-if="scope.row.operateType == '1'">收入</span> <span v-if="scope.row.operateType == '1'">收入</span>
<span v-if="scope.row.operateType == '2'">支出</span> <span v-if="scope.row.operateType == '2'">支出</span>
<span v-if="scope.row.operateType == '3'">尾款扣除</span> <span v-if="scope.row.operateType == '3'">尾款扣除</span>
<span v-if="scope.row.operateType == '4'">采购支出</span>
<span v-if="scope.row.operateType == '5'">出借</span>
<span v-if="scope.row.operateType == '6'">借贷</span>
<span v-if="scope.row.operateType == '7'">还款</span>
<span v-if="scope.row.operateType == '8'">还款进账</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="金额" align="center" prop="operateAmount" /> <el-table-column label="金额" align="center" prop="operateAmount" />
......
...@@ -123,18 +123,18 @@ ...@@ -123,18 +123,18 @@
payable(){ payable(){
let time = new Date(this.debitData.expectedRepaymentDate).getTime()/ 1000 - new Date(this.debitData.sumInterestDate).getTime()/ 1000; let time = new Date(this.debitData.expectedRepaymentDate).getTime()/ 1000 - new Date(this.debitData.sumInterestDate).getTime()/ 1000;
let day = Math.round(time / 60 / 60 / 24); let day = Math.round(time / 60 / 60 / 24);
return this.debitData.littleTotal *(1 + 0.08 /360 * day).toFixed(4); return this.debitData.littleTotal *(1 + 0.08 /360 * day).toFixed(2);
} }
} }
} }
</script> </script>
<style> <style lang="scss">
.common{ .common{
.el-form-item { .el-form-item {
margin-bottom: 0px; margin-bottom: 0px !important;
} }
.el-divider--horizontal { .el-divider--horizontal {
margin: 5px 0; margin: 5px 0 !important;
} }
} }
</style> </style>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<el-button type="text" @click="openDialog" size="mini">{{getOperatorName()}}</el-button> <el-button type="text" @click="openDialog" size="mini">{{getOperatorName()}}</el-button>
<el-dialog :title="getOperatorName()" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close> <el-dialog :title="getOperatorName()" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false" destroy-on-close>
<component :is="currentTabComponent" :debitData="debitData" ref="currentCom" v-if="open"></component> <component :is="currentTabComponent" :debitData="debitData" ref="currentCom" v-if="open"></component>
<div slot="footer" class="dialog-footer" style="text-align: center" v-if="operatorName != 'debitDetail' || operatorName != 'repay'"> <div slot="footer" class="dialog-footer" style="text-align: center" v-if="operatorName != 'debitDetail' && operatorName != 'repay'">
<el-button style="width: 150px;border-color: #1890ff;color: #1890ff;" @click="resetSuggestion">重置意见</el-button> <el-button style="width: 150px;border-color: #1890ff;color: #1890ff;" @click="resetSuggestion">重置意见</el-button>
<el-button type="primary" style="width: 150px" @click="submitSuggestion">提交</el-button> <el-button type="primary" style="width: 150px" @click="submitSuggestion">提交</el-button>
</div> </div>
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
import debitDetail from "./DebitDetail"; import debitDetail from "./DebitDetail";
import confirm from "./Confirm"; import confirm from "./Confirm";
import calculate from "./Calculate"; import calculate from "./Calculate";
import repay from "./Repay"
export default { export default {
name: "operator-button", name: "operator-button",
components:{ components:{
debitDetail, debitDetail,
confirm, confirm,
calculate calculate,
repay
}, },
props:{ props:{
operatorName: { operatorName: {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:credit:remove']" v-hasPermi="['system:credit:remove']"
v-if="(scope.row.debitStatus == '0' || scope.row.debitStatus == '3') && scope.row.operatorId == $store.state.user.userId" v-if="(scope.row.debitStatus == '0' || scope.row.debitStatus == '4') && scope.row.operatorId == $store.state.user.userId"
>删除</el-button> >删除</el-button>
<OperatorButton <OperatorButton
v-for="item in scope.row.operators" v-for="item in scope.row.operators"
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="借贷部门" prop="debitDeptId"> <el-form-item label="借贷部门" prop="debitDeptId" v-if="$store.state.user.roles.findIndex(item =>item == 'deptLeader') == -1">
<el-input <treeselect
v-model="queryParams.debitDeptId" v-model="queryParams.debitDeptId"
:options="queryDeptOptions"
:show-count="true"
placeholder="请输入借贷部门" placeholder="请输入借贷部门"
clearable style="width: 200px"
size="small"
@keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="出借部门" prop="lendDeptId"> <el-form-item label="出借部门" prop="lendDeptId" v-if="$store.state.user.roles.findIndex(item =>item == 'deptLeader') == -1">
<el-input <treeselect
v-model="queryParams.lendDeptId" v-model="queryParams.lendDeptId"
:options="queryDeptOptions"
:show-count="true"
placeholder="请输入出借部门" placeholder="请输入出借部门"
clearable style="width: 200px"
size="small"
@keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="登记日期" prop="registerTime"> <el-form-item label="登记日期" prop="registerTime">
<el-date-picker clearable size="small" <el-date-picker clearable size="small"
v-model="queryParams.registerTime" v-model="queryParams.registerTime"
type="date" type="datetime"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择登记日期"> placeholder="选择登记日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="使用人" prop="useId"> <!--<el-form-item label="使用人" prop="useId">
<el-input <el-select v-model="queryParams.useId" placeholder="请选择使用人">
v-model="queryParams.useId" <el-option v-for="item in usersList"
placeholder="请输入使用人" :key="item.userId"
clearable :label="item.nickName"
size="small" :value="item.userId"/>
@keyup.enter.native="handleQuery" </el-select>
/> </el-form-item>-->
</el-form-item>
<el-form-item label="借贷状态" prop="debitStatus"> <el-form-item label="借贷状态" prop="debitStatus">
<el-select v-model="queryParams.debitStatus" placeholder="请选择借贷状态" clearable size="small"> <el-select v-model="queryParams.debitStatus" placeholder="请选择借贷状态" clearable size="small">
<el-option <el-option
...@@ -357,7 +356,8 @@ export default { ...@@ -357,7 +356,8 @@ export default {
usersList: [], usersList: [],
formDeptOptions: [], formDeptOptions: [],
tab: "0", tab: "0",
debitStatusList: [] debitStatusList: [],
queryDeptOptions: []
}; };
}, },
created() { created() {
...@@ -369,6 +369,9 @@ export default { ...@@ -369,6 +369,9 @@ export default {
this.getDicts("t_debit_status").then((response) => { this.getDicts("t_debit_status").then((response) => {
this.debitStatusList = response.data; this.debitStatusList = response.data;
}); });
if(this.$store.state.user.roles.findIndex(item =>item == 'deptLeader') == -1){
this.queryParams.queryType = "";
}
}, },
methods: { methods: {
...@@ -613,6 +616,7 @@ export default { ...@@ -613,6 +616,7 @@ export default {
getTreeselect() { getTreeselect() {
treeselect().then((response) => { treeselect().then((response) => {
this.formDeptOptions = response.data; this.formDeptOptions = response.data;
this.queryDeptOptions = response.data;
// 申请服务时买方不能选自己部门 // 申请服务时买方不能选自己部门
var items = this.formDeptOptions[0].children; var items = this.formDeptOptions[0].children;
......
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