Helius
2020-12-22 339b59abc36c0aa07b99cb6de1b0553de2f48d7e
modify
1 files added
8 files modified
387 ■■■■■ changed files
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java 20 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/dto/ModifyVipDto.java 146 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoDetailVo.java 24 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java 52 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java 2 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java 4 ●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java 101 ●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml 33 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml 5 ●●●●● patch | view | raw | blame | history
zq-erp/src/main/java/com/matrix/system/app/action/ApiVipInfoAction.java
@@ -5,7 +5,9 @@
import com.matrix.core.tools.StringUtils;
import com.matrix.core.tools.WebUtil;
import com.matrix.system.app.dto.AddVipDto;
import com.matrix.system.app.dto.ModifyVipDto;
import com.matrix.system.app.dto.VipInfoListDto;
import com.matrix.system.app.vo.VipInfoDetailVo;
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.app.vo.VipInfoVo;
import com.matrix.system.common.bean.CustomerDataDictionary;
@@ -73,9 +75,15 @@
    }
    @ApiOperation(value = "根据id查询用户详细信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = VipInfoDetailVo.class)
    })
    @GetMapping(value = "/findVipInfoDetailById/{id}")
    public AjaxResult findVipInfoDetailById(@PathVariable("id") Long id) {
        return null;
        VipInfoDetailVo vipInfoDetailVo = sysVipInfoService.findVipInfoDetail(id);
        AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功");
        ajaxResult.putInMap("vipInfo", vipInfoDetailVo);
        return ajaxResult;
    }
    @ApiOperation(value = "查询会员类型", notes = "查询会员类型")
@@ -111,12 +119,16 @@
        if (i > 0) {
            return AjaxResult.buildSuccessInstance("新增成功");
        }
        return AjaxResult.buildSuccessInstance("新增失败");
        return AjaxResult.buildFailInstance("新增失败");
    }
    @ApiOperation(value = "编辑会员", notes = "编辑会员")
    @PostMapping(value = "/modifyVip")
    public AjaxResult modifyVip(@RequestBody AddVipDto addVipDto) {
        return null;
    public AjaxResult modifyVip(@RequestBody ModifyVipDto modifyVipDto) {
        int i = sysVipInfoService.apiModifyVip(modifyVipDto);
        if (i > 0) {
            return AjaxResult.buildSuccessInstance("修改成功");
        }
        return AjaxResult.buildFailInstance("修改失败");
    }
}
zq-erp/src/main/java/com/matrix/system/app/dto/ModifyVipDto.java
New file
@@ -0,0 +1,146 @@
package com.matrix.system.app.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.tools.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
 * @author wzy
 * @date 2020-12-22
 **/
