Commit 62d51c1b authored by 耿迪迪's avatar 耿迪迪

去支付-账号划拨开关

parent 65c792b3
package com.zehong.web.controller.account; package com.zehong.web.controller.account;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.domain.entity.SysUser; import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.ServletUtils; import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils; import com.zehong.common.utils.StringUtils;
...@@ -51,7 +53,8 @@ public class TAccountController extends BaseController ...@@ -51,7 +53,8 @@ public class TAccountController extends BaseController
startPage(); startPage();
// 获取当前用户 // 获取当前用户
SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser(); SysUser user = tokenService.getLoginUser(ServletUtils.getRequest()).getUser();
if (StringUtils.isNotNull(user) && !user.isAdmin()) { List<SysRole> roles =user.getRoles().stream().filter(item -> "calculator".equals(item.getRoleKey())).collect(Collectors.toList());
if (StringUtils.isNotNull(user) && !user.isAdmin() && CollectionUtils.isEmpty(roles)) {
tAccount.setDeptId(user.getDeptId()); tAccount.setDeptId(user.getDeptId());
} }
List<TAccount> list = tAccountService.selectTAccountList(tAccount); List<TAccount> list = tAccountService.selectTAccountList(tAccount);
......
...@@ -31,9 +31,9 @@ spring: ...@@ -31,9 +31,9 @@ spring:
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 10MB max-file-size: 100MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 500MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
......
...@@ -42,6 +42,8 @@ public class TAccount extends BaseEntity ...@@ -42,6 +42,8 @@ public class TAccount extends BaseEntity
private String deptName; private String deptName;
private String transferSwitch;
public void setAccountId(Long accountId) public void setAccountId(Long accountId)
{ {
this.accountId = accountId; this.accountId = accountId;
...@@ -111,6 +113,14 @@ public class TAccount extends BaseEntity ...@@ -111,6 +113,14 @@ public class TAccount extends BaseEntity
this.payableTotalAmount = payableTotalAmount; this.payableTotalAmount = payableTotalAmount;
} }
public String getTransferSwitch() {
return transferSwitch;
}
public void setTransferSwitch(String transferSwitch) {
this.transferSwitch = transferSwitch;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
...@@ -162,16 +162,38 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService ...@@ -162,16 +162,38 @@ public class TTradeProjectServiceImpl implements ITTradeProjectService
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int settlementTrade(TTradeProject tTradeProject){ public int settlementTrade(TTradeProject tTradeProject){
TTradeProject tradeInfo = tTradeProjectMapper.selectTTradeProjectById(tTradeProject.getTradeId()); TTradeProject tradeInfo = tTradeProjectMapper.selectTTradeProjectById(tTradeProject.getTradeId());
if("3".equals(tTradeProject.getTradeStatus())){
//交易结算
settlementTrade.settleAbleAmount(tradeInfo);
}
tradeInfo.setTradeStatus(tTradeProject.getTradeStatus()); tradeInfo.setTradeStatus(tTradeProject.getTradeStatus());
//审核成功结算
settleByTradeStatus(tTradeProject,tradeInfo);
tradeInfo.setApplyDeptManagerId(tTradeProject.getApplyDeptManagerId()); tradeInfo.setApplyDeptManagerId(tTradeProject.getApplyDeptManagerId());
tradeInfo.setSettlementTime(new Date()); tradeInfo.setSettlementTime(new Date());
return tTradeProjectMapper.updateTTradeProject(tradeInfo); return tTradeProjectMapper.updateTTradeProject(tradeInfo);
} }
/**
* 根据交易状态结算
* @param tTradeProject 交易入参
* @param tradeInfo 交易信息
*/
private void settleByTradeStatus(TTradeProject tTradeProject,TTradeProject tradeInfo){
//审核后结算
if("3".equals(tTradeProject.getTradeStatus())){
if(settlementTrade.transferSwitchIsOn(tradeInfo)){
//交易结算
settlementTrade.settleAbleAmount(tradeInfo);
}else{
tradeInfo.setTradeStatus("5");
}
return;
}
//去支付
if("5".equals(tTradeProject.getTradeStatus())){
settlementTrade.settleAbleAmount(tradeInfo);
tradeInfo.setTradeStatus("3");
}
}
@Override @Override
......
...@@ -10,7 +10,7 @@ public abstract class TradeRolesAbstract implements TradeRoles{ ...@@ -10,7 +10,7 @@ public abstract class TradeRolesAbstract implements TradeRoles{
/**交易状态枚举类*/ /**交易状态枚举类*/
protected enum TradeStatusEnum{ protected enum TradeStatusEnum{
evaluate("0"),confirm("1"),approval("2"),complete("3"),reject("4"); evaluate("0"),confirm("1"),approval("2"),complete("3"),reject("4"),toPay("5");
private final String tradeStatus; private final String tradeStatus;
......
...@@ -38,5 +38,11 @@ public class DeptLeader extends TradeRolesAbstract { ...@@ -38,5 +38,11 @@ public class DeptLeader extends TradeRolesAbstract {
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.confirm.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){ if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.confirm.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("confirm"); tTradeProject.getOperators().add("confirm");
} }
//待买方部门长支付
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.toPay.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("toPay");
}
} }
} }
...@@ -46,7 +46,10 @@ public class DoubleRoles extends TradeRolesAbstract { ...@@ -46,7 +46,10 @@ public class DoubleRoles extends TradeRolesAbstract {
tTradeProject.getOperators().add("confirm"); tTradeProject.getOperators().add("confirm");
} }
//待买方部门长支付
if(deptId.equals(this.tTradeProject.getTradeDeptId()) && TradeStatusEnum.toPay.getTradeStatus().equals(this.tTradeProject.getTradeStatus())){
tTradeProject.getOperators().add("toPay");
}
} }
} }
...@@ -47,6 +47,15 @@ public class SettlementTrade { ...@@ -47,6 +47,15 @@ public class SettlementTrade {
settleSellerAbleAmount(); settleSellerAbleAmount();
} }
/**
* 自动划拨开关是否开 0开 1关
* @return
*/
public boolean transferSwitchIsOn(TTradeProject tradeInfo){
TAccount account = getAccountInfo(tradeInfo.getTradeDeptId());
return "0".equals(account.getTransferSwitch());
}
/** /**
* 买方结算 * 买方结算
......
...@@ -16,15 +16,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -16,15 +16,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="payableTotalAmount" column="payableTotalAmount"/> <result property="payableTotalAmount" column="payableTotalAmount"/>
<result property="incomeAbleTotalAmount" column="incomeAbleTotalAmount"/> <result property="incomeAbleTotalAmount" column="incomeAbleTotalAmount"/>
<result property="totalAmount" column="totalAmount"/> <result property="totalAmount" column="totalAmount"/>
<result property="transferSwitch" column="transfer_switch"/>
</resultMap> </resultMap>
<sql id="selectTAccountVo"> <sql id="selectTAccountVo">
select account_id, dept_id AS deptId , able_amount, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account select account_id, dept_id AS deptId , able_amount, create_time, update_time, is_del,transfer_switch, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account
</sql> </sql>
<select id="selectTAccountList" parameterType="TAccount" resultMap="TAccountResult"> <select id="selectTAccountList" parameterType="TAccount" resultMap="TAccountResult">
select tt.*,(able_amount+incomeAbleTotalAmount- payableTotalAmount) as totalAmount from( select tt.*,(able_amount+incomeAbleTotalAmount- payableTotalAmount) as totalAmount from(
select account_id, dept_id AS deptId , able_amount, IFNULL((select sum(pending_payment) from t_trade_project where trade_status=3 and apply_dept_id =t.dept_id ),0)incomeAbleTotalAmount,IFNULL((select sum(pending_payment) from t_trade_project where trade_status=3 and trade_dept_id =t.dept_id ),0)payableTotalAmount, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account t select account_id, dept_id AS deptId , able_amount,transfer_switch, IFNULL((select sum(pending_payment) from t_trade_project where trade_status=3 and apply_dept_id =t.dept_id ),0)incomeAbleTotalAmount,IFNULL((select sum(pending_payment) from t_trade_project where trade_status=3 and trade_dept_id =t.dept_id ),0)payableTotalAmount, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_account t
<where> <where>
<if test="deptId != null "> and t.dept_id = #{deptId}</if> <if test="deptId != null "> and t.dept_id = #{deptId}</if>
<if test="ableAmount != null "> and t.able_amount = #{ableAmount}</if> <if test="ableAmount != null "> and t.able_amount = #{ableAmount}</if>
...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -47,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="isDel != null">is_del,</if> <if test="isDel != null">is_del,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="transferSwitch != null">transfer_switch,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if> <if test="deptId != null">#{deptId},</if>
...@@ -55,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -55,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="isDel != null">#{isDel},</if> <if test="isDel != null">#{isDel},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="transferSwitch != null">#{transferSwitch},</if>
</trim> </trim>
</insert> </insert>
...@@ -67,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -67,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="isDel != null">is_del = #{isDel},</if> <if test="isDel != null">is_del = #{isDel},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="transferSwitch != null">transfer_switch = #{transferSwitch},</if>
</trim> </trim>
where account_id = #{accountId} where account_id = #{accountId}
</update> </update>
......
...@@ -122,6 +122,7 @@ ...@@ -122,6 +122,7 @@
label="操作" label="操作"
align="center" align="center"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
width="220px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<!--<el-button <!--<el-button
...@@ -139,8 +140,18 @@ ...@@ -139,8 +140,18 @@
v-hasPermi="['system:account:remove']" v-hasPermi="['system:account:remove']"
>删除</el-button>--> >删除</el-button>-->
<el-button size="mini" type="text" @click="accountDetail(scope.row)" <el-button size="mini" type="text" @click="accountDetail(scope.row)"
>账户详情</el-button >账户详情</el-button>
<el-switch
class="switch"
v-model="scope.row.transferSwitch"
active-value="0"
inactive-value="1"
v-hasPermi="['system:account:edit']"
active-text="自动划拨开关"
@change="transferSwitchChange(scope.row)"
> >
</el-switch>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -400,7 +411,7 @@ export default { ...@@ -400,7 +411,7 @@ export default {
}; };
}, },
created() { created() {
if (this.$store.state.user.userId != 1) { if (this.$store.state.user.userId != 1 && this.$store.state.user.roles.findIndex(item => "calculator" == item) == -1) {
this.queryParams.deptId = this.$store.state.user.deptId; this.queryParams.deptId = this.$store.state.user.deptId;
this.disabled = true; this.disabled = true;
} }
...@@ -597,7 +608,47 @@ export default { ...@@ -597,7 +608,47 @@ export default {
this.queryAccountDetailParams.operateType = null; this.queryAccountDetailParams.operateType = null;
this.operatorTime = []; this.operatorTime = [];
this.getOperateList(); this.getOperateList();
},
transferSwitchChange(row){
getAccount(row.accountId).then(res =>{
if(res.code == 200){
let param = {accountId: res.data.accountId,transferSwitch:row.transferSwitch};
updateAccount(param).then(resp =>{
if(resp.code == 200){
this.$message.success("开关设置成功!");
this.getList();
}else{
this.$message.success("开关设置失败!")
}
})
}
})
} }
}, },
}; };
</script> </script>
<style lang="scss">
.switch{
margin-left: 15px;
.el-switch__core{
height: 17px;
width: 35px !important;
}
.el-switch.is-checked .el-switch__core::after{
margin-left: -15px !important;
}
.el-switch__core::after{
top: 0px;
width: 14px;
height: 14px;
}
.el-switch__label *{
font-size: 12px;
}
}
</style>
...@@ -55,11 +55,44 @@ ...@@ -55,11 +55,44 @@
return "买方部门长确认"; return "买方部门长确认";
case "approval": case "approval":
return "卖方部门长审核"; return "卖方部门长审核";
case "toPay":
return "去支付";
default: default:
return ""; return "";
} }
}, },
openDialog(){ openDialog(){
if(this.operatorName == "toPay"){
this.toPay();
return;
}
console.log("lalalalalalala----------")
this.getProjectInfo();
},
//去支付
toPay(){
this.$confirm(
'是否确认去支付',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
settlementTrade({tradeId:this.tradeInfo.tradeId,tradeStatus:"5"}).then(res =>{
if(res.code == 200){
this.$emit("getList");
this.msgSuccess("支付成功");
}
})
})
.catch(() => {});
},
//获取项目信息
getProjectInfo(){
getProject(this.tradeInfo.tradeId).then(res =>{ getProject(this.tradeInfo.tradeId).then(res =>{
if(res.code == 200){ if(res.code == 200){
this.tradeData = res.data; this.tradeData = res.data;
......
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