This commit is contained in:
cun-nan 2024-01-25 18:27:19 +08:00
parent 4c4631fa12
commit d54ef244a8
15 changed files with 355 additions and 19 deletions

View File

@ -42,3 +42,12 @@ export function merchantInfo(id) {
method: 'get',
})
}
// 查询挂账信息列表
export function listMerchantConfigRecord(query) {
return request({
url: '/api/merchantConfigRecord/list',
method: 'get',
params: query
})
}

View File

@ -31,7 +31,7 @@
<!-- </el-card>-->
<el-card class="box-card" shadow="hover" v-for="item in merchantList" :key="item.id">
<div slot="header" class="clearfix">
<span><dict-tag :options="dict.type.payment_channel" :value="item.merchantName"/></span>
<span @click="getMerchantList(item.id)"><dict-tag :options="dict.type.payment_channel" :value="item.merchantName"/></span>
<el-button v-if="item.isUse=='0'"
@click="editStatus(item,1)"
style="float: right; padding: 3px 0" type="text">切换为当前通道</el-button>
@ -196,6 +196,42 @@
</div>
</el-dialog>
<el-dialog
title="配置消费记录信息"
:visible.sync="dialogVisibleList">
<div class="wrap-wrap">
<el-table ref="tables" v-loading="loading" :data="merchantRecordList">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="入账类型" align="center" prop="type" >
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.type=='0'">增加</el-tag>
<el-tag type="danger" v-if="scope.row.type=='1'">减少</el-tag>
</template>
</el-table-column>
<el-table-column label="入账金额" align="center" prop="amount"/>
<el-table-column label="入账状态" align="center" prop="isSuccess">
<template slot-scope="scope">
<span v-if="scope.row.isSuccess=='yes'">成功</span>
<span v-if="scope.row.isSuccess=='no'">失败</span>
</template>
</el-table-column>
<el-table-column label="关联订单号" align="center" width="300" prop="orderNo"/>
<el-table-column label="注册时间" align="center" width="200" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</el-dialog>
</div>
</template>
@ -204,7 +240,7 @@ import {
addMerchant,
editMerchant,
editMerchantRemark,
listMerchant,
listMerchant, listMerchantConfigRecord,
merchantInfo
} from "@/api/payConfig/merchantconfig";
import {
@ -245,6 +281,7 @@ export default {
formLabelWidth: '80px',
dialogFormVisible:false,
dialogVisible:false,
dialogVisibleList:false,
show:false,
value:false,
value1:true,
@ -258,13 +295,32 @@ export default {
mchntCd: [
{ required: true, message: '请填写商户号', trigger: 'blur' },
],
}
},
//
queryParams: {
page: 1,
pageSize: 10,
merchantId:""
},
merchantRecordList:[],
total:0,
loading:false,
}
},
created() {
this.getList();
},
methods:{
getMerchantList(id){
this.dialogVisibleList = true
this.loading = true;
this.queryParams.merchantId = id
listMerchantConfigRecord(this.queryParams).then(res => {
this.merchantRecordList = res.data.records;
this.total = res.data.total;
this.loading = false;
})
},
//
submitRemark(){
editMerchantRemark(this.merchantConfig).then(res => {

View File

@ -63,7 +63,7 @@
<el-table-column label="员工角色" align="center" prop="roleId" >
<template slot-scope="scope">
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">普通员工</span>
<span v-if="scope.row.roleId=='15'">加油员</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
</template>
</el-table-column>

View File

@ -214,14 +214,17 @@
<el-col :span="24">
<el-form-item label="角色组" prop="staffRoleGroup">
<el-select v-model="staffRoleGroup"
multiple
placeholder="请选择所属角色"
@change="getCheckbox">
<el-option
v-for="(item,index) in roleList"
:key="index"
:label="item.dutyName"
:value="item.dutyId"
></el-option>
<!-- <el-option-->
<!-- v-for="(item,index) in roleList"-->
<!-- :key="index"-->
<!-- :label="item.dutyName"-->
<!-- :value="item.dutyId"-->
<!-- ></el-option>-->
<el-option label="加油员" :value="15+''" ></el-option>
<el-option label="收银员" :value="16+''" ></el-option>
<!-- :value="item.dutyId"-->
</el-select>
</el-form-item>
@ -394,8 +397,8 @@ export default {
id.forEach(i => {
if (item.dutyId=i){
name = item.dutyName
}
dutyName += name +","
}
})
})
return name

View File

@ -62,7 +62,7 @@
<el-table-column label="员工角色" align="center" prop="roleId" >
<template slot-scope="scope">
<span v-if="scope.row.roleId=='12'">油站站长</span>
<span v-if="scope.row.roleId=='15'">普通员工</span>
<span v-if="scope.row.roleId=='15'">加油员</span>
<span v-if="scope.row.roleId=='16'">收银员</span>
</template>
</el-table-column>
@ -144,7 +144,7 @@
<el-form-item label="角色组" prop="role">
<el-select v-model="form.roleId" placeholder="请选择角色" style="width: 270px">
<el-option label="油站站长" :value="12" ></el-option>
<el-option label="普通员工" :value="15" ></el-option>
<el-option label="加油员" :value="15" ></el-option>
<el-option label="收银员" :value="16" ></el-option>
</el-select>
</el-form-item>

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fuint.api.fuyou.entity.Const;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigRecordService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.integral.service.IntegralOrdersService;
@ -49,6 +50,9 @@ public class FyPayController {
@Lazy
private MerchantConfigService merchantConfigService;
@Autowired
@Lazy
private MerchantConfigRecordService merchantConfigRecordService;
@Autowired
private RedisLock redisLock;
// 接收支付平台异步通知的接口
@ -79,6 +83,7 @@ public class FyPayController {
Double afterAmount = beforeAmount + allOrderInfo.getPayMoney();
merchantConfig.setAmount(afterAmount);
merchantConfigService.updateMerch(merchantConfig);
merchantConfigRecordService.updateMerchantConfigRecordByOrderNo(orderNo,"yes");
}
updateOrderStatus(orderNo,allOrderInfo.getType());

View File

@ -0,0 +1,38 @@
package com.fuint.api.fuyou.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.api.fuyou.entity.MerchantConfigRecord;
import com.fuint.api.fuyou.service.MerchantConfigRecordService;
import com.fuint.business.member.entity.LJStaff;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/merchantConfigRecord")
public class MerchantConfigRecordController extends BaseController {
@Autowired
private MerchantConfigRecordService merchantConfigRecordService;
/**
* 根据条件分页查询商户配置记录
* @param merchantConfigRecord
* @param pageNo
* @param pageSize
* @return
*/
@GetMapping("/list")
public ResponseObject list(@Param("staff") MerchantConfigRecord merchantConfigRecord,
@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
Page page =new Page(pageNo,pageSize);
IPage<MerchantConfigRecord> list = merchantConfigRecordService.selectMerchantConfigRecordList(page,merchantConfigRecord);
return getSuccessResult(list);
}
}

View File

@ -0,0 +1,55 @@
package com.fuint.api.fuyou.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fuint.framework.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (MerchantConfigRecord)实体类
*/
@Data
@TableName("merchant_config_record")
@ApiModel(value = "MerchantConfigRecord对象", description = "商户配置表")
public class MerchantConfigRecord extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty("自增ID")
@TableId(value = "ID", type = IdType.AUTO)
private Integer id;
/**
* 商户配置id
*/
private Integer merchantId;
/**
* 入账类型 0增加1减少
*/
private String type;
/**
* 入账金额
*/
private Double amount;
/**
* 是否入账成功yes成功no失败
*/
private String isSuccess;
/**
* 关联订单号
*/
private String orderNo;
/**
* 店铺id
*/
private Integer storeId;
}

View File

@ -0,0 +1,17 @@
package com.fuint.api.fuyou.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.api.fuyou.entity.MerchantConfigRecord;
import org.apache.ibatis.annotations.Param;
public interface MerchantConfigRecordMapper extends BaseMapper<MerchantConfigRecord> {
/**
* 根据条件分页查询配置信息记录
* @param page
* @param merchantConfigRecord
* @return
*/
IPage<MerchantConfigRecord> selectMerchantConfigRecordList(@Param("page") Page page,@Param("merchantConfigRecord") MerchantConfigRecord merchantConfigRecord);
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.api.fuyou.mapper.MerchantConfigRecordMapper">
<select id="selectMerchantConfigRecordList" resultType="com.fuint.api.fuyou.entity.MerchantConfigRecord">
select * from merchant_config_record
<where>
store_id = #{merchantConfigRecord.storeId}
<if test="merchantConfigRecord.merchantId != null and merchantConfigRecord.merchantId != ''">
and merchant_id like concat('%', #{merchantConfigRecord.merchantId}, '%')
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,44 @@
package com.fuint.api.fuyou.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.api.fuyou.entity.MerchantConfigRecord;
public interface MerchantConfigRecordService {
/**
* 根据条件分页查询配置信息记录
* @param page
* @param merchantConfigRecord
* @return
*/
IPage<MerchantConfigRecord> selectMerchantConfigRecordList(Page page, MerchantConfigRecord merchantConfigRecord);
/**
* 根据订单号查询配置信息记录
* @param orderNo
* @return
*/
MerchantConfigRecord selectMerchantConfigRecordByOrderNo(String orderNo);
/**
* 添加配置记录信息
* @param merchantConfigRecord
* @return
*/
int insertMerchantConfigRecord(MerchantConfigRecord merchantConfigRecord);
/**
* 修改配置记录信息
* @param merchantConfigRecord
* @return
*/
int updateMerchantConfigRecord(MerchantConfigRecord merchantConfigRecord);
/**
* 根据订单号修改配置记录状态
* @param orderNo
* @param isSuccess
* @return
*/
int updateMerchantConfigRecordByOrderNo(String orderNo,String isSuccess);
}

View File

@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.fuint.api.fuyou.entity.*;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigRecordService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.commission.service.StaffCommissionService;
@ -48,6 +49,8 @@ public class FyPayServiceImpl implements FyPayService {
private IntegralOrdersService integralOrdersService;
@Autowired
private StaffCommissionService staffCommissionService;
@Autowired
private MerchantConfigRecordService merchantConfigRecordService;
/**
* 条码支付
@ -274,7 +277,7 @@ public class FyPayServiceImpl implements FyPayService {
}
// 修改商户账号余额信息
Double amount = merchantConfig.getAmount();
merchantConfig.setAmount(amount+allAmount/100);
merchantConfig.setAmount(amount+(allAmount/100));
merchantConfigService.updateMerch(merchantConfig);
resMap.put("msg","success");
}else if (reqMap.get("trans_stat").equals("USERPAYING")){
@ -395,6 +398,22 @@ public class FyPayServiceImpl implements FyPayService {
if (!reqMap.get("trans_stat").equals("USERPAYING")){
this.insertAllOrderInfo(receiveParameter,payStatus);
}
if (ObjectUtil.isNotEmpty(merchantConfig)){
// 添加配置记录信息
MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord();
merchantConfigRecord.setMerchantId(merchantConfig.getId());
if (payStatus.equals("paid")){
merchantConfigRecord.setIsSuccess("yes");
}else {
merchantConfigRecord.setIsSuccess("no");
}
merchantConfigRecord.setAmount(allAmount/100.0);
merchantConfigRecord.setType("0");
merchantConfigRecord.setStoreId(merchantConfig.getStoreId());
merchantConfigRecord.setOrderNo(orderNo);
merchantConfigRecordService.insertMerchantConfigRecord(merchantConfigRecord);
}
}
}catch (Exception e){
e.printStackTrace();
@ -433,12 +452,14 @@ public class FyPayServiceImpl implements FyPayService {
map.put("trade_type","LETPAY");
// 微信open_id
map.put("sub_openid", userVo.getOpenId());
System.out.println("微信open_id:"+userVo.getOpenId());
// appid
map.put("sub_appid", merchantConfig.getAppid());
} else if (receiveParameter.getPayType().equals("ALIPAY")){
map.put("trade_type","FWC");
// 支付宝userId
map.put("sub_openid", userVo.getUserId());
System.out.println("支付宝userId:"+userVo.getUserId());
// appid
map.put("sub_appid", merchantConfig.getAlipayAppid());
}else {
@ -447,6 +468,19 @@ public class FyPayServiceImpl implements FyPayService {
return res;
}
if (ObjectUtil.isNotEmpty(merchantConfig)){
// 添加配置记录信息
MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord();
merchantConfigRecord.setMerchantId(merchantConfig.getId());
merchantConfigRecord.setIsSuccess("no");
merchantConfigRecord.setAmount(receiveParameter.getGoodsMoney());
merchantConfigRecord.setType("0");
merchantConfigRecord.setStoreId(merchantConfig.getStoreId());
merchantConfigRecord.setOrderNo(receiveParameter.getOrderNo());
merchantConfigRecordService.insertMerchantConfigRecord(merchantConfigRecord);
}
// 请求报文
String reqBody = Message.requestMsg(map);
// 响应报文

View File

@ -0,0 +1,59 @@
package com.fuint.api.fuyou.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfigRecord;
import com.fuint.api.fuyou.mapper.MerchantConfigRecordMapper;
import com.fuint.api.fuyou.service.MerchantConfigRecordService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
@Service
public class MerchantConfigRecordServiceImpl extends ServiceImpl<MerchantConfigRecordMapper,MerchantConfigRecord> implements MerchantConfigRecordService {
@Override
public IPage<MerchantConfigRecord> selectMerchantConfigRecordList(Page page, MerchantConfigRecord merchantConfigRecord) {
if (merchantConfigRecord.getStoreId()==null){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
merchantConfigRecord.setStoreId(nowAccountInfo.getStoreId());
}
return baseMapper.selectMerchantConfigRecordList(page,merchantConfigRecord);
}
@Override
public MerchantConfigRecord selectMerchantConfigRecordByOrderNo(String orderNo) {
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_no",orderNo);
return baseMapper.selectOne(queryWrapper);
}
@Override
public int insertMerchantConfigRecord(MerchantConfigRecord merchantConfigRecord) {
int row = 0;
MerchantConfigRecord merchantConfigRecord1 = this.selectMerchantConfigRecordByOrderNo(merchantConfigRecord.getOrderNo());
if (ObjectUtil.isEmpty(merchantConfigRecord1)){
row = baseMapper.insert(merchantConfigRecord);
}
return row;
}
@Override
public int updateMerchantConfigRecord(MerchantConfigRecord merchantConfigRecord) {
return baseMapper.updateById(merchantConfigRecord);
}
@Override
public int updateMerchantConfigRecordByOrderNo(String orderNo, String isSuccess) {
int row = 0;
MerchantConfigRecord merchantConfigRecord = this.selectMerchantConfigRecordByOrderNo(orderNo);
if (ObjectUtil.isNotEmpty(merchantConfigRecord)){
merchantConfigRecord.setIsSuccess(isSuccess);
row = baseMapper.updateById(merchantConfigRecord);
}
return row;
}
}

View File

@ -551,7 +551,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
for (ActiveDiscountPayVO activeDiscountPayVO : activeFuletVOList) {
if (!activeDiscountPayVO.getParticipationCondition().equals("1")){
for (CardFavorableRecordVO cardFavorableRecordVO : canUserCardFavorableList) {
if(ObjectUtils.isNotEmpty(cardFavorableRecordVO) && cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
if(StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && ObjectUtils.isNotEmpty(cardFavorableRecordVO) && cardFavorableRecordVO.getType().equals("2") && !cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
activeDiscountPayVO1.setCouponId(cardFavorableRecordVO.getId());
@ -563,7 +563,7 @@ public class ActiveExchangeServiceImpl implements ActiveExchangeService {
activeDiscountPayVO1.setCardFavorableAmount(BigDecimal.valueOf(cardFavorableRecordVO.getDiscountAmount()));
activeDiscountPayVO1.setCardFavorableInfo(cardFavorableRecordVO.getCardFavorableName());
cardAndComPays.add(activeDiscountPayVO1);
}else if (cardFavorableRecordVO.getExclusiveFunction().equals("0")){
}else if (StringUtils.isNotEmpty(cardFavorableRecordVO.getExclusiveFunction()) && cardFavorableRecordVO.getExclusiveFunction().equals("0")){
ActiveDiscountPayVO activeDiscountPayVO1 = new ActiveDiscountPayVO();
BeanUtils.copyProperties(activeDiscountPayVO,activeDiscountPayVO1);
String[] split = cardFavorableRecordVO.getOilType().split(",");

View File

@ -1016,9 +1016,9 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilOrder.setTankId(tankId);
// 判断是否使用储值卡消费
if (!balanceAmount.equals("0")){
this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId(),orderNo);
}
// if (!balanceAmount.equals("0")){
// this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId(),orderNo);
// }
// 判断是否需要调起支付
if (!map.get("payAmount").equals("0") && !map.get("payAmount").equals("0.0") && !map.get("payAmount").equals("0.00")) {
@ -1064,6 +1064,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardOrder(oilOrder.getUserId(),oilOrder.getStoreId(),orderNo,oilOrder.getOrderAmount(),"paid", Double.valueOf(balanceAmount),payAmount);
this.insertAllOrderInfo(orderNo,oilOrder.getStoreId(),oilOrder.getOrderAmount(),payAmount,oilOrder.getPayType(),oilOrder.getUserId(),"applet","1","paid");
this.insertCardBalance(Double.valueOf(balanceAmount),userId,oilOrder.getStoreId(),orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getOrderAmount(),oilOrder.getOilNum(),"1",orderNo);
oilOrder.setPayAmount(payAmount);
oilOrder.setDiscountAmount(Double.valueOf(discountAmount));
@ -1135,6 +1136,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
this.updateGrowthValue(oilOrder.getOrderAmount(),oilOrder.getPayAmount(),userId, Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId(),orderNo);
this.addOilTracks(oilOrder,oilOrder.getStoreId());
this.insertCardBalance(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount()-oilOrder.getPayAmount(),userId,oilOrder.getStoreId(),orderNo);
staffCommissionService.countStaffCommission(oilOrder.getStaffId(),oilOrder.getStoreId(),oilOrder.getOrderAmount(),oilOrder.getPayAmount(),oilOrder.getOilNum(),"1",orderNo);
}
row = baseMapper.updateById(oilOrder);