update 会员组

This commit is contained in:
2024-01-02 15:29:30 +08:00
parent 0518eb536d
commit 0199b743a9
8 changed files with 188 additions and 68 deletions

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.util.poi.ExcelUtil; import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.domain.MemberGroup;
import com.jsowell.pile.service.MemberGroupService; import com.jsowell.pile.service.MemberGroupService;
import com.jsowell.pile.vo.web.MemberGroupVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -34,7 +35,7 @@ public class MemberGroupController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(MemberGroup memberGroup) { public TableDataInfo list(MemberGroup memberGroup) {
startPage(); startPage();
List<MemberGroup> list = memberGroupService.selectMemberGroupList(memberGroup); List<MemberGroupVO> list = memberGroupService.selectMemberGroupList(memberGroup);
return getDataTable(list); return getDataTable(list);
} }
@@ -45,9 +46,9 @@ public class MemberGroupController extends BaseController {
@Log(title = "会员组", businessType = BusinessType.EXPORT) @Log(title = "会员组", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, MemberGroup memberGroup) { public void export(HttpServletResponse response, MemberGroup memberGroup) {
List<MemberGroup> list = memberGroupService.selectMemberGroupList(memberGroup); List<MemberGroupVO> list = memberGroupService.selectMemberGroupList(memberGroup);
ExcelUtil<MemberGroup> util = new ExcelUtil<MemberGroup>(MemberGroup.class); ExcelUtil<MemberGroup> util = new ExcelUtil<MemberGroup>(MemberGroup.class);
util.exportExcel(response, list, "会员组数据"); // util.exportExcel(response, list, "会员组数据");
} }
/** /**

View File

@@ -13,128 +13,134 @@ import java.math.BigDecimal;
* @author jsowell * @author jsowell
* @date 2023-12-26 * @date 2023-12-26
*/ */
public class MemberGroup extends BaseEntity public class MemberGroup extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 主键 */ /**
* 主键
*/
private Long id; private Long id;
/** 会员组编号 */ /**
* 会员组编号
*/
@Excel(name = "会员组编号") @Excel(name = "会员组编号")
private String groupCode; private String groupCode;
/** 运营商id */ /**
* 运营商id
*/
@Excel(name = "运营商id") @Excel(name = "运营商id")
private String merchantId; private String merchantId;
/** 站点id */ /**
* 站点id
*/
@Excel(name = "站点id") @Excel(name = "站点id")
private String stationId; private String stationId;
/** 会员组等级 */ /**
* 会员组等级
*/
@Excel(name = "会员组等级") @Excel(name = "会员组等级")
private String groupLevel; private String groupLevel;
/** 类型1-服务费折扣2-电费折扣 3-电费和服务费一起折扣) */ /**
* 类型1-服务费折扣2-电费折扣 3-电费和服务费一起折扣)
*/
@Excel(name = "类型", readConverterExp = "1=-服务费折扣2-电费折扣,=3-电费和服务费一起折扣") @Excel(name = "类型", readConverterExp = "1=-服务费折扣2-电费折扣,=3-电费和服务费一起折扣")
private String groupType; private String groupType;
/** 折扣率 */ /**
* 折扣率
*/
@Excel(name = "折扣率") @Excel(name = "折扣率")
private BigDecimal discount; private BigDecimal discount;
/** 删除标识0-正常1-删除) */ /**
* 删除标识0-正常1-删除)
*/
private String delFlag; private String delFlag;
public void setId(Long id) public void setId(Long id) {
{
this.id = id; this.id = id;
} }
public Long getId() public Long getId() {
{
return id; return id;
} }
public void setGroupCode(String groupCode)
{ public void setGroupCode(String groupCode) {
this.groupCode = groupCode; this.groupCode = groupCode;
} }
public String getGroupCode() public String getGroupCode() {
{
return groupCode; return groupCode;
} }
public void setMerchantId(String merchantId)
{ public void setMerchantId(String merchantId) {
this.merchantId = merchantId; this.merchantId = merchantId;
} }
public String getMerchantId() public String getMerchantId() {
{
return merchantId; return merchantId;
} }
public void setStationId(String stationId)
{ public void setStationId(String stationId) {
this.stationId = stationId; this.stationId = stationId;
} }
public String getStationId() public String getStationId() {
{
return stationId; return stationId;
} }
public void setGroupLevel(String groupLevel)
{ public void setGroupLevel(String groupLevel) {
this.groupLevel = groupLevel; this.groupLevel = groupLevel;
} }
public String getGroupLevel() public String getGroupLevel() {
{
return groupLevel; return groupLevel;
} }
public void setGroupType(String groupType)
{ public void setGroupType(String groupType) {
this.groupType = groupType; this.groupType = groupType;
} }
public String getGroupType() public String getGroupType() {
{
return groupType; return groupType;
} }
public void setDiscount(BigDecimal discount)
{ public void setDiscount(BigDecimal discount) {
this.discount = discount; this.discount = discount;
} }
public BigDecimal getDiscount() public BigDecimal getDiscount() {
{
return discount; return discount;
} }
public void setDelFlag(String delFlag)
{ public void setDelFlag(String delFlag) {
this.delFlag = delFlag; this.delFlag = delFlag;
} }
public String getDelFlag() public String getDelFlag() {
{
return delFlag; return delFlag;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE) return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
.append("id", getId()) .append("id", getId())
.append("groupCode", getGroupCode()) .append("groupCode", getGroupCode())
.append("merchantId", getMerchantId()) .append("merchantId", getMerchantId())
.append("stationId", getStationId()) .append("stationId", getStationId())
.append("groupLevel", getGroupLevel()) .append("groupLevel", getGroupLevel())
.append("groupType", getGroupType()) .append("groupType", getGroupType())
.append("discount", getDiscount()) .append("discount", getDiscount())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())
.append("createTime", getCreateTime()) .append("createTime", getCreateTime())
.append("updateBy", getUpdateBy()) .append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime()) .append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.toString(); .toString();
} }
} }

