Просмотр исходного кода

[会员管理][修复]:会员管理修改

release_toaliyun_real
Stormeye.Wu 7 лет назад
Родитель
Сommit
6848cb7259
14 измененных файлов: 450 добавлений и 475 удалений
  1. +142
    -156
      mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java
  2. +2
    -2
      mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java
  3. +8
    -16
      mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java
  4. +121
    -109
      mallinkService/src/main/java/com/simple/domain/dto/WxCUserBasicInfoDto.java
  5. +1
    -11
      mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java
  6. +4
    -5
      mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java
  7. +2
    -2
      mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java
  8. +4
    -4
      mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java
  9. +2
    -2
      mallinkService/src/main/java/com/simple/service/WxCUserService.java
  10. +4
    -4
      mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java
  11. +2
    -2
      mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java
  12. +2
    -2
      mallinkService/src/main/java/com/simple/service/impl/WxScoreRulesServiceImpl.java
  13. +155
    -159
      mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml
  14. +1
    -1
      mallinkService/src/main/resources/mapper/WxCUserMapper.xml

+ 142
- 156
mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java Просмотреть файл

@@ -1,108 +1,85 @@
package com.simple.controller;

import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.simple.common.Result;
import com.simple.common.ResultData;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.po.WxCUser;
import com.simple.domain.po.WxCUserBasicInfo;
import com.simple.domain.po.WxCUserTags;
import com.simple.domain.po.WxCoupon;
import com.simple.domain.po.WxCouponOrder;
import com.simple.domain.po.WxTags;
import com.simple.domain.vo.UserStructureVo;
import com.simple.enums.EnumAgeInfo;
import com.simple.service.WxCUserBasicInfoService;
import com.simple.service.WxCUserService;
import com.simple.service.WxCUserTagsService;
import com.simple.service.WxCouponOrderService;
import com.simple.service.WxCouponService;
import com.simple.service.WxTagsService;

import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.*;
import com.simple.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("wxCUserBasicInfo")
@Api(description="会员管理相关接口")
public class WxCUserBasicInfoController extends BaseController
{
@Autowired
@Api(description = "会员管理相关接口")
public class WxCUserBasicInfoController extends BaseController {
@Autowired
private WxCUserBasicInfoService wxCUserBasicInfoService;
@Autowired
private WxCUserTagsService wxCUserTagsService;
@Autowired
private WxTagsService wxTagsService;
@Autowired
private WxCUserService wxCUserService;
@Autowired
private WxCouponOrderService wxCouponOrderService;
@Autowired
private WxCouponService wxCouponService;
@Autowired
private WxCUserTagsService wxCUserTagsService;
@Autowired
private WxTagsService wxTagsService;
@Autowired
private WxCUserService wxCUserService;
@Autowired
private WxCouponOrderService wxCouponOrderService;
@Autowired
private WxCouponService wxCouponService;

private Logger logger = Logger.getLogger(WxCUserBasicInfoController.class);
@ApiOperation("分页列表接口")
@ApiOperation("分页列表接口")
@GetMapping("list")
@ApiImplicitParams({
@ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true),
@ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)})
public ResultData list(@ModelAttribute WxCuerBasicInfoDto wxCUserBasicInfo,Integer pageNum, Integer pageSize) {
if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCuerBasicInfoDto();
String tenantId = getTenantId();
wxCUserBasicInfo.setTenantId(tenantId);
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)})
public ResultData list(@ModelAttribute WxCUserBasicInfoDto wxCUserBasicInfo, Integer pageNum, Integer pageSize) {
if (null == wxCUserBasicInfo) wxCUserBasicInfo = new WxCUserBasicInfoDto();
String tenantId = getTenantId();
wxCUserBasicInfo.setTenantId(tenantId);
PageInfo<WxCUserBasicInfo> page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize);
if(page.getSize()==0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone())
&& wxCUserBasicInfo.getEndTime()==null && wxCUserBasicInfo.getStartTime()==null
&& StringUtils.isBlank(wxCUserBasicInfo.getName())
) {//当只有手机号查询并且查不到数据 ,新增
WxCUser cUser = new WxCUser();
cUser.setTenantId(tenantId);
cUser.setPhone(wxCUserBasicInfo.getPhone());
PageInfo<WxCUser> cUsers = wxCUserService.listAsPage(cUser, 1, 1);
if(cUsers.getSize()>0) {
createUserBasicInfo(cUsers.getList().get(0));
page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize);
}
if (page.getSize() == 0 && StringUtils.isNotBlank(wxCUserBasicInfo.getPhone())
&& wxCUserBasicInfo.getEndTime() == null && wxCUserBasicInfo.getStartTime() == null
&& StringUtils.isBlank(wxCUserBasicInfo.getName())
) {//当只有手机号查询并且查不到数据 ,新增
WxCUser cUser = new WxCUser();
cUser.setTenantId(tenantId);
cUser.setPhone(wxCUserBasicInfo.getPhone());
PageInfo<WxCUser> cUsers = wxCUserService.listAsPage(cUser, 1, 1);
if (cUsers.getSize() > 0) {
createUserBasicInfo(cUsers.getList().get(0));
page = wxCUserBasicInfoService.list(wxCUserBasicInfo, pageNum, pageSize);
}
}
return new ResultData(page);
}
private void createUserBasicInfo(WxCUser wxCUser) {
WxCUserBasicInfo wxCUserBasicInfo =new WxCUserBasicInfo();
wxCUserBasicInfo.setCUserId(wxCUser.getId());
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setTenantId(wxCUser.getTenantId());
wxCUserBasicInfo.setNickName(wxCUser.getNickName());
wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo);
}
private void createUserBasicInfo(WxCUser wxCUser) {
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setId(wxCUser.getId());
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setTenantId(wxCUser.getTenantId());
wxCUserBasicInfo.setNickName(wxCUser.getNickName());
wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo);
}