@ApiModel(value = "ModifyVipDto", description = "修改会员接收参数类")
public class ModifyVipDto {
    @NotNull(message = "参数错误")
    @ApiModelProperty(value = "会员ID")
    private Long vipId;
    @NotBlank(message = "姓名不能为空")
    @ApiModelProperty(value = "会员姓名")
    private String vipName;
    @NotBlank(message = "手机号不能为空")
    @ApiModelProperty(value = "手机号")
    private String phone;
    @NotBlank(message = "性别不能为空")
    @ApiModelProperty(value = "性别", example = "男/女")
    private String sex;
    @NotNull(message = "生日不能为空")
    @ApiModelProperty(value = "生日")
    @JsonFormat(pattern = DateUtil.DATE_FORMAT_DD, timezone = "GMT+8")
    private Date birthday;
    @ApiModelProperty(value = "省市区", example = "湖南省,长沙市,岳麓区")
    private String areas;
    @ApiModelProperty(value = "详细地址")
    private String address;
    @ApiModelProperty(value = "到店途径", example = "网络团购")
    private String arrivalWay;
    @ApiModelProperty(value = "推荐人ID")
    private Long recommendId;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "标签列表")
    private List<String> labels;
    public Long getVipId() {
        return vipId;
    }
    public void setVipId(Long vipId) {
        this.vipId = vipId;
    }
    public String getVipName() {
        return vipName;
    }
    public void setVipName(String vipName) {
        this.vipName = vipName;
    }
    public String getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getAreas() {
        return areas;
    }
    public void setAreas(String areas) {
        this.areas = areas;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    public String getArrivalWay() {
        return arrivalWay;
    }
    public void setArrivalWay(String arrivalWay) {
        this.arrivalWay = arrivalWay;
    }
    public Long getRecommendId() {
        return recommendId;
    }
    public void setRecommendId(Long recommendId) {
        this.recommendId = recommendId;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public List<String> getLabels() {
        return labels;
    }
    public void setLabels(List<String> labels) {
        this.labels = labels;
    }
}
zq-erp/src/main/java/com/matrix/system/app/vo/VipInfoDetailVo.java
@@ -2,10 +2,12 @@
import com.fasterxml.jackson.annotation.JsonFormat;
import com.matrix.core.tools.DateUtil;
import com.matrix.system.hive.bean.SysVipLabel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
 * @author wzy
@@ -13,6 +15,9 @@
 **/
@ApiModel(value = "VipInfoDetailVo", description = "客户详细信息接口返回类")
public class VipInfoDetailVo {
    @ApiModelProperty(value = "会员ID")
    private Long id;
    @ApiModelProperty(value = "会员姓名")
    private String vipName;
@@ -48,6 +53,25 @@
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "标签")
    private List<SysVipLabel> labels;
    public List<SysVipLabel> getLabels() {
        return labels;
    }
    public void setLabels(List<SysVipLabel> labels) {
        this.labels = labels;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getVipName() {
        return vipName;
    }
zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java
@@ -190,6 +190,26 @@
    private Long companyId;
    /**
     * 省
     */
    private String province;
    /**
     * 市
     */
    private String city;
    /**
     * 区
     */
    private String area;
    /**
     * 推荐人
     */
    private Long recommendId;
    //血型
    private String blood;
@@ -210,6 +230,38 @@
    private SysOrder sysOrder;
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getArea() {
        return area;
    }
    public void setArea(String area) {
        this.area = area;
    }
    public Long getRecommendId() {
        return recommendId;
    }
    public void setRecommendId(Long recommendId) {
        this.recommendId = recommendId;
    }
    public SysOrder getSysOrder() {
        return sysOrder;
    }
zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java
@@ -14,4 +14,6 @@
    List<SysVipLabel> selectByVipId(@Param("vipId") Long vipId);
    List<SysVipLabel> selectByModel(@Param("record") SysVipLabel sysVipLabel);
    int deleteByVipId(@Param("vipId") Long vipId);
}
zq-erp/src/main/java/com/matrix/system/hive/service/SysVipInfoService.java
@@ -2,7 +2,9 @@
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.app.dto.AddVipDto;
import com.matrix.system.app.dto.ModifyVipDto;
import com.matrix.system.app.dto.VipInfoListDto;
import com.matrix.system.app.vo.VipInfoDetailVo;
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.hive.bean.SysVipInfo;
import com.matrix.system.hive.plugin.util.BaseServices;
@@ -190,5 +192,7 @@
        int apiAddVip(AddVipDto addVipDto);
        int apiModifyVip(ModifyVipDto modifyVipDto);
        VipInfoDetailVo findVipInfoDetail(Long id);
}
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java
@@ -7,7 +7,9 @@
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelUtil;
import com.matrix.system.app.dto.AddVipDto;
import com.matrix.system.app.dto.ModifyVipDto;
import com.matrix.system.app.dto.VipInfoListDto;
import com.matrix.system.app.vo.VipInfoDetailVo;
import com.matrix.system.app.vo.VipInfoListVo;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.DataAuthUtil;
@@ -452,10 +454,18 @@
        vipInfo.setPhone(addVipDto.getPhone());
        vipInfo.setAddr(addVipDto.getAddress());
        vipInfo.setRemark(addVipDto.getRemark());
        vipInfo.setBirthday1(addVipDto.getBirthday());
        vipInfo.setRecommendId(addVipDto.getRecommendId());
        if (StringUtils.isNotBlank(addVipDto.getAreas())) {
            String[] areas = addVipDto.getAreas().split(",");
            vipInfo.setProvince(areas[0]);
            vipInfo.setCity(areas[1]);
            vipInfo.setArea(areas[2]);
        }
        vipInfo.setInDate(new Date());
        vipInfo.setPointAll(0);
        vipInfo.setBirthday1(addVipDto.getBirthday());
        vipInfo.setVipState(Dictionary.VIP_STATE_HY);
        vipInfo.setStaffId(user.getSuId());
        vipInfo.setShopId(user.getShopId());