View File

@@ -1,6 +1,7 @@
package com.jsowell.pile.mapper; package com.jsowell.pile.mapper;
import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.domain.MemberGroup;
import com.jsowell.pile.vo.web.MemberGroupVO;
import java.util.List; import java.util.List;
@@ -59,4 +60,6 @@ public interface MemberGroupMapper
* @return 结果 * @return 结果
*/ */
public int deleteMemberGroupByIds(Long[] ids); public int deleteMemberGroupByIds(Long[] ids);
List<MemberGroupVO> queryMemberGroupList(MemberGroup memberGroup);
} }

View File

@@ -1,6 +1,7 @@
package com.jsowell.pile.service; package com.jsowell.pile.service;
import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.domain.MemberGroup;
import com.jsowell.pile.vo.web.MemberGroupVO;
import java.util.List; import java.util.List;
@@ -26,7 +27,7 @@ public interface MemberGroupService
* @param memberGroup 会员组 * @param memberGroup 会员组
* @return 会员组集合 * @return 会员组集合
*/ */
public List<MemberGroup> selectMemberGroupList(MemberGroup memberGroup); public List<MemberGroupVO> selectMemberGroupList(MemberGroup memberGroup);
/** /**
* 新增会员组 * 新增会员组

View File

@@ -1,9 +1,13 @@
package com.jsowell.pile.service.impl; package com.jsowell.pile.service.impl;
import com.google.common.collect.Lists;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
import com.jsowell.common.util.id.IdUtils;
import com.jsowell.pile.domain.MemberGroup; import com.jsowell.pile.domain.MemberGroup;
import com.jsowell.pile.mapper.MemberGroupMapper; import com.jsowell.pile.mapper.MemberGroupMapper;
import com.jsowell.pile.service.MemberGroupService; import com.jsowell.pile.service.MemberGroupService;
import com.jsowell.pile.vo.web.MemberGroupVO;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -38,8 +42,12 @@ public class MemberGroupServiceImpl implements MemberGroupService {
* @return 会员组 * @return 会员组
*/ */
@Override @Override
public List<MemberGroup> selectMemberGroupList(MemberGroup memberGroup) { public List<MemberGroupVO> selectMemberGroupList(MemberGroup memberGroup) {
return memberGroupMapper.selectMemberGroupList(memberGroup); List<MemberGroupVO> resultList = memberGroupMapper.queryMemberGroupList(memberGroup);
if (CollectionUtils.isEmpty(resultList)) {
return Lists.newArrayList();
}
return resultList;
} }
/** /**
@@ -50,10 +58,33 @@ public class MemberGroupServiceImpl implements MemberGroupService {
*/ */
@Override @Override
public int insertMemberGroup(MemberGroup memberGroup) { public int insertMemberGroup(MemberGroup memberGroup) {
// 生成编号
memberGroup.setGroupCode(generateGroupCode());
memberGroup.setCreateTime(DateUtils.getNowDate()); memberGroup.setCreateTime(DateUtils.getNowDate());
return memberGroupMapper.insertMemberGroup(memberGroup); return memberGroupMapper.insertMemberGroup(memberGroup);
} }
// 生成编号
private String generateGroupCode() {
while (true) {
String groupCode = IdUtils.get16UUID("32");
// 通过walletCode查询是否已经存在
MemberGroup memberGroup = selectByGroupCode(groupCode);
if (memberGroup == null) {
return groupCode;
}
}
}
/**
* 根据会员组编号查询
* @param groupCode
* @return
*/
public MemberGroup selectByGroupCode(String groupCode) {
return null;
}
/** /**
* 修改会员组 * 修改会员组
* *

View File

@@ -0,0 +1,46 @@
package com.jsowell.pile.vo.web;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
@Getter
@Setter
public class MemberGroupVO {
private String id;
/**
* 会员组编号
*/
private String groupCode;
/**
* 运营商id
*/
private String merchantId;
/**
* 运营商名称
*/
private String merchantName;
/**
* 站点id
*/
private String stationId;
/**
* 站点名称
*/
private String stationName;
/** 会员组等级 */
private String groupLevel;
/** 类型1-服务费折扣2-电费折扣 3-电费和服务费一起折扣) */
private String groupType;
/** 折扣率 */
private BigDecimal discount;
}