// @ApiOperation("新增接口")
// @PostMapping("add")
@@ -116,89 +93,98 @@ public class WxCUserBasicInfoController extends BaseController
@ApiOperation("根据id更新接口")
@PostMapping("update")
public ResultData update(@RequestBody WxCUserBasicInfo wxCUserBasicInfo) {
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId());
wxCUserBasicInfo.setTenantId(getTenantId());
if(StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) {
WxCUserTags record =new WxCUserTags();
record.setUserId(info.getCUserId());
record.setTenantId(getTenantId());
PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1);
if(page.getSize()>0) {
WxCUserTags t = page.getList().get(0);
record.setId(t.getId());
}
String tags = wxCUserBasicInfo.getTagIds();
List<Long> tagIdList = new ArrayList<>();
for(String t:tags.split(",")) {
tagIdList.add(Long.valueOf(t));
}
record.setTags(JSON.toJSONString(tagIdList));
wxCUserTagsService.saveOrUpdate(record);
wxCUserBasicInfo.setTagId(record.getId());
}
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(wxCUserBasicInfo.getId());
wxCUserBasicInfo.setTenantId(getTenantId());
if (StringUtils.isNotBlank(wxCUserBasicInfo.getTagIds())) {
WxCUserTags record = new WxCUserTags();
record.setUserId(info.getId());
record.setTenantId(getTenantId());
PageInfo<WxCUserTags> page = wxCUserTagsService.listAsPage(record, 1, 1);
if (page.getSize() > 0) {
WxCUserTags t = page.getList().get(0);
record.setId(t.getId());
}
String tags = wxCUserBasicInfo.getTagIds();
List<Long> tagIdList = new ArrayList<>();
for (String t : tags.split(",")) {
tagIdList.add(Long.valueOf(t));
}
record.setTags(JSON.toJSONString(tagIdList));
wxCUserTagsService.saveOrUpdate(record);
wxCUserBasicInfo.setTagId(record.getId());
}
wxCUserBasicInfoService.saveOrUpdate(wxCUserBasicInfo);
return new ResultData();
}

