子卡信息

This commit is contained in:
cun-nan 2023-12-28 13:14:35 +08:00
parent 323add1517
commit cd24222c2a
17 changed files with 232 additions and 24 deletions

View File

@ -125,7 +125,7 @@ public class FyPayServiceImpl implements FyPayService {
@Override
public Map<String, String> queryOrder(Map<String, String> map1) throws Exception {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Map<String, String> resMap =new HashMap<>();
resMap.put("msg","error");
try {
@ -140,6 +140,7 @@ public class FyPayServiceImpl implements FyPayService {
map.put("ins_cd", insCd);
map.put("mchnt_cd", mchntCd);
Integer storeId1 = Integer.valueOf(map1.get("storeId"));
// 余额新增
String type = "";
String payStates="";
@ -160,7 +161,7 @@ public class FyPayServiceImpl implements FyPayService {
List<OilOrder> list = oilOrderService.selectOilOrder(orderNo);
LJOrder goodsOrder = goodsOrderService.selectGoodsOrder(orderNo);
CashierOrder cashierOrder = cashierOrderService.selectCashierOrder(orderNo);
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(nowAccountInfo.getStoreId());
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(storeId1);
List<ReturnRecord> returnRecords = returnRecordService.selectReturnRecordByOrderNo(orderNo);
Date date = new Date();
if (reqMap.get("trans_stat").equals("SUCCESS")){

View File

@ -193,6 +193,7 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
map.put("privateKey", merchantConfig.getPrivateKey());
map.put("type", "CFR");
map.put("orderId", cardFuelRecordDTO.getId().toString());
map.put("storeId", nowAccountInfo.getStoreId().toString());
// 调用支付接口
try {
fyPayService.pay(map);

View File

@ -58,4 +58,10 @@ public interface CardValueRecordService extends IService<CardValueRecord> {
void export(HttpServletResponse response, CardValueRecord cardValueRecord);
void rechargeFinallDeal(String orderNo);
/**
* 根据用户id查询当前的储值卡信息
* @return
*/
CardValueRecord selectCardValueRecordByUserId();
}

View File

@ -3,6 +3,7 @@ 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -327,6 +328,7 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
map.put("privateKey",merchantConfig.getPrivateKey());
map.put("type","CVR");
map.put("orderId",cardValueRecordDTO.getId().toString());
map.put("storeId",nowAccountInfo.getStoreId().toString());
// 调用支付接口
try {
@ -678,5 +680,14 @@ public class CardValueRecordServiceImpl extends ServiceImpl<CardValueRecordMappe
cardValueRecord.setChainStoreId(nowAccountInfo.getChainStoreId());
save(cardValueRecord);
}
}
@Override
public CardValueRecord selectCardValueRecordByUserId() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mt_user_id",nowAccountInfo.getId());
queryWrapper.last("LIMIT 1");
return baseMapper.selectOne(queryWrapper);
}
}

View File

@ -56,7 +56,7 @@ public class CardValudChildrensController extends BaseController {
/**
* 新增数据
*
* 新增子卡信息
* @param cardValudChildrens 实体对象
* @return 新增结果
*/
@ -65,6 +65,15 @@ public class CardValudChildrensController extends BaseController {
return getSuccessResult(this.cardValudChildrensService.add(cardValudChildrens));
}
/**
* 根据用户id查询子卡列表信息
* @return
*/
@GetMapping("/list")
public ResponseObject list(){
return getSuccessResult(cardValudChildrensService.selectCardValudChildrensByUserId());
}
/**
* 修改数据
*

View File

@ -3,6 +3,9 @@ package com.fuint.business.marketingActivity.cardValueChildrens.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import java.util.List;
import java.util.Map;
/**
* 子卡表(CardValudChildrens)表服务接口
*
@ -16,6 +19,12 @@ public interface CardValudChildrensService extends IService<CardValudChildrens>
* @param cardValudChildrens
* @return
*/
boolean add(CardValudChildrens cardValudChildrens);
Map<String,String> add(CardValudChildrens cardValudChildrens);
/**
* 查询当前用户的子卡信息
* @return
*/
List<CardValudChildrens> selectCardValudChildrensByUserId();
}

View File

@ -1,14 +1,21 @@
package com.fuint.business.marketingActivity.cardValueChildrens.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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.cardValueChildrens.mapper.CardValudChildrensMapper;
import com.fuint.business.marketingActivity.cardValueChildrens.entity.CardValudChildrens;
import com.fuint.business.marketingActivity.cardValueChildrens.service.CardValudChildrensService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 子卡表(CardValudChildrens)表服务实现类
@ -18,20 +25,63 @@ import javax.annotation.Resource;
*/
@Service("cardValudChildrensService")
public class CardValudChildrensServiceImpl extends ServiceImpl<CardValudChildrensMapper, CardValudChildrens> implements CardValudChildrensService {
@Autowired
private CardValueRecordService cardValueRecordService;
@Resource
private CardValueService cardValueService;
/**
* 新增数据
* @param cardValudChildrens
* @return
*/
@Override
public boolean add(CardValudChildrens cardValudChildrens) {
public Map<String,String> add(CardValudChildrens cardValudChildrens) {
Map<String,String> res = new HashMap<>();
if (ObjectUtils.isNotEmpty(cardValudChildrens)){
CardValueRecord cardValueRecord = cardValueRecordService.selectCardValueRecordByUserId();
if (ObjectUtils.isNotEmpty(cardValudChildrens)){
if (cardValueRecord.getMobile().equals(cardValudChildrens.getCardChildPhones())){
res.put("error","添加失败,子卡手机号不能与主卡手机号一样!");
return res;
}
cardValudChildrens.setCardValueId(cardValueRecord.getCardValueId());
List<CardValudChildrens> list = this.selectCardValudChildrensByUserId();
if (list.size()>=2){
res.put("error","添加失败,最多只能添加两张子卡!");
return res;
}else {
boolean flag = false;
if (list.size() > 0) {
for (CardValudChildrens childrens : list) {
if (childrens.getCardChildPhones().equals(cardValudChildrens)) {
flag = true;
}
}
}
if (flag) {
res.put("error", "添加失败,此手机号已存在!");
return res;
}
baseMapper.insert(cardValudChildrens);
res.put("success", "添加成功!");
}
}
}
return false;
return res;
}
@Override
public List<CardValudChildrens> selectCardValudChildrensByUserId() {
CardValueRecord cardValueRecord = cardValueRecordService.selectCardValueRecordByUserId();
List<CardValudChildrens> list = null;
if (ObjectUtils.isNotEmpty(cardValueRecord)){
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("card_value_id",cardValueRecord.getCardValueId());
list = baseMapper.selectList(queryWrapper);
}
return list;
}
}

View File

@ -7,9 +7,11 @@ import com.fuint.business.order.service.CashierOrderService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* 收银员订单信息 controller层
@ -55,4 +57,10 @@ public class CashierOrderController extends BaseController {
CashierOrder cashierOrder = cashierOrderService.queryCashierOrder(id);
return getSuccessResult(cashierOrder);
}
@PostMapping("/orderNo")
public ResponseObject cashierOrderByOrderNo(@Validated @RequestBody Map<String,String> map){
String orderNo = map.get("orderNo");
return getSuccessResult(cashierOrderService.selectCashierOrder(orderNo));
}
}

View File

@ -234,7 +234,7 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
* 调用支付接口
* @param map
*/
private void pay(Map<String,String> map,String orderNo,int storeId){
private void pay(Map<String,String> map,String orderNo,Integer storeId){
// 先将支付状态改为未支付
String payType = map.get("payType");
if (!map.get("repaidAmount").equals("0") && !payType.equals("CASH")){
@ -257,6 +257,7 @@ public class HangBillServiceImpl extends ServiceImpl<HangBillMapper, HangBill> i
map1.put("goodsDes",merchantConfig.getMerchantName());
map1.put("publicKey",merchantConfig.getPublicKey());
map1.put("privateKey",merchantConfig.getPrivateKey());
map1.put("storeId",storeId.toString());
try {
fyPayService.pay(map1);
}catch (Exception e){

View File

@ -374,6 +374,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
map1.put("goodsOrder",map.get("goodsOrder"));
map1.put("oilOrder",map.get("oilOrder"));
map1.put("tankId",map.get("oilOrder"));
map1.put("storeId",storeId.toString());
// 调用支付接口
try {

View File

@ -28,6 +28,15 @@ public class LJStoreController extends BaseController {
return getSuccessResult(store);
}
/**
* 根据id查询门店信息
* @return
*/
@GetMapping("/{id}")
public ResponseObject queryStoreById(@PathVariable Integer id){
return getSuccessResult(storeService.queryStoreById(id));
}
@GetMapping("storeInfoUni")
public ResponseObject storeInfoUni(Integer storeId){
LJStore store = storeService.selectStoreByIdUni(storeId);

View File

@ -17,6 +17,12 @@ public interface ILJStoreService extends IService<LJStore> {
*/
public LJStore selectStoreById();
/**
* 根据id查询店铺信息
* @return
*/
public LJStore queryStoreById(int id);
public LJStore selectStoreByIdUni(Integer storeId);
/**

View File

@ -35,6 +35,11 @@ public class LJStoreServiceImpl extends ServiceImpl<LJStoreMapper, LJStore> impl
return store;
}
@Override
public LJStore queryStoreById(int id) {
return baseMapper.selectById(id);
}
/**
* 根据id查询店铺信息(小程序)
* @return

View File

@ -16,3 +16,12 @@ export function cashierOrder(id) {
method: 'get',
})
}
// 根据订单号查询油品订单信息
export function cashierOrderByOrderNo(data) {
return request({
url: '/business/oilOrder/orderNo',
method: 'post',
data: data
})
}

View File

@ -797,6 +797,7 @@
import {addHangBill} from "@/api/cashier/hangbill";
import {addCreditUnit, listCreditUnit} from "@/api/cashier/creditunit";
import {getSysConfig} from "@/api/staff/user/sysconfig";
import {cashierOrderByOrderNo} from "@/api/cashier/cashierorder";
const cityOptions = ['上海', '北京'];
export default {
@ -2331,6 +2332,7 @@
})
this.loading = true;
_this.queryPayStatus();
// console.log(_this.isQuery)
let timer = setInterval(function () {
if (_this.isQuery == false) {
_this.loading = false;
@ -2420,7 +2422,8 @@
queryPayStatus(){
let _this = this;
_this.timer = setInterval(function (){
oilOrder({orderNo:_this.orderNo}).then( response => {
// "234520231228115544f073f4"
cashierOrderByOrderNo({orderNo:_this.orderNo}).then( response => {
if (response.data!=null){
if (response.data.orderStatus == "unpaid"){
_this.isQuery = true;

View File

@ -14,12 +14,12 @@
<view class="gang" :class="{ 'lan' : tindex == index }"></view>
</view>
</view>
<view class="hong-card">
<!-- <view class="hong-card">
<view class="top-hang">
<view class="hgang"></view>
<view class="">加油站名称</view>
</view>
<view class="title-box">屯油</view>
<view class="title-box">储值</view>
<view class="red-bottom">
<view class="x-size">
<view class="">卡券卡密</view>
@ -29,20 +29,37 @@
<span>去完成</span>
</view>
</view>
</view> -->
<view class="hong-card" v-for="item in list" :key="item.id">
<view class="top-hang">
<view class="hgang"></view>
<view class="">{{store.name}}{{store.description ? "("+store.description+")" : ""}}</view>
</view>
<view class="title-box">储值卡</view>
<view class="red-bottom">
<view class="x-size">
<view class="">子卡手机号</view>
<view class="">{{item.cardChildPhones}}</view>
</view>
<view class="r-anniu">
<span>去完成</span>
</view>
</view>
</view>
<view class="x_anniu" @click="goDetail()">
<uni-icons type="plusempty" color="#fff" size="30"></uni-icons>
</view>
<!-- <u-empty v-if="list.length == 0 " mode="coupon" text="内容为空"
<u-empty v-if="list.length == 0" mode="coupon" text="内容为空"
icon="http://cdn.uviewui.com/uview/empty/coupon.png">
</u-empty> -->
</u-empty>
</view>
</view>
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
@ -56,16 +73,40 @@
},
],
list: []
list: [],
storeId: uni.getStorageSync("storeId"),
//
store:{},
}
},
onShow() {
this.getCardValueChildren()
this.getStore()
},
components: {
},
methods: {
//
getStore(){
request({
url: "business/storeInformation/store/"+this.storeId,
method: 'get',
}).then((res) => {
// console.log(res)
this.store = res.data
})
},
//
getCardValueChildren(){
request({
url: "cardValudChildrens/list",
method: 'get',
}).then((res) => {
// console.log(res)
this.list = res.data
})
},
tapindex(index) {
this.tindex = index
},

View File

@ -2,7 +2,7 @@
<view class="content">
<view class="container">
<view class="my-header">
<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-icons" @click="goBack"> <uni-icons type="left" size="16"></uni-icons> </view>
<view class="my-text">添加子卡</view>
<view class="my-icons"></view>
</view>
@ -10,10 +10,10 @@
<view class="input_">
<view class="">请输入手机号</view>
<view class="">
<input type="text" placeholder="请输入手机号" />
<input type="text" v-model="cardValueChildrens.cardChildPhones" placeholder="请输入手机号" />
</view>
</view>
<view class="anniu">
<view class="anniu" @click="submitCardValChildren">
<text>提交</text>
</view>
@ -23,12 +23,14 @@
</template>
<script>
import request from '../../utils/request'
export default {
data() {
return {
title: '',
cardValueChildrens:{
cardChildPhones:"",
},
}
},
@ -36,7 +38,43 @@
},
methods: {
goback() {
//
submitCardValChildren(){
if(this.cardValueChildrens.cardChildPhones==""){
uni.showToast({
title:"请填写子卡手机号",
icon:"none"
})
return;
}
if(this.cardValueChildrens.cardChildPhones.length!=11){
uni.showToast({
title:"请填写正确的手机号",
icon:"none"
})
return;
}
request({
url: "cardValudChildrens",
method: 'post',
data:this.cardValueChildrens,
}).then((res) => {
console.log(res)
if (res.data.error != null && res.data.error != undefined && res.data.error != ""){
uni.showToast({
title:res.data.error,
icon:"none"
})
}else{
uni.showToast({
title:"添加成功",
icon:"success"
})
this.goBack()
}
})
},
goBack() {
uni.navigateBack()
}
}