View File

@@ -19,6 +19,10 @@
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
<sql id="Base_Column_List">
id, group_code, merchant_id, station_id, group_level, group_type, discount, create_by, create_time, update_by, update_time, del_flag
</sql>
<sql id="selectMemberGroupVo"> <sql id="selectMemberGroupVo">
select id, group_code, merchant_id, station_id, group_level, group_type, discount, create_by, create_time, update_by, update_time, del_flag from member_group select id, group_code, merchant_id, station_id, group_level, group_type, discount, create_by, create_time, update_by, update_time, del_flag from member_group
</sql> </sql>
@@ -100,4 +104,21 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="queryMemberGroupList" resultType="com.jsowell.pile.vo.web.MemberGroupVO">
select
t1.id as id,
t1.group_code as groupCode,
t1.merchant_id as merchantId,
t1.station_id as stationId,
t1.group_level as groupLevel,
t1.group_type as groupType,
t1.discount as discount,
t2.merchant_name as merchantName,
t3.station_name as stationName
from member_group t1
left join pile_merchant_info t2 on t1.merchant_id = t2.id
left join pile_station_info t3 on t3.id = t1.station_id
where t1.del_flag = '0'
</select>
</mapper> </mapper>

View File

@@ -95,12 +95,21 @@
<el-table v-loading="loading" :data="memberGroupList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="memberGroupList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" /> <!--<el-table-column label="主键" align="center" prop="id" />-->
<el-table-column label="会员组编号" align="center" prop="groupCode" /> <el-table-column label="集团编号" align="center" prop="groupCode" />
<el-table-column label="运营商id" align="center" prop="merchantId" /> <!--<el-table-column label="运营商id" align="center" prop="merchantId" />-->
<el-table-column label="站点id" align="center" prop="stationId" /> <el-table-column label="运营商名称" align="center" prop="merchantName" />
<el-table-column label="会员组等级" align="center" prop="groupLevel" /> <!--<el-table-column label="站点id" align="center" prop="stationId" />-->
<el-table-column label="类型" align="center" prop="groupType" /> <el-table-column label="站点名称" align="center" prop="stationName" />
<!--<el-table-column label="会员组等级" align="center" prop="groupLevel" />-->
<el-table-column label="类型" align="center" prop="groupType" >
<template slot-scope="scope">
<dict-tag
:options="dict.type.group_type"
:value="scope.row.groupType"
/>
</template>
</el-table-column>
<el-table-column label="折扣率" align="center" prop="discount" /> <el-table-column label="折扣率" align="center" prop="discount" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -176,8 +185,10 @@ import {getStationListByMerchantId} from "@/api/pile/station";
export default { export default {
name: "MemberGroup", name: "MemberGroup",
dicts: ["group_type"],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组