diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java index b281d108f..867d7f84d 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserBasicInfoController.java +++ b/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 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 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 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 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 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 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 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 ids = JSONObject.parseArray(uTag.getTags(),Long.class); - WxTags wxTags =new WxTags(); - wxTags.setIds(ids); - PageInfo page = wxTagsService.listAsPage(wxTags, 1, 5000); - String tagNames=""; - String tagIds=""; - List 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 ids = JSONObject.parseArray(uTag.getTags(), Long.class); + WxTags wxTags = new WxTags(); + wxTags.setIds(ids); + PageInfo page = wxTagsService.listAsPage(wxTags, 1, 5000); + String tagNames = ""; + String tagIds = ""; + List 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 page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize); + if (page.getSize() > 0) { + List 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 page = wxCouponOrderService.listAsPage(corder, pageNum, pageSize); - if(page.getSize()>0) { - List 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); - } - - + + } diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java index 6f9304468..e8953e854 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCUserDataController.java +++ b/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); diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java index 007fcf1dc..9dfbd9411 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxUserStructureController.java +++ b/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); diff --git a/mallinkService/src/main/java/com/simple/domain/dto/WxCuerBasicInfoDto.java b/mallinkService/src/main/java/com/simple/domain/dto/WxCUserBasicInfoDto.java similarity index 90% rename from mallinkService/src/main/java/com/simple/domain/dto/WxCuerBasicInfoDto.java rename to mallinkService/src/main/java/com/simple/domain/dto/WxCUserBasicInfoDto.java index 3507f64a8..e83f7ae2b 100644 --- a/mallinkService/src/main/java/com/simple/domain/dto/WxCuerBasicInfoDto.java +++ b/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; + } + + +} diff --git a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java b/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java index a3b4d59fa..c65e1ec8b 100644 --- a/mallinkService/src/main/java/com/simple/domain/po/WxCUserBasicInfo.java +++ b/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") diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java index cb1d469e7..7bba1edc7 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserBasicInfoMapper.java +++ b/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 { @@ -13,11 +12,11 @@ public interface WxCUserBasicInfoMapper extends CommonMapper list(WxCuerBasicInfoDto record); + List list(WxCUserBasicInfoDto record); void updateScore(WxCUserBasicInfo record); - long findCountBySex(WxCuerBasicInfoDto dto); + long findCountBySex(WxCUserBasicInfoDto dto); - long findCountByAge(WxCuerBasicInfoDto dto); + long findCountByAge(WxCUserBasicInfoDto dto); } diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java index d2ed63697..0a58c49c5 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCUserMapper.java +++ b/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 { @@ -17,7 +17,7 @@ public interface WxCUserMapper extends CommonMapper { WxCUser findByToken(String token); - long findCount(WxCuerBasicInfoDto dto); + long findCount(WxCUserBasicInfoDto dto); List listByChannel(@Param("sceneList")List sceneList); diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java b/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java index defbbed69..10c279b89 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserBasicInfoService.java +++ b/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 list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize); + PageInfo 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); diff --git a/mallinkService/src/main/java/com/simple/service/WxCUserService.java b/mallinkService/src/main/java/com/simple/service/WxCUserService.java index 61ef2f35d..4a811283c 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCUserService.java +++ b/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); /** diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java index 6dac1344d..19aee7de4 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/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 list(WxCuerBasicInfoDto record, Integer pageIndex, Integer pageSize) { + public PageInfo 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); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java index e083d8242..70f37bc97 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCUserServiceImpl.java +++ b/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); } diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxScoreRulesServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxScoreRulesServiceImpl.java index 1549e447b..6a56653c9 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxScoreRulesServiceImpl.java +++ b/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; diff --git a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml index 2ecd237ac..ba1b218cb 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserBasicInfoMapper.xml @@ -1,172 +1,168 @@ - - - - - - - - - - - - - - - - - - - - - `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`,`c_user_id`, + + + + + + + + + + + + + + + + + + + + `id`,`phone`,`birthdate`,`education`,`sex`,`email`,`address`,`poins`,`tag_id`, `create_date`,`update_date`,`tenant_id`,`name`,level,nick_name - - where 1 = 1 - - - and `id` = #{id} - - - - - and `phone` like concat('%', #{phone},'%') - - - - - and `birthdate` = #{birthdate} - - - - - and `education` like concat('%', #{education},'%') - - - - - and `sex` = #{sex} - - - - - and `email` like concat('%', #{email},'%') - - - - - and `address` like concat('%', #{address},'%') - - - - - and `poins` = #{poins} - - - - - and `tag_id` = #{tagId} - - - - - and `c_user_id` = #{cUserId} - - - - - and `create_date` = #{createDate} - - - - - and `update_date` = #{updateDate} - - - - - and `tenant_id` like concat('%', #{tenantId},'%') - - - - - - and `name` like concat('%', #{name},'%') - - - - and id in - - #{idItem} - - - order by ${sortColumns} + + where 1 = 1 + + + and `id` = #{id} + + + + and `phone` like concat('%', #{phone},'%') + + + + and `birthdate` = #{birthdate} + + + + and `education` like concat('%', #{education},'%') + + + + and `sex` = #{sex} + + + + and `email` like concat('%', #{email},'%') + + + + and `address` like concat('%', #{address},'%') + + + + and `poins` = #{poins} + + + + and `tag_id` = #{tagId} + + + + and `c_user_id` = #{cUserId} + + + + and c.`create_date` = #{createDate} + + + + and c.`update_date` = #{updateDate} + + + + and c.`tenant_id` like concat('%', #{tenantId},'%') + + + + and c.`name` like concat('%', #{name},'%') + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + + + 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 - - - - - - + + + + update wx_c_user_basic_info set poins=#{poins} where phone=#{phone} and tenant_id=#{tenantId} and c_user_id=#{cUserId} - - - - - + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml index 13531a2fd..6980fb8a8 100644 --- a/mallinkService/src/main/resources/mapper/WxCUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCUserMapper.xml @@ -184,7 +184,7 @@ where `token` = #{token} - select count(id) from wx_c_user where 1=1 and gender =#{sex}