@ApiOperation("根据id删除接口")
@GetMapping("/del")
@ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData delete(Long id) {
wxCUserBasicInfoService.deleteById(id);
return new ResultData(Result.SUCCESS, "删除成功", null);
}
@ApiOperation("根据id查询接口")
@GetMapping("/findById")
@ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
@ApiOperation("根据id查询接口")
@GetMapping("/findById")
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData findById(Long id) {
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id);
if(info.getTagId()!=null) {
WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId());
if(StringUtils.isNotBlank(uTag.getTags())) {
List<Long> ids = JSONObject.parseArray(uTag.getTags(),Long.class);
WxTags wxTags =new WxTags();
wxTags.setIds(ids);
PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000);
String tagNames="";
String tagIds="";
List<Long> tagIdList = new ArrayList<>();
for(WxTags wt:page.getList()) {
tagNames+=wt.getName()+"/";
tagIds+=wt.getId()+",";
tagIdList.add(wt.getId());
}
if(StringUtils.isNotBlank(tagNames)) {
info.setTagNames(tagNames.substring(0,tagNames.length()-1));
}
if(StringUtils.isNoneBlank(tagIds)) {
info.setTagIds(tagIds.substring(0,tagIds.length()-1));
}
long count = wxCUserTagsService.findCountByTag(tagIdList);
info.setCount(count);
}
}
return new ResultData(Result.SUCCESS,"查询成功",info);
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(id);
if (info != null && info.getTagId() != null) {
WxCUserTags uTag = wxCUserTagsService.getById(info.getTagId());
if (StringUtils.isNotBlank(uTag.getTags())) {
List<Long> ids = JSONObject.parseArray(uTag.getTags(), Long.class);
WxTags wxTags = new WxTags();
wxTags.setIds(ids);
PageInfo<WxTags> page = wxTagsService.listAsPage(wxTags, 1, 5000);
String tagNames = "";
String tagIds = "";
List<Long> tagIdList = new ArrayList<>();
for (WxTags wt : page.getList()) {
tagNames += wt.getName() + "/";
tagIds += wt.getId() + ",";
tagIdList.add(wt.getId());
}
if (StringUtils.isNotBlank(tagNames)) {
info.setTagNames(tagNames.substring(0, tagNames.length() - 1));
}
if (StringUtils.isNoneBlank(tagIds)) {
info.setTagIds(tagIds.substring(0, tagIds.length() - 1));
}
long count = wxCUserTagsService.findCountByTag(tagIdList);
info.setCount(count);
}
} else {
info = new WxCUserBasicInfo();
info.setId(id);
WxCUser user = wxCUserService.getById(id);
if (user != null) {
info.setTenantId(user.getTenantId());
info.setPhone(user.getPhone());
info.setSex(user.getGender());
}
}
return new ResultData(Result.SUCCESS, "查询成功", info);
}

@ApiOperation("根据userId查询交易记录接口")
@GetMapping("/findOrderCouponByUserId")
@ApiImplicitParam(name = "userId", value = "userId", dataType = "Long", paramType = "query", required = true)
public ResultData findOrderCouponByUserId(Long userId, Integer pageNum, Integer pageSize) {
WxCouponOrder corder = new WxCouponOrder();
corder.setCUserId(userId);
corder.setTenantId(getTenantId());
PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize);
if (page.getSize() > 0) {
List<WxCouponOrder> list = page.getList();
for (WxCouponOrder c : list) {
WxCoupon coupon = wxCouponService.getById(c.getCouponId());
c.setCouponName(coupon.getTitle());
c.setSalePrice(coupon.getPrice());
}
}
return new ResultData(Result.SUCCESS, "查询成功", page);
}
@ApiOperation("根据userId查询交易记录接口")
@GetMapping("/findOrderCouponByUserId")
@ApiImplicitParam(name="userId",value="userId",dataType="Long", paramType = "query",required=true)
public ResultData findOrderCouponByUserId(Long userId,Integer pageNum, Integer pageSize) {
WxCouponOrder corder = new WxCouponOrder();
corder.setCUserId(userId);
corder.setTenantId(getTenantId());
PageInfo<WxCouponOrder> page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize);
if(page.getSize()>0) {
List<WxCouponOrder> list = page.getList();
for(WxCouponOrder c:list) {
WxCoupon coupon = wxCouponService.getById(c.getCouponId());
c.setCouponName(coupon.getTitle());
c.setSalePrice(coupon.getPrice());
}
}
return new ResultData(Result.SUCCESS,"查询成功",page);
}


}

