mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
运营商VIP
This commit is contained in:
@@ -15,6 +15,7 @@ import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.dto.CreateMerchantVipDTO;
|
||||
import com.jsowell.pile.dto.PlatformTesterDTO;
|
||||
import com.jsowell.pile.dto.QueryMemberInfoDTO;
|
||||
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
|
||||
@@ -77,6 +78,26 @@ public class MemberBasicInfoController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运营商VIP
|
||||
*/
|
||||
@PostMapping ("/createMerchantVip")
|
||||
public AjaxResult createMerchantVip(@RequestBody CreateMerchantVipDTO dto) {
|
||||
AjaxResult ajaxResult;
|
||||
try {
|
||||
memberBasicInfoService.createMerchantVip(dto);
|
||||
ajaxResult = AjaxResult.success();
|
||||
} catch (BusinessException e) {
|
||||
logger.error("新增运营商VIP error", e);
|
||||
ajaxResult = AjaxResult.error(e.getMessage() + ", 新增运营商VIP失败");
|
||||
} catch (Exception e) {
|
||||
logger.error("新增运营商VIP error", e);
|
||||
ajaxResult = AjaxResult.error("发生异常, 新增运营商VIP失败");
|
||||
}
|
||||
return ajaxResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前会员表中存在的运营商列表
|
||||
* http://localhost:8080/member/info/getMerchantListByAuth
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 新增运营商vip DTO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class CreateMerchantVipDTO {
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobileNumber;
|
||||
|
||||
/**
|
||||
* 所属运营商id
|
||||
*/
|
||||
private String targetMerchantId;
|
||||
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal updatePrincipalBalance;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.dto.CreateMerchantVipDTO;
|
||||
import com.jsowell.pile.dto.PlatformTesterDTO;
|
||||
import com.jsowell.pile.dto.QueryMemberInfoDTO;
|
||||
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
|
||||
@@ -147,4 +148,6 @@ public interface IMemberBasicInfoService {
|
||||
List<MemberBalanceVO> getMemberRefundAmount(List<String> memberIds);
|
||||
|
||||
List<MerchantVipVO> queryMerchantVipList(QueryMemberInfoDTO dto);
|
||||
|
||||
void createMerchantVip(CreateMerchantVipDTO dto);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.jsowell.pile.domain.MemberBasicInfo;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.MemberWalletInfo;
|
||||
import com.jsowell.pile.domain.MemberWalletLog;
|
||||
import com.jsowell.pile.dto.CreateMerchantVipDTO;
|
||||
import com.jsowell.pile.dto.PlatformTesterDTO;
|
||||
import com.jsowell.pile.dto.QueryMemberInfoDTO;
|
||||
import com.jsowell.pile.dto.UniAppQueryMemberBalanceDTO;
|
||||
@@ -322,17 +323,19 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
return null;
|
||||
}
|
||||
|
||||
BigDecimal totalAccountAmount = BigDecimal.ZERO;
|
||||
BigDecimal principalBalance = BigDecimal.ZERO;
|
||||
if (StringUtils.isNotBlank(merchantId)) {
|
||||
try {
|
||||
BigDecimal totalAccountAmount = BigDecimal.ZERO;
|
||||
BigDecimal principalBalance = BigDecimal.ZERO;
|
||||
MemberWalletInfo memberWalletInfo = memberWalletInfoService.selectByMemberId(memberId, merchantId);
|
||||
if (memberWalletInfo != null) {
|
||||
totalAccountAmount = memberWalletInfo.getPrincipalBalance();
|
||||
principalBalance = memberWalletInfo.getPrincipalBalance();
|
||||
}
|
||||
vo.setTotalAccountAmount(totalAccountAmount);
|
||||
vo.setPrincipalBalance(principalBalance);
|
||||
} catch (Exception e) {
|
||||
log.error("查询用户余额异常 memberId:{}, merchantId:{}", memberId, merchantId, e);
|
||||
}
|
||||
vo.setTotalAccountAmount(totalAccountAmount);
|
||||
vo.setPrincipalBalance(principalBalance);
|
||||
|
||||
// 查询用户车牌号
|
||||
MemberPlateNumberRelation memberPlateNumberRelation = new MemberPlateNumberRelation();
|
||||
@@ -490,4 +493,24 @@ public class MemberBasicInfoServiceImpl implements IMemberBasicInfoService {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMerchantVip(CreateMerchantVipDTO dto) {
|
||||
// 查询一级运营商
|
||||
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByMerchantId(dto.getTargetMerchantId());
|
||||
if (StringUtils.isBlank(firstLevelMerchantId)) {
|
||||
throw new BusinessException("", "没有查询到以及运营商信息");
|
||||
}
|
||||
// 根据手机号查询会员信息
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoMapper.selectInfoByMobileNumberAndMerchantId(dto.getMobileNumber(), firstLevelMerchantId);
|
||||
if (memberBasicInfo == null) {
|
||||
throw new BusinessException("", "根据手机号没有查询到会员信息");
|
||||
}
|
||||
UpdateMemberBalanceDTO updateMemberBalanceDTO = new UpdateMemberBalanceDTO();
|
||||
updateMemberBalanceDTO.setMemberId(memberBasicInfo.getMemberId());
|
||||
updateMemberBalanceDTO.setType(dto.getType());
|
||||
updateMemberBalanceDTO.setUpdatePrincipalBalance(dto.getUpdatePrincipalBalance());
|
||||
updateMemberBalanceDTO.setTargetMerchantId(dto.getTargetMerchantId());
|
||||
updateMemberBalance(updateMemberBalanceDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,15 @@ export function delInfo(id) {
|
||||
})
|
||||
}
|
||||
|
||||
// 开卡
|
||||
export function createMerchantVip(data) {
|
||||
return request({
|
||||
url: '/member/info/createMerchantVip',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改会员基础信息
|
||||
export function updateMemberBalance(data) {
|
||||
return request({
|
||||
|
||||
@@ -336,7 +336,7 @@ export default {
|
||||
getMerchantList() {
|
||||
getMerchantList().then((response) =>{
|
||||
console.log("response", response)
|
||||
this.merchantList = response.obj
|
||||
this.merchantList = response.obj;
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!--<el-col :span="1.5">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@@ -36,8 +36,8 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['member:info:add']"
|
||||
>新增</el-button>
|
||||
</el-col>-->
|
||||
>开卡</el-button>
|
||||
</el-col>
|
||||
<!--<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
@@ -151,25 +151,34 @@
|
||||
|
||||
<!-- 添加或修改会员基础信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="会员Id" prop="memberId">
|
||||
<el-input v-model="form.memberId" :disabled="true" placeholder="请输入手机号"/>
|
||||
<el-form ref="form" :model="createMerchantVip" :rules="rules" label-width="100px">
|
||||
<el-form-item label="选择运营商">
|
||||
<el-select
|
||||
v-model="createMerchantVip.targetMerchantId"
|
||||
clearable placeholder="请选择运营商"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in merchantList"
|
||||
:key="item.merchantName"
|
||||
:label="item.merchantName"
|
||||
:value="item.merchantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobileNumber">
|
||||
<el-input v-model="form.mobileNumber" :disabled="true" placeholder="请输入手机号"/>
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="createMerchantVip.mobileNumber" placeholder="请输入手机号码"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="nickName">
|
||||
<el-input v-model="form.nickName" placeholder="请输入昵称"/>
|
||||
<el-form-item label="操作类型">
|
||||
<el-radio v-model="createMerchantVip.type" label="1" border>充值</el-radio>
|
||||
<el-radio v-model="createMerchantVip.type" label="2" border>扣款</el-radio>
|
||||
</el-form-item>
|
||||
<el-form-item label="头像url" prop="avatarUrl">
|
||||
<el-input v-model="form.avatarUrl" placeholder="请输入头像url"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||
<el-form-item label="金额" prop="balance">
|
||||
<el-input-number v-model="createMerchantVip.updatePrincipalBalance" placeholder="请输入金额" :min="0" :controls="false"
|
||||
:precision="2"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button type="primary" @click="submitCreateMerchantVip">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -217,7 +226,7 @@ import {
|
||||
addInfo,
|
||||
updateInfo,
|
||||
updateMemberBalance,
|
||||
getMerchantList, queryMerchantVipList,
|
||||
getMerchantList, queryMerchantVipList, createMerchantVip,
|
||||
} from "@/api/member/info";
|
||||
|
||||
export default {
|
||||
@@ -268,7 +277,9 @@ export default {
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
rules: {},
|
||||
// 开卡参数
|
||||
createMerchantVip: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -280,7 +291,7 @@ export default {
|
||||
created() {
|
||||
this.getList();
|
||||
|
||||
// this.getMerchantList();
|
||||
this.getMerchantList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询会员基础信息列表 */
|
||||
@@ -304,7 +315,7 @@ export default {
|
||||
getMerchantList() {
|
||||
getMerchantList().then((response) =>{
|
||||
console.log("response", response)
|
||||
this.merchantList = response.obj
|
||||
this.merchantList = response.obj;
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
@@ -350,7 +361,7 @@ export default {
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加会员基础信息";
|
||||
this.title = "添加运营商VIP";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
@@ -407,6 +418,16 @@ export default {
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/* 开卡确定按钮 */
|
||||
submitCreateMerchantVip() {
|
||||
console.log("submitCreateMerchantVip", this.createMerchantVip);
|
||||
createMerchantVip(this.createMerchantVip).then(response => {
|
||||
console.log("开卡确定按钮 response:", response);
|
||||
this.$modal.msgSuccess("开卡成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
|
||||
Reference in New Issue
Block a user