Merge remote-tracking branch 'origin/master'

This commit is contained in:
cun-nan 2023-11-13 19:01:25 +08:00
commit 4f69e72145
25 changed files with 1855 additions and 36 deletions

View File

@ -25,4 +25,13 @@ export function getPrepaidCardTopUpApi(query) {
method: 'post',
data: query
})
}
// 余额插入订单
export function getCheckTheStatusOfYourPaymentApi(query) {
return request({
url: 'business/marketingActivity/cardValueRecord/checkTheStatusOfYourPayment?id='+query,
method: 'post',
data: query
})
}

View File

@ -863,6 +863,8 @@ export default {
authCode:'', //
timer: null,
rechargeBalance:0,
@ -1171,30 +1173,29 @@ export default {
async collection(){
if (this.flag === 1) {
/**
* 插入订单表返回订单信息id 并调用支付接口
*
*
*
* 查询支付是否完成支付完成则修改
*
*/
//
// id
this.cardValueForm.mtUserId = userForm.id
this.cardValueForm.name = userForm.name
this.cardValueForm.mobile = userForm.mobile
//
this.cardValueForm.authCode = this.authCode
let id ;
await getPrepaidCardTopUpApi(this.cardValueForm).then(res=> {
console.log("返回数据",res)
});
this.timer = setInterval(async () => {
await getCheckTheStatusOfYourPaymentApi(id).then(res => {
console.log("ddd", res)
})
}, 500);
}else if (this.flag === 2){
}
console.log("88888888888888888888",this.flag)

View File

@ -10,16 +10,19 @@ import com.fuint.api.fuyou.entity.Message;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.order.entity.CashierOrder;
import com.fuint.business.order.entity.LJOrder;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.service.CashierOrderService;
import com.fuint.business.order.service.LJOrderService;
import com.fuint.business.order.service.OilOrderService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
@Service
@ -31,7 +34,8 @@ public class FyPayServiceImpl implements FyPayService {
private OilOrderService oilOrderService;
@Autowired
private CashierOrderService cashierOrderService;
@Resource
private CardValueRecordService cardValueRecordService;
/**
* 条码支付
* @param map1
@ -110,6 +114,13 @@ public class FyPayServiceImpl implements FyPayService {
map.put("ins_cd", insCd);
map.put("mchnt_cd", mchntCd);
// 余额新增
String type = "";
String payStates="";
if (!ObjectUtil.isEmpty(map1.get("type"))) {
type = map1.get("type");
}
// 请求报文
String reqBody = Message.requestMsg(map);
// 响应报文
@ -143,6 +154,12 @@ public class FyPayServiceImpl implements FyPayService {
oilOrderService.updateOilOrder(order);
}
}
if ("CRV".equals(type)) {
payStates = "paid";
if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
}
}
// 修改商户账号余额信息
Double amount = merchantConfig.getAmount();
merchantConfig.setAmount(amount+allAmount);
@ -166,6 +183,12 @@ public class FyPayServiceImpl implements FyPayService {
oilOrderService.updateOilOrder(order);
}
}
if ("CRV".equals(type)) {
payStates = "payFail";
if (!ObjectUtil.isEmpty(map1.get("orderId"))) {
}
}
}
if (!ObjectUtil.isEmpty(oilOrder)){
oilOrderService.updateOilOrder(oilOrder);
@ -176,6 +199,11 @@ public class FyPayServiceImpl implements FyPayService {
if (!ObjectUtil.isEmpty(cashierOrder)){
cashierOrderService.updateCashierOrder(cashierOrder);
}
if ("CRV".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
payStates = "payFail";
Integer id = Integer.parseInt(map1.get("orderId"));
cardValueRecordService.editPayStatus(id, payStates);
}
}
}catch (Exception e){
log.error(e.getMessage());

View File

@ -37,27 +37,12 @@ public class IntegralDetail extends BaseEntity {
* 积分变动的原因用于记录变动的具体原因或业务场景
*/
private String changeReason;
private String changeType;
/**
* 店铺ID
*/
private Integer storeId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新人
*/
private String updateBy;

View File

@ -14,6 +14,7 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="changeType" column="change_type" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
@ -27,7 +28,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="IntegralDetailMap">
select
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by
id, user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by,change_type
from integral_detail
<where>
<if test="id != null">
@ -109,8 +110,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by)
values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy})
insert into integral_detail(user_id, points_change, current_points, type, change_reason, store_id, create_time, update_time, create_by, update_by,change_type)
values (#{userId}, #{pointsChange}, #{currentPoints}, #{type}, #{changeReason}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{change_type})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@ -172,6 +173,9 @@
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="changeType != null">
change_type = #{changeType},
</if>
</set>
where id = #{id}
</update>

View File

@ -0,0 +1,93 @@
package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelChangeService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
/**
* 燃油变化记录表(CardFuelChange)表控制层
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
@RestController
@RequestMapping("cardFuelChange")
public class CardFuelChangeController extends BaseController {
/**
* 服务对象
*/
@Resource
private CardFuelChangeService cardFuelChangeService;
/**
* 分页查询
*
* @param cardFuelChange 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelChange") CardFuelChange cardFuelChange) {
Page page = new Page(pageNo, pageSize);
IPage< CardFuelChange> iPageList = this.cardFuelChangeService.queryByPage(page, cardFuelChange);
return getSuccessResult(iPageList);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.cardFuelChangeService.queryById(id));
}
/**
* 新增数据
*
* @param cardFuelChange 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody CardFuelChange cardFuelChange) {
return getSuccessResult(this.cardFuelChangeService.insert(cardFuelChange));
}
/**
* 编辑数据
*
* @param cardFuelChange 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody CardFuelChange cardFuelChange) {
return getSuccessResult(this.cardFuelChangeService.update(cardFuelChange));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.cardFuelChangeService.deleteById(id));
}
}

View File

@ -0,0 +1,93 @@
package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import io.lettuce.core.dynamic.annotation.Param;
import javax.annotation.Resource;
/**
* 燃油充值表(CardFuelRecord)表控制层
*
* @author wangh
* @since 2023-11-13 18:53:31
*/
@RestController
@RequestMapping("cardFuelRecord")
public class CardFuelRecordController extends BaseController {
/**
* 服务对象
*/
@Resource
private CardFuelRecordService cardFuelRecordService;
/**
* 分页查询
*
* @param cardFuelRecord 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelRecord") CardFuelRecord cardFuelRecord) {
Page page = new Page(pageNo, pageSize);
IPage< CardFuelRecord> iPageList = this.cardFuelRecordService.queryByPage(page, cardFuelRecord);
return getSuccessResult(iPageList);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.cardFuelRecordService.queryById(id));
}
/**
* 新增数据
*
* @param cardFuelRecord 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody CardFuelRecord cardFuelRecord) {
return getSuccessResult(this.cardFuelRecordService.insert(cardFuelRecord));
}
/**
* 编辑数据
*
* @param cardFuelRecord 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody CardFuelRecord cardFuelRecord) {
return getSuccessResult(this.cardFuelRecordService.update(cardFuelRecord));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.cardFuelRecordService.deleteById(id));
}
}

View File

@ -0,0 +1,89 @@
package com.fuint.business.marketingActivity.cardFule.entity;
import java.util.Date;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
/**
* 燃油变化记录表(CardFuelChange)实体类
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
@Data
public class CardFuelChange extends BaseEntity {
private static final long serialVersionUID = -50161587775180181L;
/**
* 主键id
*/
private Integer id;
/**
* 用户id
*/
private Integer userId;
/**
* 连锁店id
*/
private Integer chainStoreId;
/**
* 油站id
*/
private Integer storeId;
/**
* 余额变化类型 0-减少 1增加
*/
private String changeType;
/**
* 消费来源
*/
private String fromType;
/**
* 油量变化值
*/
private Double balance;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
/**
* 油卡类型 0汽油卡 1柴油卡 2天然气
*/
private String type;
/**
* 油品类型00# 1-10# 2京0# 392# 495# 98# 3京92# 4京95#
*/
private String oilType;
/**
* 油品单位
*/
private String unit;
}

View File

@ -0,0 +1,149 @@
package com.fuint.business.marketingActivity.cardFule.entity;
import java.util.Date;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
/**
* 燃油充值表(CardFuelRecord)实体类
*
* @author wangh
* @since 2023-11-13 18:53:32
*/
@Data
public class CardFuelRecord extends BaseEntity {
private static final long serialVersionUID = -75446430560923727L;
/**
* 主键id
*/
private Integer id;
/**
* 会员id
*/
private Integer mtUserId;
/**
* 会员名字
*/
private String name;
/**
* 会员手机号码
*/
private String mobile;
/**
* 员工id
*/
private Integer mtStaffId;
/**
* 员工姓名
*/
private String realName;
/**
* 员工手机号码
*/
private String staffMobile;
/**
* 屯油卡id
*/
private Integer cardFuelId;
/**
* 储值卡面值
*/
private Double rechargeBalance;
/**
* 所得升数
*/
private Float incomeLitres;
/**
* 支付方式 0扫码支付 1现金支付 2pos刷卡 3微信.......
*/
private String paymentType;
/**
* 充值备注
*/
private String remark;
/**
* 积分
*/
private Integer points;
/**
* 成长值
*/
private Integer growthValue;
/**
* 提成类型 1 2按提成金额 3按充值金额提成比例
*/
private String royaltyType;
/**
* 提成比例
*/
private Float percentageCommissions;
/**
* 员工提成金额
*/
private Float amountCommission;
/**
* 创建者
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新者
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 支付状态
*/
private String payStatus;
/**
* 店铺id
*/
private Integer storeId;
/**
* 支付编号
*/
private String paymentNo;
/**
* 油卡类型 0汽油卡 1柴油卡 2天然气
*/
private String type;
/**
* 油品类型00# 1-10# 2京0# 392# 495# 98# 3京92# 4京95#
*/
private String oilType;
}

View File

@ -0,0 +1,85 @@
package com.fuint.business.marketingActivity.cardFule.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 燃油变化记录表(CardFuelChange)表数据库访问层
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
public interface CardFuelChangeMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CardFuelChange queryById(Integer id);
/**
* 查询指定行数据
*
* @param cardFuelChange 查询条件
* @param page 分页对象
* @return 对象列表
*/
IPage<CardFuelChange> queryAllByLimit(@Param("page") Page page, CardFuelChange cardFuelChange);
/**
* 统计总行数
*
* @param cardFuelChange 查询条件
* @return 总行数
*/
long count(CardFuelChange cardFuelChange);
/**
* 新增数据
*
* @param cardFuelChange 实例对象
* @return 影响行数
*/
int insert(CardFuelChange cardFuelChange);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<CardFuelChange> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<CardFuelChange> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<CardFuelChange> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<CardFuelChange> entities);
/**
* 修改数据
*
* @param cardFuelChange 实例对象
* @return 影响行数
*/
int update(CardFuelChange cardFuelChange);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -0,0 +1,85 @@
package com.fuint.business.marketingActivity.cardFule.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 燃油充值表(CardFuelRecord)表数据库访问层
*
* @author wangh
* @since 2023-11-13 18:53:32
*/
public interface CardFuelRecordMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CardFuelRecord queryById(Integer id);
/**
* 查询指定行数据
*
* @param cardFuelRecord 查询条件
* @param page 分页对象
* @return 对象列表
*/
IPage<CardFuelRecord> queryAllByLimit(@Param("page") Page page, CardFuelRecord cardFuelRecord);
/**
* 统计总行数
*
* @param cardFuelRecord 查询条件
* @return 总行数
*/
long count(CardFuelRecord cardFuelRecord);
/**
* 新增数据
*
* @param cardFuelRecord 实例对象
* @return 影响行数
*/
int insert(CardFuelRecord cardFuelRecord);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<CardFuelRecord> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<CardFuelRecord> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<CardFuelRecord> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<CardFuelRecord> entities);
/**
* 修改数据
*
* @param cardFuelRecord 实例对象
* @return 影响行数
*/
int update(CardFuelRecord cardFuelRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -0,0 +1,220 @@
<?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.business.marketingActivity.cardFule.mapper.CardFuelChangeMapper">
<resultMap type="com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange" id="CardFuelChangeMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="chainStoreId" column="chain_store_id" jdbcType="INTEGER"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
<result property="changeType" column="change_type" jdbcType="VARCHAR"/>
<result property="fromType" column="from_type" jdbcType="VARCHAR"/>
<result property="balance" column="balance" jdbcType="NUMERIC"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="oilType" column="oil_type" jdbcType="VARCHAR"/>
<result property="unit" column="unit" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="CardFuelChangeMap">
select
id, user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit
from card_fuel_change
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="CardFuelChangeMap">
select
id, user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit
from card_fuel_change
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="chainStoreId != null">
and chain_store_id = #{chainStoreId}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="changeType != null and changeType != ''">
and change_type = #{changeType}
</if>
<if test="fromType != null and fromType != ''">
and from_type = #{fromType}
</if>
<if test="balance != null">
and balance = #{balance}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="oilType != null and oilType != ''">
and oil_type = #{oilType}
</if>
<if test="unit != null and unit != ''">
and unit = #{unit}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from card_fuel_change
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="chainStoreId != null">
and chain_store_id = #{chainStoreId}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="changeType != null and changeType != ''">
and change_type = #{changeType}
</if>
<if test="fromType != null and fromType != ''">
and from_type = #{fromType}
</if>
<if test="balance != null">
and balance = #{balance}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="oilType != null and oilType != ''">
and oil_type = #{oilType}
</if>
<if test="unit != null and unit != ''">
and unit = #{unit}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_change(user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit)
values (#{userId}, #{chainStoreId}, #{storeId}, #{changeType}, #{fromType}, #{balance}, #{createTime}, #{createBy}, #{updateTime}, #{updateBy}, #{type}, #{oilType}, #{unit})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_change(user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId}, #{entity.chainStoreId}, #{entity.storeId}, #{entity.changeType}, #{entity.fromType}, #{entity.balance}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}, #{entity.type}, #{entity.oilType}, #{entity.unit})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_change(user_id, chain_store_id, store_id, change_type, from_type, balance, create_time, create_by, update_time, update_by, type, oil_type, unit)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId}, #{entity.chainStoreId}, #{entity.storeId}, #{entity.changeType}, #{entity.fromType}, #{entity.balance}, #{entity.createTime}, #{entity.createBy}, #{entity.updateTime}, #{entity.updateBy}, #{entity.type}, #{entity.oilType}, #{entity.unit})
</foreach>
on duplicate key update
user_id = values(user_id),
chain_store_id = values(chain_store_id),
store_id = values(store_id),
change_type = values(change_type),
from_type = values(from_type),
balance = values(balance),
create_time = values(create_time),
create_by = values(create_by),
update_time = values(update_time),
update_by = values(update_by),
type = values(type),
oil_type = values(oil_type),
unit = values(unit)
</insert>
<!--通过主键修改数据-->
<update id="update">
update card_fuel_change
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="chainStoreId != null">
chain_store_id = #{chainStoreId},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
<if test="changeType != null and changeType != ''">
change_type = #{changeType},
</if>
<if test="fromType != null and fromType != ''">
from_type = #{fromType},
</if>
<if test="balance != null">
balance = #{balance},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="oilType != null and oilType != ''">
oil_type = #{oilType},
</if>
<if test="unit != null and unit != ''">
unit = #{unit},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from card_fuel_change where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,352 @@
<?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.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper">
<resultMap type="com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord" id="CardFuelRecordMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="mtUserId" column="mt_user_id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="mobile" column="mobile" jdbcType="VARCHAR"/>
<result property="mtStaffId" column="mt_staff_id" jdbcType="INTEGER"/>
<result property="realName" column="real_name" jdbcType="VARCHAR"/>
<result property="staffMobile" column="staff_mobile" jdbcType="VARCHAR"/>
<result property="cardFuelId" column="card_fuel_id" jdbcType="INTEGER"/>
<result property="rechargeBalance" column="recharge_balance" jdbcType="NUMERIC"/>
<result property="incomeLitres" column="income_litres" jdbcType="NUMERIC"/>
<result property="paymentType" column="payment_type" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="points" column="points" jdbcType="INTEGER"/>
<result property="growthValue" column="growth_value" jdbcType="INTEGER"/>
<result property="royaltyType" column="royalty_type" jdbcType="VARCHAR"/>
<result property="percentageCommissions" column="percentage_commissions" jdbcType="NUMERIC"/>
<result property="amountCommission" column="amount_commission" jdbcType="NUMERIC"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="payStatus" column="pay_status" jdbcType="VARCHAR"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
<result property="paymentNo" column="payment_no" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="oilType" column="oil_type" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="CardFuelRecordMap">
select
id, mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type
from card_fuel_record
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="CardFuelRecordMap">
select
id, mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type
from card_fuel_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="mtUserId != null">
and mt_user_id = #{mtUserId}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="mobile != null and mobile != ''">
and mobile = #{mobile}
</if>
<if test="mtStaffId != null">
and mt_staff_id = #{mtStaffId}
</if>
<if test="realName != null and realName != ''">
and real_name = #{realName}
</if>
<if test="staffMobile != null and staffMobile != ''">
and staff_mobile = #{staffMobile}
</if>
<if test="cardFuelId != null">
and card_fuel_id = #{cardFuelId}
</if>
<if test="rechargeBalance != null">
and recharge_balance = #{rechargeBalance}
</if>
<if test="incomeLitres != null">
and income_litres = #{incomeLitres}
</if>
<if test="paymentType != null and paymentType != ''">
and payment_type = #{paymentType}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="points != null">
and points = #{points}
</if>
<if test="growthValue != null">
and growth_value = #{growthValue}
</if>
<if test="royaltyType != null and royaltyType != ''">
and royalty_type = #{royaltyType}
</if>
<if test="percentageCommissions != null">
and percentage_commissions = #{percentageCommissions}
</if>
<if test="amountCommission != null">
and amount_commission = #{amountCommission}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="payStatus != null and payStatus != ''">
and pay_status = #{payStatus}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="paymentNo != null and paymentNo != ''">
and payment_no = #{paymentNo}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="oilType != null and oilType != ''">
and oil_type = #{oilType}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from card_fuel_record
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="mtUserId != null">
and mt_user_id = #{mtUserId}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="mobile != null and mobile != ''">
and mobile = #{mobile}
</if>
<if test="mtStaffId != null">
and mt_staff_id = #{mtStaffId}
</if>
<if test="realName != null and realName != ''">
and real_name = #{realName}
</if>
<if test="staffMobile != null and staffMobile != ''">
and staff_mobile = #{staffMobile}
</if>
<if test="cardFuelId != null">
and card_fuel_id = #{cardFuelId}
</if>
<if test="rechargeBalance != null">
and recharge_balance = #{rechargeBalance}
</if>
<if test="incomeLitres != null">
and income_litres = #{incomeLitres}
</if>
<if test="paymentType != null and paymentType != ''">
and payment_type = #{paymentType}
</if>
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
<if test="points != null">
and points = #{points}
</if>
<if test="growthValue != null">
and growth_value = #{growthValue}
</if>
<if test="royaltyType != null and royaltyType != ''">
and royalty_type = #{royaltyType}
</if>
<if test="percentageCommissions != null">
and percentage_commissions = #{percentageCommissions}
</if>
<if test="amountCommission != null">
and amount_commission = #{amountCommission}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="payStatus != null and payStatus != ''">
and pay_status = #{payStatus}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="paymentNo != null and paymentNo != ''">
and payment_no = #{paymentNo}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="oilType != null and oilType != ''">
and oil_type = #{oilType}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type)
values (#{mtUserId}, #{name}, #{mobile}, #{mtStaffId}, #{realName}, #{staffMobile}, #{cardFuelId}, #{rechargeBalance}, #{incomeLitres}, #{paymentType}, #{remark}, #{points}, #{growthValue}, #{royaltyType}, #{percentageCommissions}, #{amountCommission}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{payStatus}, #{storeId}, #{paymentNo}, #{type}, #{oilType})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.mtUserId}, #{entity.name}, #{entity.mobile}, #{entity.mtStaffId}, #{entity.realName}, #{entity.staffMobile}, #{entity.cardFuelId}, #{entity.rechargeBalance}, #{entity.incomeLitres}, #{entity.paymentType}, #{entity.remark}, #{entity.points}, #{entity.growthValue}, #{entity.royaltyType}, #{entity.percentageCommissions}, #{entity.amountCommission}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.payStatus}, #{entity.storeId}, #{entity.paymentNo}, #{entity.type}, #{entity.oilType})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into card_fuel_record(mt_user_id, name, mobile, mt_staff_id, real_name, staff_mobile, card_fuel_id, recharge_balance, income_litres, payment_type, remark, points, growth_value, royalty_type, percentage_commissions, amount_commission, create_by, create_time, update_by, update_time, pay_status, store_id, payment_no, type, oil_type)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.mtUserId}, #{entity.name}, #{entity.mobile}, #{entity.mtStaffId}, #{entity.realName}, #{entity.staffMobile}, #{entity.cardFuelId}, #{entity.rechargeBalance}, #{entity.incomeLitres}, #{entity.paymentType}, #{entity.remark}, #{entity.points}, #{entity.growthValue}, #{entity.royaltyType}, #{entity.percentageCommissions}, #{entity.amountCommission}, #{entity.createBy}, #{entity.createTime}, #{entity.updateBy}, #{entity.updateTime}, #{entity.payStatus}, #{entity.storeId}, #{entity.paymentNo}, #{entity.type}, #{entity.oilType})
</foreach>
on duplicate key update
mt_user_id = values(mt_user_id),
name = values(name),
mobile = values(mobile),
mt_staff_id = values(mt_staff_id),
real_name = values(real_name),
staff_mobile = values(staff_mobile),
card_fuel_id = values(card_fuel_id),
recharge_balance = values(recharge_balance),
income_litres = values(income_litres),
payment_type = values(payment_type),
remark = values(remark),
points = values(points),
growth_value = values(growth_value),
royalty_type = values(royalty_type),
percentage_commissions = values(percentage_commissions),
amount_commission = values(amount_commission),
create_by = values(create_by),
create_time = values(create_time),
update_by = values(update_by),
update_time = values(update_time),
pay_status = values(pay_status),
store_id = values(store_id),
payment_no = values(payment_no),
type = values(type),
oil_type = values(oil_type)
</insert>
<!--通过主键修改数据-->
<update id="update">
update card_fuel_record
<set>
<if test="mtUserId != null">
mt_user_id = #{mtUserId},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="mobile != null and mobile != ''">
mobile = #{mobile},
</if>
<if test="mtStaffId != null">
mt_staff_id = #{mtStaffId},
</if>
<if test="realName != null and realName != ''">
real_name = #{realName},
</if>
<if test="staffMobile != null and staffMobile != ''">
staff_mobile = #{staffMobile},
</if>
<if test="cardFuelId != null">
card_fuel_id = #{cardFuelId},
</if>
<if test="rechargeBalance != null">
recharge_balance = #{rechargeBalance},
</if>
<if test="incomeLitres != null">
income_litres = #{incomeLitres},
</if>
<if test="paymentType != null and paymentType != ''">
payment_type = #{paymentType},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="points != null">
points = #{points},
</if>
<if test="growthValue != null">
growth_value = #{growthValue},
</if>
<if test="royaltyType != null and royaltyType != ''">
royalty_type = #{royaltyType},
</if>
<if test="percentageCommissions != null">
percentage_commissions = #{percentageCommissions},
</if>
<if test="amountCommission != null">
amount_commission = #{amountCommission},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="payStatus != null and payStatus != ''">
pay_status = #{payStatus},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
<if test="paymentNo != null and paymentNo != ''">
payment_no = #{paymentNo},
</if>
<if test="type != null and type != ''">
type = #{type},
</if>
<if test="oilType != null and oilType != ''">
oil_type = #{oilType},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from card_fuel_record where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,58 @@
package com.fuint.business.marketingActivity.cardFule.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import io.lettuce.core.dynamic.annotation.Param;
/**
* 燃油变化记录表(CardFuelChange)表服务接口
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
public interface CardFuelChangeService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CardFuelChange queryById(Integer id);
/**
* 分页查询
*
* @param cardFuelChange 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<CardFuelChange> queryByPage(@Param("page") Page page, CardFuelChange cardFuelChange);
/**
* 新增数据
*
* @param cardFuelChange 实例对象
* @return 实例对象
*/
CardFuelChange insert(CardFuelChange cardFuelChange);
/**
* 修改数据
*
* @param cardFuelChange 实例对象
* @return 实例对象
*/
CardFuelChange update(CardFuelChange cardFuelChange);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -0,0 +1,58 @@
package com.fuint.business.marketingActivity.cardFule.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import io.lettuce.core.dynamic.annotation.Param;
/**
* 燃油充值表(CardFuelRecord)表服务接口
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
public interface CardFuelRecordService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
CardFuelRecord queryById(Integer id);
/**
* 分页查询
*
* @param cardFuelRecord 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<CardFuelRecord> queryByPage(@Param("page") Page page, CardFuelRecord cardFuelRecord);
/**
* 新增数据
*
* @param cardFuelRecord 实例对象
* @return 实例对象
*/
CardFuelRecord insert(CardFuelRecord cardFuelRecord);
/**
* 修改数据
*
* @param cardFuelRecord 实例对象
* @return 实例对象
*/
CardFuelRecord update(CardFuelRecord cardFuelRecord);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -0,0 +1,89 @@
package com.fuint.business.marketingActivity.cardFule.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelChange;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelChangeMapper;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelChangeService;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
/**
* 燃油变化记录表(CardFuelChange)表服务实现类
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
@Service("cardFuelChangeService")
public class CardFuelChangeServiceImpl implements CardFuelChangeService {
@Resource
private CardFuelChangeMapper cardFuelChangeMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public CardFuelChange queryById(Integer id) {
return this.cardFuelChangeMapper.queryById(id);
}
/**
* 分页查询
*
* @param cardFuelChange 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<CardFuelChange> queryByPage(@Param("page") Page page, CardFuelChange cardFuelChange) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelChange.setStoreId(nowAccountInfo.getStoreId());
return this.cardFuelChangeMapper.queryAllByLimit(page, cardFuelChange);
}
/**
* 新增数据
*
* @param cardFuelChange 实例对象
* @return 实例对象
*/
@Override
public CardFuelChange insert(CardFuelChange cardFuelChange) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelChange.setStoreId(nowAccountInfo.getStoreId());
this.cardFuelChangeMapper.insert(cardFuelChange);
return cardFuelChange;
}
/**
* 修改数据
*
* @param cardFuelChange 实例对象
* @return 实例对象
*/
@Override
public CardFuelChange update(CardFuelChange cardFuelChange) {
this.cardFuelChangeMapper.update(cardFuelChange);
return this.queryById(cardFuelChange.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.cardFuelChangeMapper.deleteById(id) > 0;
}
}

View File

@ -0,0 +1,89 @@
package com.fuint.business.marketingActivity.cardFule.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelRecordMapper;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
import org.springframework.stereotype.Service;
import com.fuint.common.util.TokenUtil;
import io.lettuce.core.dynamic.annotation.Param;
import com.fuint.common.dto.AccountInfo;
import javax.annotation.Resource;
/**
* 燃油充值表(CardFuelRecord)表服务实现类
*
* @author wangh
* @since 2023-11-13 18:53:47
*/
@Service("cardFuelRecordService")
public class CardFuelRecordServiceImpl implements CardFuelRecordService {
@Resource
private CardFuelRecordMapper cardFuelRecordMapper;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public CardFuelRecord queryById(Integer id) {
return this.cardFuelRecordMapper.queryById(id);
}
/**
* 分页查询
*
* @param cardFuelRecord 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<CardFuelRecord> queryByPage(@Param("page") Page page, CardFuelRecord cardFuelRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelRecord.setStoreId(nowAccountInfo.getStoreId());
return this.cardFuelRecordMapper.queryAllByLimit(page, cardFuelRecord);
}
/**
* 新增数据
*
* @param cardFuelRecord 实例对象
* @return 实例对象
*/
@Override
public CardFuelRecord insert(CardFuelRecord cardFuelRecord) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
cardFuelRecord.setStoreId(nowAccountInfo.getStoreId());
this.cardFuelRecordMapper.insert(cardFuelRecord);
return cardFuelRecord;
}
/**
* 修改数据
*
* @param cardFuelRecord 实例对象
* @return 实例对象
*/
@Override
public CardFuelRecord update(CardFuelRecord cardFuelRecord) {
this.cardFuelRecordMapper.update(cardFuelRecord);
return this.queryById(cardFuelRecord.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.cardFuelRecordMapper.deleteById(id) > 0;
}
}

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
@ -25,7 +26,7 @@ import java.util.List;
* @since 2023-10-31 11:30:09
*/
@RestController
@RequestMapping("cardValueRecord")
@RequestMapping("business/marketingActivity/cardValueRecord")
public class CardValueRecordController extends BaseController {
/**
* 服务对象
@ -91,5 +92,25 @@ public class CardValueRecordController extends BaseController {
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.cardValueRecordService.removeByIds(idList));
}
/**
* 余额充值
* @param cardValueRecordDTO
* @return
*/
@PostMapping("prepaidCardTopUp")
public ResponseObject prepaidCardTopUp(@RequestBody CardValueRecordDTO cardValueRecordDTO) {
return getSuccessResult(this.cardValueRecordService.prepaidCardTopUp(cardValueRecordDTO));
}
/**
* 查询支付状态 修改相关关联表
* @param id
* @return
*/
@GetMapping("checkTheStatusOfYourPayment")
public ResponseObject checkTheStatusOfYourPayment(Integer id) {
return getSuccessResult(this.cardValueRecordService.checkTheStatusOfYourPayment(id));
}
}

View File

@ -1,2 +1,29 @@
package com.fuint.business.marketingActivity.cardValue.dto;public class CardValueRecordDTO {
package com.fuint.business.marketingActivity.cardValue.dto;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import lombok.Data;
/**
*
*/
@Data
public class CardValueRecordDTO extends CardValueRecord {
private String authCode;
// /**
// * 会员id
// */
// private Integer userId;
// /**
// * 员工id
// */
//
// /**
// * 员工真实名称
// */
// private String realName;
// /**
// * 员工电话
// */
// private String staffMobile;
}

View File

@ -20,6 +20,10 @@ public class CardValueRecord extends Model<CardValueRecord> {
//主键id
@TableId(type = IdType.AUTO)
private Integer id;
private Integer storeId;
//会员id
private Integer mtUserId;
//会员名字
@ -70,6 +74,38 @@ public class CardValueRecord extends Model<CardValueRecord> {
private Date updateTime;
// 支付状态
private String payStatus;
// 支付方式
private String paymentType;
// 支付编号
private String paymentNo;
public String getPaymentNo() {
return paymentNo;
}
public void setPaymentNo(String paymentNo) {
this.paymentNo = paymentNo;
}
public String getPaymentType() {
return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType;
}
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public Integer getId() {
return id;
}
@ -262,6 +298,13 @@ public class CardValueRecord extends Model<CardValueRecord> {
this.updateTime = updateTime;
}
public String getPayStatus() {
return payStatus;
}
public void setPayStatus(String payStatus) {
this.payStatus = payStatus;
}
/**
* 获取主键值
*

View File

@ -2,6 +2,7 @@ package com.fuint.business.marketingActivity.cardValue.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import org.apache.ibatis.annotations.Param;
/**
* 储值充值表(CardValueRecord)表数据库访问层

View File

@ -1,6 +1,7 @@
package com.fuint.business.marketingActivity.cardValue.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.petrolStationManagement.entity.OilGun;
@ -14,10 +15,22 @@ public interface CardValueRecordService extends IService<CardValueRecord> {
/**
* 储值卡充值新增
*
* @param cardValueRecord
* @return
*/
boolean insert(CardValueRecord cardValueRecord);
}
/**
* 余额充值
*
* @param cardValueRecordDTO
* @return
*/
CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO);
CardValueRecord checkTheStatusOfYourPayment(Integer id);
boolean editPayStatus(Integer id, String payStatus);
}

View File

@ -1,11 +1,36 @@
package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.business.integral.entity.IntegralDetail;
import com.fuint.business.integral.service.IntegralDetailService;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapper;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
import com.fuint.business.order.entity.CardBalanceChange;
import com.fuint.business.order.service.CardBalanceChangeService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.entity.UserBalance;
import com.fuint.business.userManager.mapper.LJUserMapper;
import com.fuint.business.userManager.service.LJUserService;
import com.fuint.business.userManager.service.UserBalanceService;
import com.fuint.business.userManager.vo.LJUserVo;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 储值充值表(CardValueRecord)表服务实现类
*
@ -15,6 +40,23 @@ import org.springframework.stereotype.Service;
@Service("cardValueRecordService")
public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMapper, CardValueRecord> implements CardValueRecordService {
@Resource
private LJUserMapper ljUserMapper;
@Resource
private UserBalanceService userBalanceService;
@Autowired
private MerchantConfigService merchantConfigService;
@Autowired
private FyPayService fyPayService;
@Resource
CardBalanceChangeService cardBalanceChangeService;
@Resource
IntegralDetailService integralDetailService;
/**
* 储值卡充值新增
* @param cardValueRecord
@ -24,5 +66,174 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
public boolean insert(CardValueRecord cardValueRecord) {
return false;
}
@Override
public CardValueRecordDTO prepaidCardTopUp(CardValueRecordDTO cardValueRecordDTO) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 添加储存充值
if ("CASH".equals(cardValueRecordDTO.getPaymentType())) {
cardValueRecordDTO.setPayStatus("paid");
}else {
cardValueRecordDTO.setPayStatus("unpaid");
}
// 根据日期生成支付编号
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
String orderNo = timestamp+randomString;
cardValueRecordDTO.setPaymentNo(orderNo);
cardValueRecordDTO.setStoreId(nowAccountInfo.getStoreId());
baseMapper.insert(cardValueRecordDTO);
double epsilon = 1e-10; // 阈值
Double theAmountToBePaid = 0.0;
boolean flag = false;
// 先判断是否为自定义金额
// todo 需要修改该 统一使用getRechargeBalance recharge_type
if (!ObjectUtil.isEmpty(cardValueRecordDTO.getAmount())
&& cardValueRecordDTO.getAmount() > epsilon
&& "unpaid".equals(cardValueRecordDTO.getPayStatus())){
theAmountToBePaid = cardValueRecordDTO.getAmount();
flag = true;
} else if(!ObjectUtil.isEmpty(cardValueRecordDTO.getRechargeBalance())
&& cardValueRecordDTO.getRechargeBalance() > epsilon
&& "unpaid".equals(cardValueRecordDTO.getPayStatus())) {
theAmountToBePaid = cardValueRecordDTO.getRechargeBalance();
flag = true;
}
if (flag) {
Integer allAmount = (int) (theAmountToBePaid*100);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
// 处理支付需要的数据
Map<String,String> map = new HashMap<>();
map.put("authCode",cardValueRecordDTO.getAuthCode());
map.put("allAmount",allAmount.toString());
map.put("orderNo",orderNo);
map.put("payType",cardValueRecordDTO.getPaymentType());
map.put("insCd",merchantConfig.getInsCd());
map.put("mchntCd",merchantConfig.getMchntCd());
map.put("goodsDes",merchantConfig.getMerchantName());
map.put("publicKey",merchantConfig.getPublicKey());
map.put("privateKey",merchantConfig.getPrivateKey());
map.put("type","CVR");
map.put("orderId",cardValueRecordDTO.getId().toString());
// 调用支付接口
try {
fyPayService.pay(map);
} catch (Exception e){
e.printStackTrace();
}
}
// 支付 payment_type
return cardValueRecordDTO;
}
/**
* 查询支付状态 修改相关关联表
* @param id
* @return
*/
@Override
public CardValueRecord checkTheStatusOfYourPayment(Integer id) {
CardValueRecord cardValueRecord = baseMapper.selectById(id);
if (!"paid".equals(cardValueRecord.getPayStatus())) {
return cardValueRecord;
} else{
// 查询用户信息
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(cardValueRecord.getMtUserId());
// 修改用户的余额信息
UserBalance userBalance = balanceCalculation(cardValueRecord);
userBalanceService.updateUserBalance(userBalance);
// 添加余额充值纪录表
CardBalanceChange cardBalanceChange = addCardBalance(cardValueRecord);
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
double epsilon = 1e-10; // 阈值
// 插入 余额赠送
if (cardValueRecord.getGiftBalance()>epsilon) {
cardBalanceChange.setFromType("余额充值赠送");
cardBalanceChange.setBalance(cardValueRecord.getGiftBalance());
cardBalanceChangeService.insertCardBalance(cardBalanceChange);
}
// 积分表变动
if (!ObjectUtil.isEmpty(cardValueRecord.getPoints()) && cardValueRecord.getPoints() != 0) {
IntegralDetail integralDetail = changesInPoints(cardValueRecord,ljUserVos);
integralDetailService.insert(integralDetail);
}
// 成长值变动明细
}
return cardValueRecord;
}
//添加余额明细表
private CardBalanceChange addCardBalance(CardValueRecord cardValueRecord) {
CardBalanceChange cardBalanceChange = new CardBalanceChange();
cardBalanceChange.setUserId(cardValueRecord.getMtUserId());
cardBalanceChange.setChangeType("1");
cardBalanceChange.setFromType("余额充值");
cardBalanceChange.setBalance(cardValueRecord.getRechargeBalance());
return cardBalanceChange;
}
//用户余额表计算
private UserBalance balanceCalculation(CardValueRecord cardValueRecordDTO) {
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById(cardValueRecordDTO.getMtUserId());
if (ObjectUtil.isEmpty(cardValueRecordDTO.getBidBalance())) cardValueRecordDTO.setBidBalance(0.00);
if (ObjectUtil.isEmpty(cardValueRecordDTO.getPoints())) cardValueRecordDTO.setPoints(0);
if (ObjectUtil.isEmpty(cardValueRecordDTO.getGrowthValue())) cardValueRecordDTO.setGrowthValue(0);
// 计算之后修改对应余额
BigDecimal bigBidBalance = new BigDecimal(cardValueRecordDTO.getBidBalance());
BigDecimal addCardValance = bigBidBalance.add(new BigDecimal(ljUserVos.getCardBalance()));
// 计算积分
BigDecimal bigPoints = new BigDecimal(cardValueRecordDTO.getPoints());
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
// 计算成长值
BigDecimal bigGrowthValue = new BigDecimal(cardValueRecordDTO.getGrowthValue());
BigDecimal addGrowthValue = bigGrowthValue.add(new BigDecimal(ljUserVos.getGrowthValue()));
UserBalance userBalance = new UserBalance();
userBalance.setId(ljUserVos.getBalanceId());
userBalance.setCardBalance(addCardValance.doubleValue());
userBalance.setPoints(addPoints.intValue());
userBalance.setGrowthValue(addGrowthValue.intValue());
return userBalance;
}
// 积分变动
private IntegralDetail changesInPoints(CardValueRecord cardValueRecordDTO,LJUserVo ljUserVos) {
IntegralDetail integralDetail = new IntegralDetail();
integralDetail.setUserId(cardValueRecordDTO.getMtUserId());
integralDetail.setPointsChange(cardValueRecordDTO.getPoints());
// 计算积分
BigDecimal bigPoints = new BigDecimal(cardValueRecordDTO.getPoints());
BigDecimal addPoints = bigPoints.add(new BigDecimal(ljUserVos.getPoints()));
integralDetail.setCurrentPoints(addPoints.intValue());
integralDetail.setChangeReason("余额充值赠送");
return integralDetail;
}
// 成长值变动
//支付
public boolean editPayStatus(Integer id, String payStatus) {
CardValueRecord cardValueRecord = new CardValueRecord();
cardValueRecord.setId(id);
cardValueRecord.setPayStatus(payStatus);
int i = baseMapper.updateById(cardValueRecord);
return i>0;
}
}

View File

@ -43,4 +43,9 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
*/
public Double selectSumByStore(@Param("storeId") int storeId,@Param("sumValue") String sumValue);
LJUserVo selectAllInfoById(@Param("userId") Integer userId);
}

View File

@ -58,4 +58,15 @@
mu.name like concat('%', #{name}, '%')
</where>
</select>
<select id="selectAllInfoById" resultType="com.fuint.business.userManager.vo.LJUserVo">
select mu.*,
mub.id balanceId,
mub.card_balance cardBalance,
mub.points,
mub.growth_value growthValue
from mt_user mu
left join mt_user_balance mub on mu.id = mub.mt_user_id
where mu.id = #{userId}
</select>
</mapper>