@@ -469,20 +479,89 @@
        int i=sysVipInfoDao.insert(vipInfo);
        if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) {
            Set<String> labels = new HashSet<>(addVipDto.getLabels());
            Iterator<String> iterator = labels.iterator();
            if (iterator.hasNext()) {
                SysVipLabel sysVipLabel = new SysVipLabel();
                sysVipLabel.setCreateTime(new Date());
                sysVipLabel.setCreateBy(user.getSuName());
                sysVipLabel.setLabel(iterator.next());
                sysVipLabel.setVipId(vipInfo.getId());
                sysVipLabelDao.insert(sysVipLabel);
            }
            batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId());
        }
        //创建用户默认储值卡
        addVipDefaultCard(vipInfo.getId());
        return i;
    }
    @Override
    public int apiModifyVip(ModifyVipDto modifyVipDto) {
        SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        if (serviceUtil.addCheckRepeatTowColumn(TableMapping.SYS_VIP_INFO, "PHONE", modifyVipDto.getPhone(),
                "company_id",user.getCompanyId() )) {
            throw new GlobleException("手机已被注册!");
        }
        SysVipInfo vipInfo = sysVipInfoDao.selectById(modifyVipDto.getVipId());
        if (vipInfo == null) {
            throw new GlobleException("用户不存在");
        }
        if (StringUtils.isNotBlank(modifyVipDto.getAreas())) {
            String[] areas = modifyVipDto.getAreas().split(",");
            vipInfo.setProvince(areas[0]);
            vipInfo.setCity(areas[1]);
            vipInfo.setArea(areas[2]);
        }
        vipInfo.setVipName(modifyVipDto.getVipName());
        vipInfo.setSex(modifyVipDto.getSex());
        vipInfo.setArrivalWay(modifyVipDto.getArrivalWay());
        vipInfo.setPhone(modifyVipDto.getPhone());
        vipInfo.setAddr(modifyVipDto.getAddress());
        vipInfo.setRemark(modifyVipDto.getRemark());
        vipInfo.setBirthday1(modifyVipDto.getBirthday());
        vipInfo.setRecommendId(modifyVipDto.getRecommendId());
        int i = sysVipInfoDao.update(vipInfo);
        if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) {
            sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId());
            batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId());
        }
        return i;
    }
    private void batchInsertLabel(List<String> labelList, String suName, Long id) {
        Set<String> labels = new HashSet<>(labelList);
        Iterator<String> iterator = labels.iterator();
        if (iterator.hasNext()) {
            SysVipLabel sysVipLabel = new SysVipLabel();
            sysVipLabel.setCreateTime(new Date());
            sysVipLabel.setCreateBy(suName);
            sysVipLabel.setLabel(iterator.next());
            sysVipLabel.setVipId(id);
            sysVipLabelDao.insert(sysVipLabel);
        }
    }
    @Override
    public VipInfoDetailVo findVipInfoDetail(Long id) {
        SysVipInfo sysVipInfo = sysVipInfoDao.selectById(id);
        if (sysVipInfo == null) {
            throw new GlobleException("用户不存在");
        }
        VipInfoDetailVo vipInfoDetailVo = new VipInfoDetailVo();
        vipInfoDetailVo.setVipName(sysVipInfo.getVipName());
        vipInfoDetailVo.setAddress(sysVipInfo.getAddr());
        vipInfoDetailVo.setPhone(sysVipInfo.getPhone());
        vipInfoDetailVo.setSex(sysVipInfo.getSex());
        vipInfoDetailVo.setArrivalWay(sysVipInfo.getArrivalWay());
        vipInfoDetailVo.setRecommendId(sysVipInfo.getRecommendId());
        vipInfoDetailVo.setId(sysVipInfo.getId());
        vipInfoDetailVo.setProvince(sysVipInfo.getProvince());
        vipInfoDetailVo.setCity(sysVipInfo.getCity());
        vipInfoDetailVo.setArea(sysVipInfo.getArea());
        vipInfoDetailVo.setRemark(sysVipInfo.getRemark());
        vipInfoDetailVo.setBirthday(sysVipInfo.getBirthday1());
        List<SysVipLabel> labels = sysVipLabelDao.selectByVipId(sysVipInfo.getId());
        vipInfoDetailVo.setLabels(labels);
        return vipInfoDetailVo;
    }
}
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipInfoDao.xml
@@ -35,6 +35,9 @@
        <result property="disease" column="disease"/>
        <result property="zjm" column="zjm"/>
        <result property="companyId" column="company_id"/>
        <result property="province" column="province"/>
        <result property="city" column="city"/>
        <result property="area" column="area"/>
        <result property="statu" column="statu"/>
        <result property="birthdayType" column="birthdayType"/>
@@ -274,7 +277,11 @@
        disease,
        is_deal,
        zjm,
        company_id
        company_id,
        province,
        city,
        area,
        recommend_id
        )
@@ -318,7 +325,11 @@
        #{disease},
        #{isDeal},
        #{zjm},
        #{companyId}
        #{companyId},
        #{province},
        #{city},
        #{area},
        #{recommendId}
        )
    </insert>
@@ -444,6 +455,18 @@
            </if>
            <if test="isDeal != null  ">
                is_deal = #{isDeal},
            </if>
            <if test="recommendId != null  ">
                recommend_id = #{recommendId},
            </if>
            <if test="province != null and province !=''  ">
                province = #{province},
            </if>
            <if test="city != null and city !=''  ">
                city = #{city},
            </if>
            <if test="area != null and area !=''  ">
                area = #{area},
            </if>
@@ -937,7 +960,11 @@
        a.create_distribution_time,
        a.birthdayType,
        a.disease,
        a.is_deal
        a.is_deal,
        a.province,
        a.city,
        a.area,
        a.recommend_id
    </sql>
    <sql id="from">
        from sys_vip_info a
zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml
@@ -44,4 +44,9 @@
            </if>
        </if>
    </select>
    <delete id="deleteByVipId">
        delete from sys_vip_label
        where vip_id=#{vipId}
    </delete>
</mapper>