Merge branch 'master' of https://gitee.com/nny_1/oilSystem
This commit is contained in:
commit
5cc1c5bb3f
@ -12,6 +12,9 @@ public class CardValueRecordDTO extends CardValueRecord {
|
|||||||
private String obtain;
|
private String obtain;
|
||||||
private String authCode;
|
private String authCode;
|
||||||
private Double realyPayBills;
|
private Double realyPayBills;
|
||||||
|
//付款类型 1.微信 2.支付宝
|
||||||
|
private String payType;
|
||||||
|
//优惠券
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 会员id
|
// * 会员id
|
||||||
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.fuint.api.fuyou.entity.MerchantConfig;
|
import com.fuint.api.fuyou.entity.MerchantConfig;
|
||||||
import com.fuint.api.fuyou.entity.ReceiveParameter;
|
|
||||||
import com.fuint.api.fuyou.service.FyPayService;
|
import com.fuint.api.fuyou.service.FyPayService;
|
||||||
import com.fuint.api.fuyou.service.MerchantConfigService;
|
import com.fuint.api.fuyou.service.MerchantConfigService;
|
||||||
import com.fuint.business.commission.entity.CommissionRecord;
|
import com.fuint.business.commission.entity.CommissionRecord;
|
||||||
@ -18,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.entity.CardValueRecord;
|
||||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||||
import com.fuint.business.marketingActivity.cardValue.vo.Excel.CardValueRecordExcel;
|
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.entity.CardBalanceChange;
|
||||||
import com.fuint.business.order.service.CardBalanceChangeService;
|
import com.fuint.business.order.service.CardBalanceChangeService;
|
||||||
import com.fuint.business.userManager.entity.UserBalance;
|
import com.fuint.business.userManager.entity.UserBalance;
|
||||||
@ -78,6 +79,8 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
|||||||
RocketUtil rocketUtil;
|
RocketUtil rocketUtil;
|
||||||
@Resource
|
@Resource
|
||||||
private MtStaffMapper mtStaffMapper;
|
private MtStaffMapper mtStaffMapper;
|
||||||
|
@Resource
|
||||||
|
private CardValueOrdersService cardValueOrdersService;
|
||||||
/**
|
/**
|
||||||
* 储值卡充值(新增)
|
* 储值卡充值(新增)
|
||||||
* @param cardValueRecordDTO
|
* @param cardValueRecordDTO
|
||||||
@ -85,39 +88,35 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean insert(CardValueRecordDTO cardValueRecordDTO) {
|
public boolean insert(CardValueRecordDTO cardValueRecordDTO) {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
|
||||||
boolean pay = false;
|
boolean pay = false;
|
||||||
// 添加储存充值
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
cardValueRecordDTO.setPayStatus("unpaid");
|
//订单信息
|
||||||
// 根据日期生成支付编号
|
CardValueOrders cardValueOrders = new CardValueOrders();
|
||||||
|
//订单号
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
String timestamp = dateFormat.format(new Date());
|
String timestamp = dateFormat.format(new Date());
|
||||||
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
String randomString = UUID.randomUUID().toString().replace("-","").substring(0,6);
|
||||||
String orderNo = timestamp+randomString;
|
String orderNo = "cardvalue"+timestamp+randomString;
|
||||||
cardValueRecordDTO.setPaymentNo(orderNo);
|
cardValueOrders.setOrderNo(orderNo);
|
||||||
cardValueRecordDTO.setStoreId(nowAccountInfo.getStoreId());
|
//付款类型
|
||||||
if (ObjectUtil.isEmpty(cardValueRecordDTO.getBidBalance())) cardValueRecordDTO.setBidBalance(0.0);
|
cardValueOrders.setPayType(cardValueRecordDTO.getPayType());
|
||||||
if (cardValueRecordDTO.getBidBalance() <= 0.0) {
|
cardValueOrders.setStoreId(nowAccountInfo.getStoreId());
|
||||||
BigDecimal bigDecimal = new BigDecimal(cardValueRecordDTO.getBidBalance());
|
cardValueOrders.setUserId(nowAccountInfo.getId());
|
||||||
bigDecimal = bigDecimal.add(new BigDecimal(cardValueRecordDTO.getGiftBalance()).add(new BigDecimal(cardValueRecordDTO.getRechargeBalance())));
|
//订单金额
|
||||||
cardValueRecordDTO.setBidBalance(bigDecimal.doubleValue());
|
cardValueOrders.setAmount(0.1);
|
||||||
}
|
//支付金额
|
||||||
baseMapper.insert(cardValueRecordDTO);
|
cardValueOrders.setPayAmount(0.2);
|
||||||
|
//优惠金额
|
||||||
double epsilon = 1e-10; // 阈值
|
cardValueOrders.setDiscount(0.1);
|
||||||
|
cardValueOrders.setStaffId(cardValueRecordDTO.getMtStaffId());
|
||||||
Double theAmountToBePaid = 0.0;
|
//
|
||||||
|
pay = cardValueOrdersService.save(cardValueOrders);
|
||||||
|
|
||||||
Integer allAmount1 = (int) (theAmountToBePaid*100);
|
|
||||||
System.out.println("allAmount1:"+allAmount1);
|
|
||||||
Integer allAmount = (int) (0.01*100);
|
|
||||||
|
|
||||||
|
//生成订单之后调用支付接口
|
||||||
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIsUse("1");
|
||||||
// 处理支付需要的数据
|
|
||||||
Map<String,String> map = new HashMap<>();
|
Map<String,String> map = new HashMap<>();
|
||||||
map.put("authCode",cardValueRecordDTO.getAuthCode());
|
map.put("authCode",cardValueRecordDTO.getAuthCode());
|
||||||
map.put("allAmount",allAmount.toString());
|
map.put("allAmount",cardValueOrders.getAmount().toString());
|
||||||
map.put("orderNo",orderNo);
|
map.put("orderNo",orderNo);
|
||||||
map.put("payType",cardValueRecordDTO.getPaymentType());
|
map.put("payType",cardValueRecordDTO.getPaymentType());
|
||||||
map.put("insCd",merchantConfig.getInsCd());
|
map.put("insCd",merchantConfig.getInsCd());
|
||||||
@ -127,27 +126,18 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
|
|||||||
map.put("privateKey",merchantConfig.getPrivateKey());
|
map.put("privateKey",merchantConfig.getPrivateKey());
|
||||||
map.put("type","CVR");
|
map.put("type","CVR");
|
||||||
map.put("orderId",cardValueRecordDTO.getId().toString());
|
map.put("orderId",cardValueRecordDTO.getId().toString());
|
||||||
// 处理支付需要的数据
|
|
||||||
ReceiveParameter receiveParameter = new ReceiveParameter();
|
|
||||||
receiveParameter.setOrderNo(orderNo);
|
|
||||||
receiveParameter.setType("油品订单");
|
|
||||||
receiveParameter.setContent("油品订单");
|
|
||||||
receiveParameter.setGoodsMoney(theAmountToBePaid);
|
|
||||||
receiveParameter.setStoreId(0);
|
|
||||||
receiveParameter.setPayType("WECHAT");
|
|
||||||
receiveParameter.setUserId(101);
|
|
||||||
// 调用支付接口
|
// 调用支付接口
|
||||||
try {
|
try {
|
||||||
fyPayService.applet(receiveParameter);
|
fyPayService.applet(map);
|
||||||
pay = true;
|
pay = true;
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//支付成功之后添加充值记录
|
//支付成功之后添加充值记录
|
||||||
pay = addCardValueRecord(cardValueRecordDTO);
|
pay = addCardValueRecord(cardValueRecordDTO);
|
||||||
// 支付 payment_type
|
// 支付 payment_type
|
||||||
return pay;
|
return pay;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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