充值记录
This commit is contained in:
parent
11bcdbd3e8
commit
b0aa720ccb
@ -12,6 +12,9 @@ public class CardValueRecordDTO extends CardValueRecord {
|
||||
private String obtain;
|
||||
private String authCode;
|
||||
private Double realyPayBills;
|
||||
//付款类型 1.微信 2.支付宝
|
||||
private String payType;
|
||||
//优惠券
|
||||
|
||||
// /**
|
||||
// * 会员id
|
||||
|
@ -17,6 +17,8 @@ import com.fuint.business.marketingActivity.cardValue.mapper.CardValueRecordMapp
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.vo.Excel.CardValueRecordExcel;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.business.order.entity.CardBalanceChange;
|
||||
import com.fuint.business.order.service.CardBalanceChangeService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
@ -77,6 +79,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
RocketUtil rocketUtil;
|
||||
@Resource
|
||||
private MtStaffMapper mtStaffMapper;
|
||||
@Resource
|
||||
private CardValueOrdersService cardValueOrdersService;
|
||||
/**
|
||||
* 储值卡充值(新增)
|
||||
* @param cardValueRecordDTO
|
||||
@ -84,39 +88,35 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
*/
|
||||
@Override
|
||||
public boolean insert(CardValueRecordDTO cardValueRecordDTO) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
boolean pay = false;
|
||||
// 添加储存充值
|
||||
cardValueRecordDTO.setPayStatus("unpaid");
|
||||
// 根据日期生成支付编号
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//订单信息
|
||||
CardValueOrders cardValueOrders = new CardValueOrders();
|
||||
//订单号
|
||||
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());
|
||||
if (ObjectUtil.isEmpty(cardValueRecordDTO.getBidBalance())) cardValueRecordDTO.setBidBalance(0.0);
|
||||
if (cardValueRecordDTO.getBidBalance() <= 0.0) {
|
||||
BigDecimal bigDecimal = new BigDecimal(cardValueRecordDTO.getBidBalance());
|
||||
bigDecimal = bigDecimal.add(new BigDecimal(cardValueRecordDTO.getGiftBalance()).add(new BigDecimal(cardValueRecordDTO.getRechargeBalance())));
|
||||
cardValueRecordDTO.setBidBalance(bigDecimal.doubleValue());
|
||||
}
|
||||
baseMapper.insert(cardValueRecordDTO);
|
||||
|
||||
double epsilon = 1e-10; // 阈值
|
||||
|
||||
Double theAmountToBePaid = 0.0;
|
||||
|
||||
|
||||
Integer allAmount1 = (int) (theAmountToBePaid*100);
|
||||
System.out.println("allAmount1:"+allAmount1);
|
||||
Integer allAmount = (int) (0.01*100);
|
||||
String orderNo = "cardvalue"+timestamp+randomString;
|
||||
cardValueOrders.setOrderNo(orderNo);
|
||||
//付款类型
|
||||
cardValueOrders.setPayType(cardValueRecordDTO.getPayType());
|
||||
cardValueOrders.setStoreId(nowAccountInfo.getStoreId());
|
||||
cardValueOrders.setUserId(nowAccountInfo.getId());
|
||||
//订单金额
|
||||
cardValueOrders.setAmount(0.1);
|
||||
//支付金额
|
||||
cardValueOrders.setPayAmount(0.2);
|
||||
//优惠金额
|
||||
cardValueOrders.setDiscount(0.1);
|
||||
cardValueOrders.setStaffId(cardValueRecordDTO.getMtStaffId());
|
||||
//
|
||||
pay = cardValueOrdersService.save(cardValueOrders);
|
||||
|
||||
//生成订单之后调用支付接口
|
||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||
// 处理支付需要的数据
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("authCode",cardValueRecordDTO.getAuthCode());
|
||||
map.put("allAmount",allAmount.toString());
|
||||
map.put("allAmount",cardValueOrders.getAmount().toString());
|
||||
map.put("orderNo",orderNo);
|
||||
map.put("payType",cardValueRecordDTO.getPaymentType());
|
||||
map.put("insCd",merchantConfig.getInsCd());
|
||||
@ -126,7 +126,6 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
map.put("privateKey",merchantConfig.getPrivateKey());
|
||||
map.put("type","CVR");
|
||||
map.put("orderId",cardValueRecordDTO.getId().toString());
|
||||
|
||||
// 调用支付接口
|
||||
try {
|
||||
fyPayService.applet(map);
|
||||
@ -134,11 +133,11 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
||||
} catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//支付成功之后添加充值记录
|
||||
pay = addCardValueRecord(cardValueRecordDTO);
|
||||
// 支付 payment_type
|
||||
return pay;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,92 @@
|
||||
package com.fuint.business.marketingActivity.cardValueOrders.controller;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 储值卡订单表(CardValueOrders)表控制层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 15:57:43
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("business/marketingActivity/activeExchange/cardValueOrders")
|
||||
public class CardValueOrdersController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Resource
|
||||
private CardValueOrdersService cardValueOrdersService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param cardValueOrders
|
||||
* @return
|
||||
*/
|
||||
@GetMapping
|
||||
public ResponseObject selectAll(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||
@Param("cardValueOrders") CardValueOrders cardValueOrders) {
|
||||
Page page = new Page(pageNo, pageSize);
|
||||
return getSuccessResult(this.cardValueOrdersService.page(page, new QueryWrapper<>(cardValueOrders)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ResponseObject selectOne(@PathVariable Serializable id) {
|
||||
return getSuccessResult(this.cardValueOrdersService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param cardValueOrders 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ResponseObject insert(@RequestBody CardValueOrders cardValueOrders) {
|
||||
return getSuccessResult(this.cardValueOrdersService.save(cardValueOrders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param cardValueOrders 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ResponseObject update(@RequestBody CardValueOrders cardValueOrders) {
|
||||
return getSuccessResult(this.cardValueOrdersService.updateById(cardValueOrders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardValueOrdersService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,197 @@
|
||||
package com.fuint.business.marketingActivity.cardValueOrders.entity;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 储值卡订单表(CardValueOrders)表实体类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 15:57:44
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CardValueOrders extends Model<CardValueOrders> {
|
||||
//主键id
|
||||
private Integer id;
|
||||
//付款用户
|
||||
private String payUser;
|
||||
//支付类型
|
||||
private String payType;
|
||||
//订单号
|
||||
private String orderNo;
|
||||
//所属店铺ID
|
||||
private Integer storeId;
|
||||
//用户ID
|
||||
private Integer userId;
|
||||
//订单金额
|
||||
private Double amount;
|
||||
//支付金额
|
||||
private Double payAmount;
|
||||
//优惠金额
|
||||
private Double discount;
|
||||
//用户备注
|
||||
private String remark;
|
||||
//订单状态
|
||||
private String status;
|
||||
//支付时间
|
||||
private Date payTime;
|
||||
//推荐员工
|
||||
private Integer staffId;
|
||||
//创建时间
|
||||
private Date createTime;
|
||||
//创建人
|
||||
private String createBy;
|
||||
//更新时间
|
||||
private Date updateTime;
|
||||
//更新人
|
||||
private String updateBy;
|
||||
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPayUser() {
|
||||
return payUser;
|
||||
}
|
||||
|
||||
public void setPayUser(String payUser) {
|
||||
this.payUser = payUser;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public Integer getStoreId() {
|
||||
return storeId;
|
||||
}
|
||||
|
||||
public void setStoreId(Integer storeId) {
|
||||
this.storeId = storeId;
|
||||
}
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Double getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(Double amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Double getPayAmount() {
|
||||
return payAmount;
|
||||
}
|
||||
|
||||
public void setPayAmount(Double payAmount) {
|
||||
this.payAmount = payAmount;
|
||||
}
|
||||
|
||||
public Double getDiscount() {
|
||||
return discount;
|
||||
}
|
||||
|
||||
public void setDiscount(Double discount) {
|
||||
this.discount = discount;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Date getPayTime() {
|
||||
return payTime;
|
||||
}
|
||||
|
||||
public void setPayTime(Date payTime) {
|
||||
this.payTime = payTime;
|
||||
}
|
||||
|
||||
public Integer getStaffId() {
|
||||
return staffId;
|
||||
}
|
||||
|
||||
public void setStaffId(Integer staffId) {
|
||||
this.staffId = staffId;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.cardValueOrders.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
|
||||
/**
|
||||
* 储值卡订单表(CardValueOrders)表数据库访问层
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 15:57:44
|
||||
*/
|
||||
public interface CardValueOrdersMapper extends BaseMapper<CardValueOrders> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.fuint.business.marketingActivity.cardValueOrders.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
|
||||
/**
|
||||
* 储值卡订单表(CardValueOrders)表服务接口
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 15:57:44
|
||||
*/
|
||||
public interface CardValueOrdersService extends IService<CardValueOrders> {
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.fuint.business.marketingActivity.cardValueOrders.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 储值卡订单表(CardValueOrders)表服务实现类
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-22 15:57:44
|
||||
*/
|
||||
@Service("cardValueOrdersService")
|
||||
public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMapper, CardValueOrders> implements CardValueOrdersService {
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user