Helius
2020-12-22 66a014290fe3f7540ea460467c80bceea03c12a4
modify
5 files modified
105 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java 36 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java 33 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoListVo.java 11 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java 5 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml 20 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java
@@ -1,18 +1,23 @@
package com.matrix.system.app.action;
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.VipInfoListDto;
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.hive.bean.SysVipLevel;
import com.matrix.system.hive.service.SysVipInfoService;
import com.matrix.system.hive.service.SysVipLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author wzy
@@ -26,6 +31,9 @@
    @Autowired
    private SysVipInfoService sysVipInfoService;
    @Autowired
    private SysVipLevelService sysVipLevelService;
    @ApiOperation(value = "获取会员通讯录列表", notes = "获取会员通讯录列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = VipInfoListVo.class)
@@ -35,4 +43,24 @@
        return AjaxResult.buildSuccessInstance(sysVipInfoService.findVipAddressBook(vipInfoListDto));
    }
    @ApiOperation(value = "根据手机号查询用户信息", notes = "根据手机号查询用户信息")
    @GetMapping(value = "/findVipInfoByPhone/{phone}")
    public AjaxResult findVipInfoByPhone(@PathVariable("phone") String phone) {
        return null;
    }
    @ApiOperation(value = "查询会员类型", notes = "查询会员类型")
    @ApiResponses(
            @ApiResponse(code = 200, message = "ok", response = SysVipLevel.class)
    )
    @GetMapping(value = "/findVipType")
    public AjaxResult findVipType() {
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        SysVipLevel sysVipLevel = new SysVipLevel();
        if(!DataAuthUtil.hasAllShopAuth()) {
            sysVipLevel.setShopId(sysUsers.getShopId());
        }
        return AjaxResult.buildSuccessInstance(sysVipLevelService.findByModel(sysVipLevel));
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/VipInfoListDto.java
@@ -19,6 +19,15 @@
    @ApiModelProperty(value = "排序字段 monthArrived(本月到店次数) yearArrived(本年) used(消费) consume(消耗) vipLevel(会员等级) arriveTime(上次到店)", example = "zjm")
    private String sort = "zjm";
    @ApiModelProperty(value = "生日 1-三天内生日 2-本月生日 3-下月生日")
    private String birthType;
    @ApiModelProperty(value = "会员类型ID")
    private Long vipType;
    @ApiModelProperty(value = "其他 2-新客户 1-老客户")
    private String other;
    @ApiModelProperty(hidden = true)
    private Long shopId;
@@ -53,4 +62,28 @@
    public void setShopId(Long shopId) {
        this.shopId = shopId;
    }
    public String getBirthType() {
        return birthType;
    }
    public void setBirthType(String birthType) {
        this.birthType = birthType;
    }
    public Long getVipType() {
        return vipType;
    }
    public void setVipType(Long vipType) {
        this.vipType = vipType;
    }
    public String getOther() {
        return other;
    }
    public void setOther(String other) {
        this.other = other;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoListVo.java
@@ -25,6 +25,9 @@
    @ApiModelProperty(value = "会员ID")
    private Long id;
    @ApiModelProperty(value = "门店简称")
    private String shopName;
    public String getVipName() {
        return vipName;
    }
@@ -64,4 +67,12 @@
    public void setId(Long id) {
        this.id = id;
    }
    public String getShopName() {
        return shopName;
    }
    public void setShopName(String shopName) {
        this.shopName = shopName;
    }
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -9,6 +9,7 @@
import com.matrix.system.app.dto.VipInfoListDto;
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.DataAuthUtil;
import com.matrix.system.common.tools.ServiceUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.constance.TableMapping;
@@ -422,7 +423,9 @@
    @Override
    public List<VipInfoListVo> findVipAddressBook(VipInfoListDto vipInfoListDto) {
        SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        vipInfoListDto.setShopId(sysUsers.getShopId());
        if (!DataAuthUtil.hasAllShopAuth()) {
            vipInfoListDto.setShopId(sysUsers.getShopId());
        }
        return sysVipInfoDao.selectVipAddressBookByList(vipInfoListDto);
    }
}
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -1226,7 +1226,8 @@
               a.VIP_NAME vipName,
               a.PHONE phone,
               a.photo photo,
               b.arriveCnt arriveCnt
               b.arriveCnt arriveCnt,
               g.shop_short_name shopName
        from sys_vip_info a
        left join (
            select x.vip_id, count(1) arriveCnt from (
@@ -1268,6 +1269,8 @@
            select n.VIP_LEVEL vipLevel, n.ID from sys_vip_level n
            ) f on a.LEVEL_ID = f.ID
        </if>
        left join sys_shop_info g on a.shop_id = g.id
        left join sys_vip_level h on a.level_id=h.id
        where 1=1
        <if test="record.queryKey != null and record.queryKey != ''">
            and (instr(PHONE,#{record.queryKey})
@@ -1278,6 +1281,21 @@
        <if test="record.shopId != null">
            and a.shop_id=#{record.shopId}
        </if>
        <if test='record.birthType=="1"'>
            and a.BIRTHDAY1 between curdate() and DATE_ADD(CURDATE(), INTERVAL 3 DAY)
        </if>
        <if test='record.birthType=="2"'>
            and date_format(a.BIRTHDAY1, '%Y-%m') = date_format(CURDATE(), '%Y-%m')
        </if>
        <if test='record.birthType=="3"'>
            and PERIOD_DIFF(date_format(now() ,'%Y-%m') , date_format(a.BIRTHDAY1, '%Y-%m')) =1
        </if>
        <if test="record.vipType != null">
            and a.level_id=#{record.vipType}
        </if>
        <if test="record.other != null and record.other!=''">
            and a.is_deal=#{record.other}
        </if>
        <if test="record.sort == 'monthArrived' or record.sort == 'yearArrived'">
            order by arriveCnt ${record.order}