diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java index 7d6284521..0397e7c9c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/controller/CardValueRecordController.java @@ -78,7 +78,7 @@ public class CardValueRecordController extends BaseController { * @return 新增结果 */ @PostMapping - public ResponseObject insert(@RequestBody CardValueRecordDTO cardValueRecordDTO) { + public ResponseObject insert(@RequestBody CardValueRecordDTO cardValueRecordDTO) throws Exception { return getSuccessResult(this.cardValueRecordService.insert(cardValueRecordDTO)); } @@ -168,5 +168,15 @@ public class CardValueRecordController extends BaseController { Page page = new Page(pageNo, pageSize); return getSuccessResult(this.cardValueRecordService.selectAllRecord(page, cardValueRecord)); } + + /** + * 测试充值后续操作 + * @param orderNo + * @return + */ + @GetMapping("/testCharge/{orderNo}") + public void testCharge(@PathVariable String orderNo) { + this.cardValueRecordService.rechargeFinallDeal(orderNo); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java index c0a06fcd4..911fc0557 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/CardValueRecordService.java @@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.fuint.api.fuyou.entity.ReturnParameter; import com.fuint.business.integral.entity.IntegralDetail; import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO; import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord; @@ -10,6 +11,7 @@ import com.fuint.business.petrolStationManagement.entity.OilGun; import io.lettuce.core.dynamic.annotation.Param; import javax.servlet.http.HttpServletResponse; +import java.util.Map; /** * 储值充值表(CardValueRecord)表服务接口 @@ -25,7 +27,15 @@ public interface CardValueRecordService extends IService { * @param cardValueRecordDTO * @return */ - boolean insert(CardValueRecordDTO cardValueRecordDTO); + ReturnParameter insert(CardValueRecordDTO cardValueRecordDTO) throws Exception; + + /** + * 新增储值卡充值记录 + * + * @param orderNo + * @return + */ + boolean insert(String orderNo); /** * 余额充值 @@ -47,4 +57,5 @@ public interface CardValueRecordService extends IService { IPage selectAllRecord(@Param("page") Page page, CardValueRecordDTO cardValueRecord); void export(HttpServletResponse response, CardValueRecord cardValueRecord); + void rechargeFinallDeal(String orderNo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java index 116c5993b..3d9b6adf1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValue/service/impl/CardValueRecordServiceImpl.java @@ -2,23 +2,36 @@ package com.fuint.business.marketingActivity.cardValue.service.impl; import cn.hutool.core.util.ObjectUtil; import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.fuint.api.fuyou.entity.MerchantConfig; +import com.fuint.api.fuyou.entity.ReceiveParameter; +import com.fuint.api.fuyou.entity.ReturnParameter; import com.fuint.api.fuyou.service.FyPayService; import com.fuint.api.fuyou.service.MerchantConfigService; import com.fuint.business.commission.entity.CommissionRecord; import com.fuint.business.commission.service.CommissionRecordService; import com.fuint.business.integral.entity.IntegralDetail; import com.fuint.business.integral.service.IntegralDetailService; +import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange; +import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeService; +import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable; +import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService; import com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO; +import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild; 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.marketingActivity.cardValue.service.CardValueService; +import com.fuint.business.marketingActivity.cardValue.vo.CardValueVO; 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.marketingActivity.cardValueOrders.entity.CardValueOrders; +import com.fuint.business.member.entity.LJStaff; +import com.fuint.business.member.service.ILJStaffService; import com.fuint.business.order.entity.CardBalanceChange; import com.fuint.business.order.service.CardBalanceChangeService; import com.fuint.business.userManager.entity.UserBalance; @@ -29,9 +42,11 @@ import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.RocketUtil; import com.fuint.common.util.TokenUtil; import com.fuint.repository.mapper.MtStaffMapper; +import com.fuint.repository.model.MtBalance; import com.fuint.repository.model.MtStaff; import io.lettuce.core.dynamic.annotation.Param; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -54,44 +69,83 @@ public class CardValueRecordServiceImpl extends ServiceImpl map = new HashMap<>(); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); //订单信息 CardValueOrders cardValueOrders = new CardValueOrders(); + //会员信息 + LJUserVo ljUserVo = ljUserMapper.selectUserById(nowAccountInfo.getId()); + //员工信息 + LJStaff ljStaff = mtStaffService.selectStaffById(cardValueRecordDTO.getMtStaffId()); + //查询储值卡信息 + CardValueVO cardValue = cardValueService.getOneById(cardValueRecordDTO.getId()); + cardValueOrders.setCardValueId(cardValue.getId()); + cardValueOrders.setRechargeType("0"); + cardValueOrders.setBidBalance(cardValue.getBidBalance()); + cardValueOrders.setRechargeBalance(cardValue.getRechargeBalance()); + if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){ + cardValueOrders.setGiftBalance(cardValue.getGiftBalance()); + } + cardValueOrders.setPoints(cardValue.getPoints()); + cardValueOrders.setGrowthValue(cardValue.getGrowthValue()); + if (ObjectUtils.isNotEmpty(cardValue.getFringeBenefit())){ + cardValueOrders.setFringeBenefit(cardValue.getFringeBenefit()); + } + //查询储值卡对应的优惠券列表 + List cardValueVouchers = getCardValueVouchers(cardValue); + //筛选符合条件的优惠券并计算优惠金额 + if (CollectionUtils.isNotEmpty(cardValueVouchers)) { + for (CardFavorable cardValueVoucher : cardValueVouchers) { + cardValueOrders.setCardFavorableId(cardValueVoucher.getId()); + if (cardValue.getRechargeBalance() >= cardValueVoucher.getSatisfiedAmount()) { + cardFavorableValue += cardValueVoucher.getDiscountAmount(); + } + } + } + //查询储值卡对应的兑换券列表 + List cardExchangeVouchers = getCardExchangeVouchers(cardValue); + if (CollectionUtils.isNotEmpty(cardExchangeVouchers)){ + for (CardExchange cardExchangeVoucher : cardExchangeVouchers) { + cardValueOrders.setCardExchangeId(cardExchangeVoucher.getId()); + } + } //订单号 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); String timestamp = dateFormat.format(new Date()); @@ -100,44 +154,109 @@ public class CardValueRecordServiceImpl extends ServiceImpl map = new HashMap<>(); - map.put("authCode",cardValueRecordDTO.getAuthCode()); - map.put("allAmount",cardValueOrders.getAmount().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.applet(map); - pay = true; - } catch (Exception e){ - e.printStackTrace(); + //用户信息 + cardValueOrders.setStoreId(ljUserVo.getStoreId()); + cardValueOrders.setMtUserId(ljUserVo.getId()); + cardValueOrders.setName(ljUserVo.getName()); + cardValueOrders.setMobile(ljUserVo.getMobile()); + //员工信息 + cardValueOrders.setStaffId(ljStaff.getId()); + cardValueOrders.setRealName(ljStaff.getRealName()); + cardValueOrders.setStaffMobile(ljStaff.getMobile()); + //员工提成信息 + if (ObjectUtils.isNotEmpty(cardValue.getRoyaltyType())){ + cardValueOrders.setRoyaltyType(cardValue.getRoyaltyType()); + if (cardValue.getRoyaltyType().equals("3")){ + cardValueOrders.setAmountCommission(cardValue.getRechargeBalance() * cardValue.getPercentageCommissions()); + } } - - //支付成功之后添加充值记录 + if (ObjectUtils.isNotEmpty(cardValue.getAmountCommission())){ + cardValueOrders.setAmountCommission(cardValue.getAmountCommission()); + } + //订单金额 + cardValueOrders.setAmount(0.02); + /*if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){ + //订单金额 + cardValueOrders.setAmount(cardValue.getRechargeBalance()); + //支付金额 + cardValueOrders.setPayAmount(cardValue.getRechargeBalance() - cardValue.getGiftBalance() - cardFavorableValue); + }*/ + //支付金额 + cardValueOrders.setPayAmount(0.01); + //优惠金额 + if (ObjectUtils.isNotEmpty(cardValue.getGiftBalance())){ + cardValueOrders.setDiscount(cardValue.getGiftBalance() + cardFavorableValue); + } + cardValueOrders.setStatus("unpaid"); + //生成订单 + boolean save = cardValueOrdersService.save(cardValueOrders); + if (save) { + //生成订单之后调用支付接口 + ReceiveParameter receiveParameter = new ReceiveParameter(); + //封装支付参数 + receiveParameter.setOrderNo(orderNo); + receiveParameter.setType("3"); + receiveParameter.setStoreId(nowAccountInfo.getStoreId()); + receiveParameter.setGoodsMoney(cardValueOrders.getPayAmount()); + receiveParameter.setPayType(cardValueRecordDTO.getPayType()); + receiveParameter.setUserId(nowAccountInfo.getId()); + receiveParameter.setContent("储值卡充值"); + // 调用支付接口 + try { + map = fyPayService.applet(receiveParameter); + } catch (Exception e) { + e.printStackTrace(); + } + } + /*//支付成功之后添加充值记录 pay = addCardValueRecord(cardValueRecordDTO); - // 支付 payment_type - return pay; + */ + if (map.get("code").equals("success")){ + return JSONObject.parseObject(JSONObject.toJSONString(map.get("data")),ReturnParameter.class); + }else { + throw new Exception(map.get("msg").toString()); + } + } + + private List getCardExchangeVouchers(CardValueVO cardValue) { + ArrayList cardExchangeArrayList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(cardValue.getCardValueChildList())){ + for (CardValueChild cardValueChild : cardValue.getCardValueChildList()) { + //如果是兑换券 + if (cardValueChild.getActiveGift().equals("2")){ + cardExchangeArrayList.add(cardExchangeService.getById(cardValueChild.getVouchersId())); + } + } + } + return cardExchangeArrayList; + } + + private List getCardValueVouchers(CardValueVO cardValue) { + ArrayList cardFavorableArrayList = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(cardValue.getCardValueChildList())){ + for (CardValueChild cardValueChild : cardValue.getCardValueChildList()) { + //如果是优惠券 + if (cardValueChild.getActiveGift().equals("1")){ + cardFavorableArrayList.add(cardFavorableService.getById(cardValueChild.getVouchersId())); + } + } + } + return cardFavorableArrayList; + } + + /** + * 新增储值卡充值记录 + * @param orderNo + * @return + */ + @Override + public boolean insert(String orderNo) { + //获取订单记录 + CardValueOrders cardValueOrders = cardValueOrdersService.getOneByOrderNo(orderNo); + //生成充值记录 + CardValueRecord cardValueRecord = new CardValueRecord(); + + return false; } @Override @@ -452,11 +571,85 @@ public class CardValueRecordServiceImpl extends ServiceImpl { - //主键id @TableId(type = IdType.AUTO) private Integer id; @@ -67,7 +68,7 @@ public class CardValueVO extends Model { private String[] membershipLevel; //排序 (数值越大,顺序越在前) private Integer sort; - //新人有礼卡券列表 + //卡券列表 private List cardValueChildList; //创建者 private String createBy; @@ -79,252 +80,4 @@ public class CardValueVO extends Model { //更新时间 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date updateTime; - - public String[] getMembershipLevel() { - return membershipLevel; - } - - public void setMembershipLevel(String[] membershipLevel) { - this.membershipLevel = membershipLevel; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getChainStoreId() { - return chainStoreId; - } - - public void setChainStoreId(Integer chainStoreId) { - this.chainStoreId = chainStoreId; - } - - public Integer getStoreId() { - return storeId; - } - - public void setStoreId(Integer storeId) { - this.storeId = storeId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getIsonline() { - return isonline; - } - - public void setIsonline(String isonline) { - this.isonline = isonline; - } - - public Double getBidBalance() { - return bidBalance; - } - - public void setBidBalance(Double bidBalance) { - this.bidBalance = bidBalance; - } - - public Double getRechargeBalance() { - return rechargeBalance; - } - - public void setRechargeBalance(Double rechargeBalance) { - this.rechargeBalance = rechargeBalance; - } - - public Double getGiftBalance() { - return giftBalance; - } - - public void setGiftBalance(Double giftBalance) { - this.giftBalance = giftBalance; - } - - public Integer getPoints() { - return points; - } - - public void setPoints(Integer points) { - this.points = points; - } - - public Integer getGrowthValue() { - return growthValue; - } - - public void setGrowthValue(Integer growthValue) { - this.growthValue = growthValue; - } - - public Integer getRefuelMoney() { - return refuelMoney; - } - - public void setRefuelMoney(Integer refuelMoney) { - this.refuelMoney = refuelMoney; - } - - public String getFringeBenefit() { - return fringeBenefit; - } - - public void setFringeBenefit(String fringeBenefit) { - this.fringeBenefit = fringeBenefit; - } - - public Integer getParticipationNo() { - return participationNo; - } - - public void setParticipationNo(Integer participationNo) { - this.participationNo = participationNo; - } - - public String getEmployeeCommission() { - return employeeCommission; - } - - public void setEmployeeCommission(String employeeCommission) { - this.employeeCommission = employeeCommission; - } - - public String getRoyaltyType() { - return royaltyType; - } - - public void setRoyaltyType(String royaltyType) { - this.royaltyType = royaltyType; - } - - public Double getAmountCommission() { - return amountCommission; - } - - public void setAmountCommission(Double amountCommission) { - this.amountCommission = amountCommission; - } - - public Double getPercentageCommissions() { - return percentageCommissions; - } - - public void setPercentageCommissions(Double percentageCommissions) { - this.percentageCommissions = percentageCommissions; - } - - public String getActiveTime() { - return activeTime; - } - - public void setActiveTime(String activeTime) { - this.activeTime = activeTime; - } - - public String getActivityProgress() { - return activityProgress; - } - - public void setActivityProgress(String activityProgress) { - this.activityProgress = activityProgress; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - - public String getActiveStatus() { - return activeStatus; - } - - public void setActiveStatus(String activeStatus) { - this.activeStatus = activeStatus; - } - - public String getPaymentValue() { - return paymentValue; - } - - public void setPaymentValue(String paymentValue) { - this.paymentValue = paymentValue; - } - - public String getGroupOriented() { - return groupOriented; - } - - public void setGroupOriented(String groupOriented) { - this.groupOriented = groupOriented; - } - - public Integer getSort() { - return sort; - } - - public void setSort(Integer sort) { - this.sort = sort; - } - - public List getCardValueChildList() { - return cardValueChildList; - } - - public void setCardValueChildList(List cardValueChildList) { - this.cardValueChildList = cardValueChildList; - } - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/entity/CardValueOrders.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/entity/CardValueOrders.java index 1e075a6e9..4800238b1 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/entity/CardValueOrders.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/entity/CardValueOrders.java @@ -1,29 +1,33 @@ package com.fuint.business.marketingActivity.cardValueOrders.entity; import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + import java.io.Serializable; /** * 储值卡订单表(CardValueOrders)表实体类 * * @author makejava - * @since 2023-12-22 15:57:44 + * @since 2023-12-25 09:42:39 */ @SuppressWarnings("serial") +@Data public class CardValueOrders extends Model { //主键id + @TableId(type = IdType.AUTO) private Integer id; - //付款用户 - private String payUser; //支付类型 private String payType; //订单号 private String orderNo; //所属店铺ID private Integer storeId; - //用户ID - private Integer userId; //订单金额 private Double amount; //支付金额 @@ -35,163 +39,57 @@ public class CardValueOrders extends Model { //订单状态 private String status; //支付时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date payTime; - //推荐员工 + //会员id + private Integer mtUserId; + //会员名字 + private String name; + //会员手机号码 + private String mobile; + //员工id private Integer staffId; - //创建时间 - private Date createTime; - //创建人 + //员工姓名 + private String realName; + //员工手机号码 + private String staffMobile; + //储值卡id + private Integer cardValueId; + //充值类型 0:充值卡 1:自定义 + private String rechargeType; + //储值卡面值 + private Double bidBalance; + //储值卡实际售价 + private Double rechargeBalance; + //储值卡赠送金额 + private Double giftBalance; + //支付方式 + private String paymentType; + //积分 + private Integer points; + //成长值 + private Integer growthValue; + //附加福利 + private String fringeBenefit; + //提成类型 1:无 2:按提成金额 3:按充值金额提成比例 + private String royaltyType; + //提成比例 + private Double percentageCommissions; + //员工提成金额 + private Double amountCommission; + //优惠券id + private Integer cardFavorableId; + //兑换券id + private Integer cardExchangeId; + //创建者 private String createBy; - //更新时间 - private Date updateTime; - //更新人 + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + //更新者 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; - } + //更新时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/CardValueOrdersMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/CardValueOrdersMapper.java index 379e7e494..dc2572025 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/CardValueOrdersMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/CardValueOrdersMapper.java @@ -11,5 +11,11 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde */ public interface CardValueOrdersMapper extends BaseMapper { + /** + * 根据订单编号返回订单信息 + * @param orderNo + * @return + */ + CardValueOrders getOneByOrderNo(String orderNo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/xml/CardValueOrdersMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/xml/CardValueOrdersMapper.xml new file mode 100644 index 000000000..dab87f78f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/mapper/xml/CardValueOrdersMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java index a7ac987cc..ef4f6f364 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java @@ -11,5 +11,11 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde */ public interface CardValueOrdersService extends IService { + /** + * 根据订单编号返回订单信息 + * @param orderNo + * @return + */ + CardValueOrders getOneByOrderNo(String orderNo); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java index 6ab471326..b7f668317 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java @@ -1,11 +1,13 @@ 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.mapper.CardValueOrdersMapper; import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + /** * 储值卡订单表(CardValueOrders)表服务实现类 * @@ -15,5 +17,17 @@ import org.springframework.stereotype.Service; @Service("cardValueOrdersService") public class CardValueOrdersServiceImpl extends ServiceImpl implements CardValueOrdersService { + @Resource + private CardValueOrdersMapper cardValueOrdersMapper; + /** + * 根据订单编号返回订单信息 + * @param orderNo + * @return + */ + @Override + public CardValueOrders getOneByOrderNo(String orderNo) { + + return cardValueOrdersMapper.getOneByOrderNo(orderNo); + } } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java index 60ed6086f..a3bd65370 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/userManager/service/UserBalanceService.java @@ -53,4 +53,5 @@ public interface UserBalanceService extends IService { * @return */ UserBalance getUserBalance(); + } diff --git a/gasStation-uni/pagesHome/MyCard/MyCard.vue b/gasStation-uni/pagesHome/MyCard/MyCard.vue index b88c90218..dfd091dc0 100644 --- a/gasStation-uni/pagesHome/MyCard/MyCard.vue +++ b/gasStation-uni/pagesHome/MyCard/MyCard.vue @@ -22,7 +22,7 @@ 通用余额 - {{cardBalance}} + {{cardBalance || ''}} @@ -56,7 +56,8 @@ 囤油卡 - {{cardsList[cardsIndex].type}}:{{cardsList[cardsIndex].oilType}} + {{cardsList[cardsIndex].type || '暂无囤油'}}:{{cardsList[cardsIndex].oilType || ''}} + diff --git a/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue b/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue index 2be6991cb..0956ea005 100644 --- a/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue +++ b/gasStation-uni/pagesHome/oilRecharge/oilRecharge.vue @@ -43,7 +43,7 @@ - + 立即充值 @@ -95,7 +95,7 @@ - + 立即充值 @@ -211,6 +211,57 @@ }, methods: { + //储值卡充值 + addValueCarRecords() { + request({ + url: 'business/marketingActivity/cardValueRecord', + method: 'post', + data: { + payType: 'WECHAT', + mtStaffId: '4', + id: 68 + }, + }).then(res => { + if (res.code === 200) { + let _this = this + console.log(res) + let payProvider = "wxpay" + _this.orderInfo = JSON.parse(res.data.reservedPayInfo); + uni.requestPayment({ + // 微信支付provider: 'wxpay' 支付宝支付 'alipay' + provider: payProvider, + timeStamp: _this.orderInfo.timeStamp, + nonceStr: _this.orderInfo.nonceStr, + package: _this.orderInfo.package, + signType: 'MD5', + paySign: _this.orderInfo.paySign, + success: function(res) { + console.log('success:', res); + uni.reLaunch({ + url: '/pagesRefuel/orderSuccess/index' + }) + }, + fail: function(err) { + // request({ + // url: "business/oilOrder/orderStatus", + // method: 'post', + // data: { + // "orderNo": res.data.data.orderNo, + // "status": "payFail" + // }, + // }).then((res) => { + // uni.showToast({ + // title: "支付失败!", + // icon: "error" + // }) + // }) + // console.log('fail:', err); + } + }); + } + + }) + }, confirms() { this.shows = false },