+ 2
- 2
mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java Просмотреть файл

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.simple.common.ResultData;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.vo.CUserDateAmountVo;
import com.simple.domain.vo.TouchUsersReportVo;
import com.simple.domain.vo.UserStructureVo;
@@ -42,7 +42,7 @@ public class WxCUserDataController extends BaseController{
@GetMapping("findUserCountData")
@ApiOperation("查询用户数量接口")
public ResultData findUserCountData() {
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
long allCount = wxCUserService.findCount(dto);//总数
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY, 0);


+ 8
- 16
mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java Просмотреть файл

@@ -1,5 +1,5 @@
package com.simple.controller;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -11,21 +11,13 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.simple.common.ResultData;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUser;
import com.simple.domain.po.WxUserChannel;
import com.simple.domain.vo.UserStructureVo;
@@ -57,7 +49,7 @@ public class WxUserStructureController extends BaseController{
public ResultData findUserSexStructure(
Date startTime,Date endTime
) {
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setTenantId(getTenantId());
dto.setStartTime(startTime);
if(endTime!=null) {
@@ -84,7 +76,7 @@ public class WxUserStructureController extends BaseController{
@ApiOperation("查询会员年龄结构")
@GetMapping("/findUserAgeStructure")
public ResultData findUserAgeStructure( Date startTime,Date endTime) {
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setTenantId(getTenantId());
dto.setStartTime(startTime);
if(endTime!=null) {
@@ -112,7 +104,7 @@ public class WxUserStructureController extends BaseController{
@ApiOperation("查询会员数量")
@GetMapping("/findUserDataCount")
public ResultData findUserCount(Date startTime,Date endTime) {
WxCuerBasicInfoDto dto = new WxCuerBasicInfoDto();
WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto();
dto.setTenantId(getTenantId());
dto.setStartTime(startTime);
if(endTime!=null) {
@@ -217,9 +209,9 @@ public class WxUserStructureController extends BaseController{
}
return new ResultData(vos);
}
private long getCountByAge(EnumAgeInfo a,Calendar c, WxCuerBasicInfoDto dto ) {
private long getCountByAge(EnumAgeInfo a,Calendar c, WxCUserBasicInfoDto dto ) {
c.add(Calendar.YEAR, -a.getEnd());
Date startTime = c.getTime();
c.clear();
@@ -235,7 +227,7 @@ public class WxUserStructureController extends BaseController{
//通过性别获取数量
private long getCount(WxCuerBasicInfoDto dto) {
private long getCount(WxCUserBasicInfoDto dto) {
// wxCUserBasicInfoService.findCountBySex(dto) basic表与cuser表示对应的,先有cuser 才有basic
//所有这里不需要再去查basic
return wxCUserService.findCount(dto);


mallinkService/src/main/java/com/simple/domain/dto/WxCuerBasicInfoDto.java → mallinkService/src/main/java/com/simple/domain/dto/WxCUserBasicInfoDto.java Просмотреть файл

@@ -1,109 +1,121 @@
package com.simple.domain.dto;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Transient;
/**
* 用户查询dto
* @author jinguo
*
*/
public class WxCuerBasicInfoDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = -1116465873573690766L;
@io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime")
private Date startTime;
@io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime")
private Date endTime;
@io.swagger.annotations.ApiModelProperty(value="手机号",name="phone")
private String phone;
@io.swagger.annotations.ApiModelProperty(value="姓名",name="name")
private String name;
/*租户id**/
// @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId")
@Transient
private String tenantId;
@Transient
private Date birthStartTime;
@Transient
private Date birthEndTime;
@Transient
private Integer sex;
public Date getBirthStartTime() {
return birthStartTime;
}
public void setBirthStartTime(Date birthStartTime) {
this.birthStartTime = birthStartTime;
}
public Date getBirthEndTime() {
return birthEndTime;
}
public void setBirthEndTime(Date birthEndTime) {
this.birthEndTime = birthEndTime;
}
public Integer getSex() {
return sex;
}
public void setSex(Integer sex) {
this.sex = sex;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTenantId() {
return tenantId;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
package com.simple.domain.dto;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Id;
import javax.persistence.Transient;
/**
* 用户查询dto
* @author jinguo
*
*/
public class WxCUserBasicInfoDto implements Serializable{

/**
*
*/
private static final long serialVersionUID = -1116465873573690766L;

@Id
protected Long id;
@io.swagger.annotations.ApiModelProperty(value="开始时间",name="startTime")
private Date startTime;
@io.swagger.annotations.ApiModelProperty(value="结束时间",name="endTime")
private Date endTime;
@io.swagger.annotations.ApiModelProperty(value="手机号",name="phone")
private String phone;
@io.swagger.annotations.ApiModelProperty(value="姓名",name="name")
private String name;
/*租户id**/
// @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId")
@Transient
private String tenantId;
@Transient
private Date birthStartTime;
@Transient
private Date birthEndTime;

@Transient
private Integer sex;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
public Date getBirthStartTime() {
return birthStartTime;
}

public void setBirthStartTime(Date birthStartTime) {
this.birthStartTime = birthStartTime;
}

public Date getBirthEndTime() {
return birthEndTime;
}

public void setBirthEndTime(Date birthEndTime) {
this.birthEndTime = birthEndTime;
}

public Integer getSex() {
return sex;
}

public void setSex(Integer sex) {
this.sex = sex;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getTenantId() {
return tenantId;
}

public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}

public Date getStartTime() {
return startTime;
}

public void setStartTime(Date startTime) {
this.startTime = startTime;
}

public Date getEndTime() {
return endTime;
}

public void setEndTime(Date endTime) {
this.endTime = endTime;
}

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

}

+ 1
- 11
mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java Просмотреть файл

@@ -66,9 +66,6 @@ public class WxCUserBasicInfo implements Serializable {
/*标签**/
@io.swagger.annotations.ApiModelProperty(value="标签",name="tagId")
private Long tagId;
/*wx_c_user 的id**/
@io.swagger.annotations.ApiModelProperty(value="wx_c_user 的id",name="cUserId")
private Long cUserId;
/*创建时间**/
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@@ -186,12 +183,6 @@ public class WxCUserBasicInfo implements Serializable {
public void setTagId(Long _tagId) {
tagId = _tagId;
}
public Long getCUserId() {
return cUserId;
}
public void setCUserId(Long _cUserId) {
cUserId = _cUserId;
}
public Date getCreateDate() {
return createDate;
}
@@ -230,8 +221,7 @@ public class WxCUserBasicInfo implements Serializable {
,Email_ASC("`email` ASC"),Email_DESC("`email` DESC")
,Address_ASC("`address` ASC"),Address_DESC("`address` DESC")
,Poins_ASC("`poins` ASC"),Poins_DESC("`poins` DESC")
,TagId_ASC("`tagId` ASC"),TagId_DESC("`tagId` DESC")
,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC")
,TagId_ASC("`tag_id` ASC"),TagId_DESC("`tag_id` DESC")
,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")


+ 4
- 5
mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java Просмотреть файл

@@ -2,9 +2,8 @@ package com.simple.mapper;

import java.util.*;
import com.simple.common.CommonMapper;
import org.apache.ibatis.annotations.Param;

import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUserBasicInfo;

public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> {
@@ -13,11 +12,11 @@ public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, S

List<WxCUserBasicInfo> list(WxCuerBasicInfoDto record);
List<WxCUserBasicInfo> list(WxCUserBasicInfoDto record);

void updateScore(WxCUserBasicInfo record);
long findCountBySex(WxCuerBasicInfoDto dto);
long findCountBySex(WxCUserBasicInfoDto dto);
long findCountByAge(WxCuerBasicInfoDto dto);
long findCountByAge(WxCUserBasicInfoDto dto);
}

+ 2
- 2
mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java Просмотреть файл

@@ -5,7 +5,7 @@ import java.util.List;
import org.apache.ibatis.annotations.Param;

import com.simple.common.CommonMapper;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUser;

public interface WxCUserMapper extends CommonMapper<WxCUser, Long> {
@@ -17,7 +17,7 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> {

WxCUser findByToken(String token);
long findCount(WxCuerBasicInfoDto dto);
long findCount(WxCUserBasicInfoDto dto);

List<WxCUser> listByChannel(@Param("sceneList")List<String> sceneList);


+ 4
- 4
mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java Просмотреть файл

@@ -1,7 +1,7 @@
package com.simple.service;

import com.github.pagehelper.PageInfo;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUserBasicInfo;

public interface WxCUserBasicInfoService {
@@ -40,7 +40,7 @@ public interface WxCUserBasicInfoService {
PageInfo<WxCUserBasicInfo> list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize);
PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize);

/**
* 修改会员积分
@@ -53,14 +53,14 @@ public interface WxCUserBasicInfoService {
* @param sex
* @return
*/
long findCountBySex(WxCuerBasicInfoDto dto);
long findCountBySex(WxCUserBasicInfoDto dto);

/**
* 根据年龄查询数量
* @param dto
* @return
*/
long findCountByAge(WxCuerBasicInfoDto dto);
long findCountByAge(WxCUserBasicInfoDto dto);


+ 2
- 2
mallinkService/src/main/java/com/simple/service/WxCUserService.java Просмотреть файл

@@ -3,7 +3,7 @@ package com.simple.service;
import java.util.List;

import com.github.pagehelper.PageInfo;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUser;

public interface WxCUserService {
@@ -61,7 +61,7 @@ public interface WxCUserService {
* @param dto
* @return
*/
long findCount(WxCuerBasicInfoDto dto);
long findCount(WxCUserBasicInfoDto dto);

/**


+ 4
- 4
mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java Просмотреть файл

@@ -6,7 +6,7 @@ import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.simple.common.IdWorker;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUserBasicInfo;
import com.simple.mapper.WxCUserBasicInfoMapper;
import com.simple.service.WxCUserBasicInfoService;
@@ -26,7 +26,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {

@Override
public PageInfo<WxCUserBasicInfo> list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize) {
public PageInfo<WxCUserBasicInfo> list(WxCUserBasicInfoDto record, Integer pageIndex, Integer pageSize) {
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCUserBasicInfoMapper.list(record));
}

@@ -63,7 +63,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {


@Override
public long findCountBySex(WxCuerBasicInfoDto dto) {
public long findCountBySex(WxCUserBasicInfoDto dto) {
return wxCUserBasicInfoMapper.findCountBySex(dto);
}
@@ -71,7 +71,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {


@Override
public long findCountByAge(WxCuerBasicInfoDto dto) {
public long findCountByAge(WxCUserBasicInfoDto dto) {
return wxCUserBasicInfoMapper.findCountByAge(dto);
}


+ 2
- 2
mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java Просмотреть файл

@@ -3,7 +3,7 @@ package com.simple.service.impl;
import java.util.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.simple.domain.dto.WxCuerBasicInfoDto;
import com.simple.domain.dto.WxCUserBasicInfoDto;
import com.simple.domain.po.WxCUser;
import com.simple.mapper.WxCUserMapper;
import com.simple.service.WxCUserService;
@@ -63,7 +63,7 @@ public class WxCUserServiceImpl implements WxCUserService {
}

@Override
public long findCount(WxCuerBasicInfoDto dto) {
public long findCount(WxCUserBasicInfoDto dto) {
return wxCUserMapper.findCount(dto);
}



+ 2
- 2
mallinkService/src/main/java/com/simple/service/impl/WxScoreRulesServiceImpl.java Просмотреть файл

@@ -72,10 +72,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
if (wxCUser.getPhone() != null) {
//修改basic表积分
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setId(wxCUser.getId());
wxCUserBasicInfo.setTenantId(tenantId);
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setPoins(wxCUser.getScore());
wxCUserBasicInfo.setCUserId(wxCUser.getId());
wxCUserBasicInfoService.updateScore(wxCUserBasicInfo);
}
return addScoreNumber;
@@ -106,10 +106,10 @@ public class WxScoreRulesServiceImpl implements WxScoreRulesService {
if (wxCUser.getPhone() != null) {
//修改basic表积分
WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo();
wxCUserBasicInfo.setId(wxCUser.getId());
wxCUserBasicInfo.setTenantId(tenantId);
wxCUserBasicInfo.setPhone(wxCUser.getPhone());
wxCUserBasicInfo.setPoins(wxCUser.getScore());
wxCUserBasicInfo.setCUserId(wxCUser.getId());
wxCUserBasicInfoService.updateScore(wxCUserBasicInfo);
}
return addScoreNumber;


+ 155
- 159
mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml Просмотреть файл

@@ -1,172 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.simple.mapper.WxCUserBasicInfoMapper">
<resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserBasicInfo">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate" />
<result column="education" jdbcType="VARCHAR" property="education" />
<result column="sex" jdbcType="INTEGER" property="sex" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="poins" jdbcType="INTEGER" property="poins" />
<result column="tag_id" jdbcType="BIGINT" property="tagId" />
<result column="c_user_id" jdbcType="BIGINT" property="cUserId" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="level" jdbcType="VARCHAR" property="level" />
<result column="nick_name" jdbcType="VARCHAR" property="nickName" />
</resultMap>
<sql id="allColumns">
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`c_user_id`,
<resultMap id="BaseResultMap" type="com.simple.domain.po.WxCUserBasicInfo">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="phone" jdbcType="VARCHAR" property="phone"/>
<result column="birthdate" jdbcType="TIMESTAMP" property="birthdate"/>
<result column="education" jdbcType="VARCHAR" property="education"/>
<result column="sex" jdbcType="INTEGER" property="sex"/>
<result column="email" jdbcType="VARCHAR" property="email"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="poins" jdbcType="INTEGER" property="poins"/>
<result column="tag_id" jdbcType="BIGINT" property="tagId"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="nick_name" jdbcType="VARCHAR" property="nickName"/>
</resultMap>

<sql id="allColumns">
`id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,
`create_date`,`update_date`,`tenant_id`,`name`,level,nick_name
</sql>

<sql id="dynamicWhereConditions">
where 1 = 1
<if test=" null != id ">
and `id` = #{id}
</if>
<if test=" null != phone ">
and `phone` like concat('%', #{phone},'%')
</if>
<if test=" null != birthdate ">
and `birthdate` = #{birthdate}
</if>
<if test=" null != education ">
and `education` like concat('%', #{education},'%')
</if>
<if test=" null != sex ">
and `sex` = #{sex}
</if>
<if test=" null != email ">
and `email` like concat('%', #{email},'%')
</if>
<if test=" null != address ">
and `address` like concat('%', #{address},'%')
</if>
<if test=" null != poins ">
and `poins` = #{poins}
</if>
<if test=" null != tagId ">
and `tag_id` = #{tagId}
</if>
<if test=" null != cUserId ">
and `c_user_id` = #{cUserId}
</if>
<if test=" null != createDate ">
and `create_date` = #{createDate}
</if>
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != tenantId ">
and `tenant_id` like concat('%', #{tenantId},'%')
</if>
<if test=" null != name ">
and `name` like concat('%', #{name},'%')
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<sql id="dynamicWhereConditions">
where 1 = 1

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != phone ">
and `phone` like concat('%', #{phone},'%')
</if>

<if test=" null != birthdate ">
and `birthdate` = #{birthdate}
</if>

<if test=" null != education ">
and `education` like concat('%', #{education},'%')
</if>

<if test=" null != sex ">
and `sex` = #{sex}
</if>

<if test=" null != email ">
and `email` like concat('%', #{email},'%')
</if>

<if test=" null != address ">
and `address` like concat('%', #{address},'%')
</if>

<if test=" null != poins ">
and `poins` = #{poins}
</if>

<if test=" null != tagId ">
and `tag_id` = #{tagId}
</if>

<if test=" null != cUserId ">
and `c_user_id` = #{cUserId}
</if>

<if test=" null != createDate ">
and c.`create_date` = #{createDate}
</if>

<if test=" null != updateDate ">
and c.`update_date` = #{updateDate}
</if>

<if test=" null != tenantId ">
and c.`tenant_id` like concat('%', #{tenantId},'%')
</if>

<if test=" null != name ">
and c.`name` like concat('%', #{name},'%')
</if>
<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="findList" parameterType="com.simple.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_c_user_basic_info
<include refid="dynamicWhereConditions"/>
</select>

<sql id="allUserColumns">
c.`id`,c.`phone`,cb.`birthdate`,cb.`education`,cb.`sex`,cb.`email`,cb.`address`,cb.`poins`,cb.`tag_id`,
cb.`create_date`,cb.`update_date`,c.`tenant_id`,cb.`name`,cb.level,cb.nick_name
</sql>
<select id="findList" parameterType="com.simple.domain.po.WxCUserBasicInfo" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_c_user_basic_info
<include refid="dynamicWhereConditions" />
</select>
<select id="list" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_c_user_basic_info where 1=1
<if test=" null != tenantId ">
and `tenant_id` = #{tenantId}
</if>
<if test=" null != phone and phone !='' ">
and `phone` = #{phone}
</if>
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
<if test=" null != name and name != '' ">
and `name` like concat('%', #{name},'%')
</if>
</select>
<update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo">


<select id="list" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap">
select
<include refid="allUserColumns"/>
from wx_c_user c
left join wx_c_user_basic_info cb on cb.id = c.id and cb.tenant_id = c.tenant_id
where 1=1
<if test=" null != tenantId ">
and c.`tenant_id` = #{tenantId}
</if>
<if test=" null != phone and phone !='' ">
and c.`phone` = #{phone}
</if>
<if test=" null == phone or phone =='' ">
and c.`phone` is not null
</if>
<if test=" null != startTime ">
and cb.create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and cb.update_date &lt;= #{endTime}
</if>
<if test=" null != name and name != '' ">
and cb.`name` like concat('%', #{name},'%')
</if>
</select>
<update id="updateScore" parameterType="com.simple.domain.po.WxCUserBasicInfo">
update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId}
and c_user_id=#{cUserId}

</update>

<select id="findCountBySex" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where sex =#{sex}
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
</select>
<select id="findCountByAge" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where birthdate is not NULL
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
<if test=" null != birthStartTime ">
and birthdate &gt;= #{birthStartTime}
</if>
<if test=" null != birthEndTime">
and birthdate &lt;= #{birthEndTime}
</if>
</select>
<select id="findCountBySex" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where sex =#{sex}
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
</select>
<select id="findCountByAge" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user_basic_info where birthdate is not NULL
<if test=" null != startTime ">
and create_date &gt;= #{startTime}
</if>
<if test=" null != endTime">
and create_date &lt;= #{endTime}
</if>
<if test=" null != birthStartTime ">
and birthdate &gt;= #{birthStartTime}
</if>
<if test=" null != birthEndTime">
and birthdate &lt;= #{birthEndTime}
</if>
</select>
</mapper>

+ 1
- 1
mallinkService/src/main/resources/mapper/WxCUserMapper.xml Просмотреть файл

@@ -184,7 +184,7 @@
where `token` = #{token}
</select>
<select id="findCount" parameterType="com.simple.domain.dto.WxCuerBasicInfoDto" resultType="java.lang.Long">
<select id="findCount" parameterType="com.simple.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long">
select count(id) from wx_c_user where 1=1
<if test=" null != sex ">
and gender =#{sex}


Загрузка…
Отмена
Сохранить