diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml index 9bca16f..53905ee 100644 --- a/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml +++ b/cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml @@ -229,7 +229,7 @@ GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id LEFT JOIN cere_buyer_label c ON a.buyer_user_id=c.buyer_user_id LEFT JOIN cere_platform_member_level d ON a.member_level_id=d.member_level_id - where 1=1 + where a.project = 0 and (a.wechat_name like concat('%',#{name},'%') or a.`name` like concat('%',#{name},'%')) diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/BusinessBuyerUserController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/BusinessBuyerUserController.java new file mode 100644 index 0000000..5531b70 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/BusinessBuyerUserController.java @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.controller; + + +import com.shop.cereshop.business.annotation.NoRepeatSubmit; +import com.shop.cereshop.business.annotation.NoRepeatWebLog; +import com.shop.cereshop.business.page.buyer.*; +import com.shop.cereshop.business.param.buyer.*; +import com.shop.cereshop.business.service.buyer.CereBusinessBuyerUserService; +import com.shop.cereshop.business.service.buyer.CereBuyerUserService; +import com.shop.cereshop.business.service.channel.ChannelService; +import com.shop.cereshop.commons.constant.IntegerEnum; +import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.channel.Channel; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.label.CerePlatformLabel; +import com.shop.cereshop.commons.domain.user.CerePlatformUser; +import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.poi.export.ExcelExportUtils; +import com.shop.cereshop.commons.result.Result; +import com.shop.cereshop.commons.utils.GsonUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.BeanUtils; +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 javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 客户管理 + */ +@RestController +@RequestMapping("businessBuyer") +/** + * 注解方式生成日志对象,指定topic生成对象类名 + */ +@Slf4j(topic = "BuyerUserController") +@Api(value = "客户管理模块", tags = "客户管理模块") +public class BusinessBuyerUserController { + + @Autowired + private CereBusinessBuyerUserService cereBuyerUserService; + + @Autowired + private ChannelService channelService; + + /** + * 客户管理查询 + * @param param + * @return + */ + @PostMapping(value = "getAll") + @ApiOperation(value = "客户管理查询") + public Result> getAll(@RequestBody BusinessBuyerGetAllParam param, HttpServletRequest request) throws CoBusinessException{ + //获取当前登录账户 + CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); + param.setProject(String.valueOf(user.getBusinessId())); + Page page=cereBuyerUserService.getAll(param); + return new Result(page); + } + + /** + * 客户详情查询 + * @param param + * @return + */ + @PostMapping(value = "getById") + @ApiOperation(value = "客户详情查询") + public Result getById(@RequestBody BusinessBuyerGetByIdParam param) throws CoBusinessException{ + BusinessBuyerUserDetail detail=cereBuyerUserService.getById(param); + return new Result(detail); + } + + /** + * 客户绑定标签查询 + * @param param + * @return + */ + @PostMapping(value = "getUserLabels") + @ApiOperation(value = "客户绑定标签查询") + public Result> getUserLabels(@RequestBody BusinessBuyerGetLabelsParam param) throws CoBusinessException{ + List list=cereBuyerUserService.getUserLabels(param); + return new Result(list); + } + + /** + * 标签查询 + * @param param + * @return + */ + @PostMapping(value = "getLabels") + @ApiOperation(value = "标签查询") + public Result> getLabels(@RequestBody BusinessBuyerGetLabelsParam param) throws CoBusinessException{ + List list=cereBuyerUserService.getLabels(param); + return new Result(list); + } + + /** + * 贴标签 + * @param param + * @return + */ + @PostMapping(value = "saveUserLabel") + @NoRepeatSubmit + @ApiOperation(value = "贴标签") + @NoRepeatWebLog + public Result saveUserLabel(@RequestBody BusinessBuyerSaveUserLabelParam param, + HttpServletRequest request) throws CoBusinessException{ + //获取当前登录账户 + CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); + cereBuyerUserService.saveUserLabel(param,user); + return new Result(user.getUsername(),"贴标签", GsonUtil.objectToGson(param)); + } + + /** + * 加入或取消黑名单 + * @param param + * @return + */ + @PostMapping(value = "blacklist") + @NoRepeatSubmit + @ApiOperation(value = "加入和取消黑名单") + @NoRepeatWebLog + public Result blacklist(@RequestBody BusinessBuyerBlackListParam param, + HttpServletRequest request) throws CoBusinessException{ + //获取当前登录账户 + CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); + cereBuyerUserService.blacklist(param,user); + return new Result(user.getUsername(),"加入或取消黑名单", GsonUtil.objectToGson(param)); + } + + /** + * 更新积分 + * @param param + * @return + */ + @PostMapping(value = "updateCredit") + @NoRepeatSubmit + @ApiOperation(value = "更新积分") + @NoRepeatWebLog + public Result updateCredit(@RequestBody BusinessUpdateCreditParam param, + HttpServletRequest request) throws CoBusinessException{ + //获取当前登录账户 + CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); + cereBuyerUserService.updateCredit(param,user); + return new Result(user.getUsername(),"更改积分", GsonUtil.objectToGson(param)); + } + + /** + * 搜索用户信息 + * @param param + * @return + */ + @PostMapping(value = "searchUser") + @NoRepeatSubmit + @ApiOperation(value = "搜索用户信息") + @NoRepeatWebLog + public Result> searchUser(@RequestBody BusinessUserSearchParam param) { + Page page = cereBuyerUserService.searchUser(param); + return new Result(page); + } + + @PostMapping(value = "export") + @ApiOperation(value = "用户列表导出") + public void export(@RequestBody BusinessBuyerGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException { + param.setPage(null); + param.setPageSize(null); + Page page = cereBuyerUserService.getAll(param); + List list = new ArrayList<>(); + List channelCodeList = page.getList().stream().filter(obj -> StringUtils.isNotBlank(obj.getChannelCode())) + .map(BusinessBuyerUser::getChannelCode).distinct().collect(Collectors.toList()); + Map channelNameMap = new HashMap<>(); + if (CollectionUtils.isNotEmpty(channelCodeList)) { + List channelList = channelService.selectByChannelCodeList(channelCodeList); + channelNameMap = channelList.stream().collect(Collectors.toMap(Channel::getChannelCode, Channel::getChannelName)); + } + for (BusinessBuyerUser buyerUser:page.getList()) { + BusinessBuyerUserExportDTO dto = new BusinessBuyerUserExportDTO(); + BeanUtils.copyProperties(buyerUser, dto); + IntegerEnum terminalEnum = IntegerEnum.terminalMap.get(buyerUser.getTerminal()); + if (terminalEnum != null) { + dto.setTerminal(terminalEnum.getName()); + } + String channelCode = buyerUser.getChannelCode(); + if (channelCode != null) { + dto.setChannelName(channelNameMap.get(channelCode)); + } + list.add(dto); + } + //定义导出的excel名字 + String excelName = "用户列表"; + ExcelExportUtils.exportExcel(request, response, excelName, list, BuyerUserExportDTO.class); + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/business/BusinessBuyerUserDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/business/BusinessBuyerUserDAO.java new file mode 100644 index 0000000..98daa5b --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/business/BusinessBuyerUserDAO.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.dao.business; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.business.page.buyer.*; +import com.shop.cereshop.business.param.buyer.BusinessBuyerGetAllParam; +import com.shop.cereshop.business.param.buyer.BusinessBuyerGetByIdParam; +import com.shop.cereshop.business.param.buyer.BusinessBuyerGetLabelsParam; +import com.shop.cereshop.commons.domain.buyer.CereBuyerReceive; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.label.CerePlatformLabel; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.math.BigDecimal; +import java.util.List; + +@Mapper +public interface BusinessBuyerUserDAO extends BaseMapper { + + int deleteByPrimaryKey(Long buyerUserId); + + int insertSelective(CereBuyerUser record); + + CereBuyerUser selectByPrimaryKey(Long buyerUserId); + + int updateByPrimaryKeySelective(CereBuyerUser record); + + int updateByPrimaryKey(CereBuyerUser record); + + List getAll(BusinessBuyerGetAllParam param); + + BusinessBuyerUserDetail getById(@Param("buyerUserId") Long buyerUserId); + + List findLabels(@Param("buyerUserId") Long buyerUserId); + + Integer findOrders(@Param("buyerUserId") Long buyerUserId); + + Integer findPays(@Param("buyerUserId") Long buyerUserId); + + Integer findProducts(@Param("buyerUserId") Long buyerUserId); + + BigDecimal findPrice(@Param("buyerUserId") Long buyerUserId); + + Integer findAfters(@Param("buyerUserId") Long buyerUserId); + + Integer findAfterOrders(@Param("buyerUserId") Long buyerUserId); + + Integer findSuccessAfters(@Param("buyerUserId") Long buyerUserId); + + List findOrderList(BusinessBuyerGetByIdParam param); + + List findComments(@Param("buyerUserId") Long buyerUserId); + + List findReceives(@Param("buyerUserId") Long buyerUserId); + + List getLabels(BusinessBuyerGetLabelsParam param); + + List getUserLabels(BusinessBuyerGetLabelsParam param); + + int increaseCredit(@Param("buyerUserId") long buyerUserId, @Param("credit") Integer credit); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/channel/ChannelDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/channel/ChannelDAO.java new file mode 100644 index 0000000..0916544 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/channel/ChannelDAO.java @@ -0,0 +1,15 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.dao.channel; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.commons.domain.channel.Channel; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ChannelDAO extends BaseMapper { + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditRecordDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditRecordDAO.java new file mode 100644 index 0000000..576aaa5 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditRecordDAO.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.dao.credit; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.business.page.credit.CereCreditRecordPage; +import com.shop.cereshop.business.param.credit.CreditRecordGetAllParam; +import com.shop.cereshop.commons.domain.credit.CereCreditRecord; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 积分流水表 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +@Mapper +public interface CereCreditRecordDAO extends BaseMapper { + + List getAll(CreditRecordGetAllParam param); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditSignSettingDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditSignSettingDAO.java new file mode 100644 index 0000000..8da63f2 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/credit/CereCreditSignSettingDAO.java @@ -0,0 +1,31 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.dao.credit; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.shop.cereshop.commons.domain.common.PageParam; +import com.shop.cereshop.commons.domain.credit.CereCreditSignSetting; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + *

+ * Mapper 接口 + * 积分签到配置 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +@Mapper +public interface CereCreditSignSettingDAO extends BaseMapper { + + List getAll(PageParam param); + + int selectExistsDay(@Param("day") Integer day, @Param("id") Long id); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CereBuyerLabelDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CereBuyerLabelDAO.java index a56c9a0..8fac119 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CereBuyerLabelDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CereBuyerLabelDAO.java @@ -5,12 +5,24 @@ */ package com.shop.cereshop.business.dao.label; +import com.shop.cereshop.business.param.buyer.BusinessBuyerSaveUserLabelParam; import com.shop.cereshop.commons.domain.label.CereBuyerLabel; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; @Mapper public interface CereBuyerLabelDAO extends BaseMapper { int insertSelective(CereBuyerLabel record); + + void deleteLabelUser(@Param("ids") List ids); + + void insertBatch(@Param("list") List list); + + List findAlreadyByUser(BusinessBuyerSaveUserLabelParam param); + + List findByBuyerUserId(Long buyerUserId); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java index 8d82259..4213232 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java @@ -118,4 +118,10 @@ public interface CereShopOrderDAO extends BaseMapper { List findByParentId(@Param("parentId") Long parentId); List findByFormid(@Param("orderFormId") String orderFormId); + + Integer selectChannelOrderUserCount(String channelCode); + + Integer selectChannelOrderCount(String channelCode); + + BigDecimal selectChannelOrderAmount(String channelCode); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerComment.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerComment.java new file mode 100644 index 0000000..7ba0bd2 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerComment.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 客户评论返回数据实体类 + */ +@Data +@ApiModel(value = "BuyerComment", description = "客户评论返回数据实体类") +public class BusinessBuyerComment { + + /** + * 评论id + */ + @ApiModelProperty(value = "评论id") + private Long commentId; + + /** + * 店铺名称 + */ + @ApiModelProperty(value = "店铺名称") + private String shopName; + + /** + * 商品名称 + */ + @ApiModelProperty(value = "商品名称") + private String productName; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerOrder.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerOrder.java new file mode 100644 index 0000000..2089a88 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerOrder.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 客户订单返回数据实体类 + */ +@Data +@ApiModel(value = "BuyerOrder", description = "客户订单返回数据实体类") +public class BusinessBuyerOrder { + + /** + * 订单编号 + */ + @ApiModelProperty(value = "订单编号") + private String orderFormid; + + /** + * 店铺名称 + */ + @ApiModelProperty(value = "店铺名称") + private String shopName; + + /** + * 商品数量 + */ + @ApiModelProperty(value = "商品数量") + private Integer products; + + /** + * 订单金额 + */ + @ApiModelProperty(value = "订单金额") + private BigDecimal price; + + /** + * 订单状态 1-待付款 2-待发货 3-待收货 4-已完成 5-已关闭 + */ + @ApiModelProperty(value = "订单状态 1-待付款 2-待发货 3-待收货 4-已完成 5-已关闭") + private Integer state; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUser.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUser.java new file mode 100644 index 0000000..0778062 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUser.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 商家会员返回数据实体类 + */ +@Data +@ApiModel(value = "BuyerUser", description = "客户返回数据实体类") +public class BusinessBuyerUser { + + /** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private Long buyerUserId; + + /** + * 用户昵称 + */ + @ApiModelProperty(value = "用户昵称") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phone; + + /** + * 会员等级名称 + */ + @ApiModelProperty(value = "会员等级名称") + private String memberLevelName; + + /** + * 积分 + */ + @ApiModelProperty("积分") + private Integer credit; + + /** + * 消费总额 + */ + @ApiModelProperty(value = "消费总额") + private BigDecimal total; + + /** + * 购买次数 + */ + @ApiModelProperty(value = "购买次数") + private Integer buyers; + + /** + * 最近消费时间 + */ + @ApiModelProperty(value = "最近消费时间") + private String time; + + /** + * 注册时间 + */ + @ApiModelProperty(value = "注册时间") + private String createTime; + + /** + * 是否加入黑名单 1-是 0-否 + */ + @ApiModelProperty(value = "是否加入黑名单 1-是 0-否") + private Integer ifBlack; + + @ApiModelProperty("标签id列表") + private List labelIds; + + /** + * 注册ip + */ + @ApiModelProperty(value = "注册ip") + private String registerIp; + + /** + * 上次登录的ip + */ + @ApiModelProperty(value = "上次登录的ip") + private String lastLoginIp; + + /** + * 注册来源 + */ + @ApiModelProperty(value = "注册来源") + private Integer terminal; + + /** + * 注册渠道 + */ + @ApiModelProperty(value = "注册渠道") + private String channelCode; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserDetail.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserDetail.java new file mode 100644 index 0000000..d95a03d --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserDetail.java @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.page.buyer; + +import com.shop.cereshop.commons.domain.buyer.CereBuyerReceive; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 客户详情返回数据实体类 + */ +@Data +@ApiModel(value = "BuyerUserDetail", description = "客户详情返回数据实体类") +public class BusinessBuyerUserDetail { + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + private Long buyerUserId; + + /** + * 用户昵称 + */ + @ApiModelProperty(value = "用户昵称") + private String name; + + /** + * 头像 + */ + @ApiModelProperty(value = "头像") + private String headImage; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phone; + + /** + * 性别 + */ + @ApiModelProperty(value = "性别") + private String sex; + + /** + * 生日 + */ + @ApiModelProperty(value = "生日") + private String birthday; + + /** + * 注册时间 + */ + @ApiModelProperty(value = "注册时间") + private String createTime; + + @ApiModelProperty("标签id列表") + private List labelIds; + + /** + * 标签数据 + */ + @ApiModelProperty(value = "标签数据") + private List labels; + + /** + * 下单数 + */ + @ApiModelProperty(value = "下单数") + private Integer orders; + + /** + * 支付成功数 + */ + @ApiModelProperty(value = "支付成功数") + private Integer pays; + + /** + * 购买商品数 + */ + @ApiModelProperty(value = "购买商品数") + private Integer products; + + /** + * 累计消费额 + */ + @ApiModelProperty(value = "累计消费额") + private BigDecimal price; + + /** + * 售后次数 + */ + @ApiModelProperty(value = "售后次数") + private Integer afters; + + /** + * 售后单数 + */ + @ApiModelProperty(value = "售后单数") + private Integer afterOrders; + + /** + * 售后成功单数 + */ + @ApiModelProperty(value = "售后成功单数") + private Integer successAfters; + + /** + * 订单列表 + */ + @ApiModelProperty(value = "订单列表") + private List orderList; + + /** + * 评论列表 + */ + @ApiModelProperty(value = "评论列表") + private List comments; + + /** + * 收货地址列表 + */ + @ApiModelProperty(value = "收货地址列表") + private List receives; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserExportDTO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserExportDTO.java new file mode 100644 index 0000000..181bc00 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/buyer/BusinessBuyerUserExportDTO.java @@ -0,0 +1,96 @@ +package com.shop.cereshop.business.page.buyer; + +import com.shop.cereshop.commons.poi.export.ExcelResources; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class BusinessBuyerUserExportDTO { + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + @ExcelResources(order=0,title = "客户id",cloumn = 15) + private Long buyerUserId; + + /** + * 客户昵称 + */ + @ApiModelProperty(value = "客户昵称") + @ExcelResources(order=1,title = "客户昵称",cloumn = 15) + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + @ExcelResources(order=2,title = "手机号",cloumn = 15) + private String phone; + + /** + * 会员等级 + */ + @ApiModelProperty(value = "会员等级") + @ExcelResources(order=3,title = "会员等级",cloumn = 15) + private String memberLevelName; + + /** + * 消费总额 + */ + @ApiModelProperty(value = "消费总额") + @ExcelResources(order=4,title = "消费总额",cloumn = 15) + private BigDecimal total; + + /** + * 购买次数 + */ + @ApiModelProperty(value = "购买次数") + @ExcelResources(order=5,title = "购买次数",cloumn = 15) + private Integer buyers; + + /** + * 上次消费时间 + */ + @ApiModelProperty(value = "上次消费时间") + @ExcelResources(order=6,title = "上次消费时间",cloumn = 15) + private String time; + + /** + * 注册时间 + */ + @ApiModelProperty(value = "注册时间") + @ExcelResources(order=7,title = "注册时间",cloumn = 15) + private String createTime; + + /** + * 注册ip + */ + @ApiModelProperty(value = "注册ip") + @ExcelResources(order=8,title = "注册ip",cloumn = 15) + private String registerIp; + + /** + * 最后登录ip + */ + @ApiModelProperty(value = "最后登录ip") + @ExcelResources(order=9,title = "最后登录ip",cloumn = 15) + private String lastLoginIp; + + /** + * 注册来源 + */ + @ApiModelProperty(value = "注册来源") + @ExcelResources(order=10,title = "注册来源",cloumn = 15) + private String terminal; + + /** + * 注册渠道 + */ + @ApiModelProperty(value = "注册渠道") + @ExcelResources(order=11,title = "注册渠道",cloumn = 15) + private String channelName; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/channel/ChannelDTO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/channel/ChannelDTO.java new file mode 100644 index 0000000..0f01d66 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/channel/ChannelDTO.java @@ -0,0 +1,24 @@ +package com.shop.cereshop.business.page.channel; + +import com.shop.cereshop.commons.domain.channel.Channel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +public class ChannelDTO extends Channel { + + @ApiModelProperty("注册人数") + private Integer registerCount; + + @ApiModelProperty("下单人数") + private Integer orderUserCount; + + @ApiModelProperty("下单数") + private Integer orderCount; + + @ApiModelProperty("下单金额") + private BigDecimal orderAmount; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/credit/CereCreditRecordPage.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/credit/CereCreditRecordPage.java new file mode 100644 index 0000000..e7a9be3 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/credit/CereCreditRecordPage.java @@ -0,0 +1,24 @@ +package com.shop.cereshop.business.page.credit; + +import com.shop.cereshop.commons.domain.credit.CereCreditRecord; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("直播间商品分页查询") +public class CereCreditRecordPage extends CereCreditRecord { + + /** + * 用户昵称 + */ + @ApiModelProperty("用户昵称") + private String name; + + /** + * 用户手机号 + */ + @ApiModelProperty("用户手机号") + private String phone; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerBlackListParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerBlackListParam.java new file mode 100644 index 0000000..13a474f --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerBlackListParam.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 贴标签请求 + */ +@Data +@ApiModel(value = "BuyerSaveUserLabelParam", description = "贴标签请求") +public class BusinessBuyerBlackListParam { + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + private Long buyerUserId; + + /** + * 是否加入黑名单 1-是 0-否 + */ + @ApiModelProperty(value = "是否加入黑名单 1-是 0-否") + private Integer ifBlack; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetAllParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetAllParam.java new file mode 100644 index 0000000..30c0a5a --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetAllParam.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.buyer; + +import com.shop.cereshop.commons.domain.common.PageParam; +import com.shop.cereshop.commons.utils.EmptyUtils; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * 获取客户列表请求 + */ +@Data +@ApiModel(value = "BuyerGetAllParam", description = "获取客户列表请求") +public class BusinessBuyerGetAllParam extends PageParam { + + /** + * 用户昵称 + */ + @ApiModelProperty(value = "用户昵称") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phone; + + /** + * 标签id + */ + @ApiModelProperty(value = "标签id") + private Long labelId; + + /** + * 最近消费时间日期数组 + */ + @ApiModelProperty(value = "最近消费时间日期数组") + private List dates; + + public void setDates(List dates) { + if(!EmptyUtils.isEmpty(dates)&&dates.size()>1){ + this.startTime=dates.get(0)+" 00:00:00"; + this.endTime=dates.get(1)+" 23:59:59"; + } + } + + /** + * 累计消费金额最小值 + */ + @ApiModelProperty(value = "累计消费金额最小值") + private BigDecimal minMoney; + + /** + * 累计消费金额最大值 + */ + @ApiModelProperty(value = "累计消费金额最大值") + private BigDecimal maxMoney; + + /** + * 购买次数最小值 + */ + @ApiModelProperty(value = "购买次数最小值") + private Integer minBuyers; + + /** + * 购买次数最大值 + */ + @ApiModelProperty(value = "购买次数最大值") + private Integer maxBuyers; + + /** + * 申请开始时间 + */ + @ApiModelProperty(value = "申请开始时间") + private String startTime; + + /** + * 申请结束时间 + */ + @ApiModelProperty(value = "申请结束时间") + private String endTime; + + + @ApiModelProperty(value = "商家id") + private String project; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetByIdParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetByIdParam.java new file mode 100644 index 0000000..d5fba88 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetByIdParam.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取客户详情请求 + */ +@Data +@ApiModel(value = "BuyerGetByIdParam", description = "获取客户详情请求") +public class BusinessBuyerGetByIdParam { + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + private Long buyerUserId; + + /** + * 订单编号 + */ + @ApiModelProperty(value = "订单编号") + private String orderFormid; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetLabelsParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetLabelsParam.java new file mode 100644 index 0000000..ca65917 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerGetLabelsParam.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取标签列表请求 + */ +@Data +@ApiModel(value = "BuyerGetLabelsParam", description = "获取标签列表请求") +public class BusinessBuyerGetLabelsParam { + + /** + * 标签名称 + */ + @ApiModelProperty(value = "标签名称") + private String labelName; + + /** + * 客户id + */ + @ApiModelProperty(value = "客户id") + private Long buyerUserId; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerSaveUserLabelParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerSaveUserLabelParam.java new file mode 100644 index 0000000..0664fd2 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessBuyerSaveUserLabelParam.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * 贴标签请求 + */ +@Data +@ApiModel(value = "BuyerSaveUserLabelParam", description = "贴标签请求") +public class BusinessBuyerSaveUserLabelParam { + + /** + * 关联客户id + */ + @ApiModelProperty(value = "关联客户id") + private Long buyerUserId; + + /** + * 关联平台标签id数组 + */ + @ApiModelProperty(value = "关联平台标签id数组") + private List buyerLabelIds; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUpdateCreditParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUpdateCreditParam.java new file mode 100644 index 0000000..c536590 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUpdateCreditParam.java @@ -0,0 +1,16 @@ +package com.shop.cereshop.business.param.buyer; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("修改积分的参数") +public class BusinessUpdateCreditParam { + + @ApiModelProperty("用户id") + private Long buyerUserId; + + @ApiModelProperty("积分值 扣减积分则传负数") + private Integer credit; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUserSearchParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUserSearchParam.java new file mode 100644 index 0000000..82e30f1 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/buyer/BusinessUserSearchParam.java @@ -0,0 +1,15 @@ +package com.shop.cereshop.business.param.buyer; + +import com.shop.cereshop.commons.domain.common.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("用户搜索条件") +public class BusinessUserSearchParam extends PageParam { + + @ApiModelProperty("buyerUserId/openId/昵称/手机号") + private String searchKey; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelGetAllParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelGetAllParam.java new file mode 100644 index 0000000..e63daa4 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelGetAllParam.java @@ -0,0 +1,13 @@ +package com.shop.cereshop.business.param.channel; + +import com.shop.cereshop.commons.domain.common.PageParam; +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * 获取渠道列表请求 + */ +@Data +@ApiModel(value = "ChannelGetAllParam", description = "获取渠道列表请求") +public class ChannelGetAllParam extends PageParam { +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelParam.java new file mode 100644 index 0000000..44c348a --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/channel/ChannelParam.java @@ -0,0 +1,20 @@ +package com.shop.cereshop.business.param.channel; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 渠道参数 + */ +@Data +@ApiModel(value = "ChannelParam", description = "渠道参数") +public class ChannelParam { + + @ApiModelProperty("渠道id") + private Long id; + + @ApiModelProperty("渠道名称") + private String channelName; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/CreditRecordGetAllParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/CreditRecordGetAllParam.java new file mode 100644 index 0000000..46cf145 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/CreditRecordGetAllParam.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.param.credit; + +import com.shop.cereshop.commons.domain.common.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 获取积分记录请求 + * @author + */ +@Data +@ApiModel(value = "CreditRecordGetAllParam", description = "获取积分记录请求") +public class CreditRecordGetAllParam extends PageParam { + + @ApiModelProperty("搜索关键词") + private String search; + +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/UpdateCreditParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/UpdateCreditParam.java new file mode 100644 index 0000000..69181be --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/credit/UpdateCreditParam.java @@ -0,0 +1,16 @@ +package com.shop.cereshop.business.param.credit; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("修改积分的参数") +public class UpdateCreditParam { + + @ApiModelProperty("用户id") + private Long buyerUserId; + + @ApiModelProperty("积分值 扣减积分则传负数") + private Integer credit; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBusinessBuyerUserService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBusinessBuyerUserService.java new file mode 100644 index 0000000..53df10a --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBusinessBuyerUserService.java @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.buyer; + +import com.shop.cereshop.business.page.buyer.BusinessBuyerUser; +import com.shop.cereshop.business.page.buyer.BusinessBuyerUserDetail; +import com.shop.cereshop.business.param.buyer.*; +import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.label.CerePlatformLabel; +import com.shop.cereshop.commons.domain.user.CerePlatformUser; +import com.shop.cereshop.commons.exception.CoBusinessException; + +import java.util.List; + +public interface CereBusinessBuyerUserService { + /** + * 分页查询客户 + * @param param + * @return + * @throws CoBusinessException + */ + Page getAll(BusinessBuyerGetAllParam param) throws CoBusinessException; + + /** + * 根据主键查询客户 + * @param param + * @return + * @throws CoBusinessException + */ + BusinessBuyerUserDetail getById(BusinessBuyerGetByIdParam param) throws CoBusinessException; + + /** + * 查询客户标签 + * @param param + * @return + * @throws CoBusinessException + */ + List getLabels(BusinessBuyerGetLabelsParam param) throws CoBusinessException; + + /** + * 保存用户标签 + * @param param + * @param user + * @throws CoBusinessException + */ + void saveUserLabel(BusinessBuyerSaveUserLabelParam param, CerePlatformBusinessUser user) throws CoBusinessException; + + /** + * 将客户加入/取消黑名单 + * @param param + * @param user + * @throws CoBusinessException + */ + void blacklist(BusinessBuyerBlackListParam param, CerePlatformBusinessUser user) throws CoBusinessException; + + /** + * 条件查询标签 + * @param param + * @return + * @throws CoBusinessException + */ + List getUserLabels(BusinessBuyerGetLabelsParam param) throws CoBusinessException; + + /** + * 增加/减少客户积分 + * @param param + * @param user + * @throws CoBusinessException + */ + void updateCredit(BusinessUpdateCreditParam param, CerePlatformBusinessUser user) throws CoBusinessException; + + /** + * 搜索用户 + * @param param + * @return + */ + Page searchUser(BusinessUserSearchParam param); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBusinessBuyerUserServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBusinessBuyerUserServiceImpl.java new file mode 100644 index 0000000..a52f994 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBusinessBuyerUserServiceImpl.java @@ -0,0 +1,255 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.buyer.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.shop.cereshop.business.dao.business.BusinessBuyerUserDAO; +import com.shop.cereshop.business.dao.credit.CereCreditRecordDAO; +import com.shop.cereshop.business.page.buyer.BusinessBuyerUser; +import com.shop.cereshop.business.page.buyer.BusinessBuyerUserDetail; +import com.shop.cereshop.business.param.buyer.*; +import com.shop.cereshop.business.service.buyer.CereBusinessBuyerUserService; +import com.shop.cereshop.business.service.label.CereBuyerLabelService; +import com.shop.cereshop.business.service.log.CerePlatformLogService; +import com.shop.cereshop.business.utils.EncodeUtil; +import com.shop.cereshop.commons.cache.constants.CacheKeyConstants; +import com.shop.cereshop.commons.constant.CoReturnFormat; +import com.shop.cereshop.commons.constant.CreditOptTypeEnum; +import com.shop.cereshop.commons.constant.IntegerEnum; +import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; +import com.shop.cereshop.commons.domain.buyer.CereBuyerReceive; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.credit.CereCreditRecord; +import com.shop.cereshop.commons.domain.label.CereBuyerLabel; +import com.shop.cereshop.commons.domain.label.CerePlatformLabel; +import com.shop.cereshop.commons.domain.user.CerePlatformUser; +import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.EmptyUtils; +import com.shop.cereshop.commons.utils.TimeUtils; +import lombok.extern.slf4j.Slf4j; +import org.redisson.api.RLock; +import org.redisson.api.RedissonClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Isolation; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Slf4j +@Service +public class CereBusinessBuyerUserServiceImpl implements CereBusinessBuyerUserService { + + @Autowired + private BusinessBuyerUserDAO businessBuyerUserDAO; + + @Autowired + private CereBuyerLabelService cereBuyerLabelService; + + @Autowired + private CerePlatformLogService cerePlatformLogService; + + @Autowired + private RedissonClient redissonClient; + + @Autowired + private CereCreditRecordDAO cereCreditRecordDAO; + + @Autowired + private EncodeUtil encodeUtil; + + @Override + public Page getAll(BusinessBuyerGetAllParam param) throws CoBusinessException { + if (param.getPage() != null && param.getPageSize() != null) { + PageHelper.startPage(param.getPage(),param.getPageSize()); + } + long start = System.currentTimeMillis(); + log.info("start " + start); + List list = businessBuyerUserDAO.getAll(param); + log.info("end " + (System.currentTimeMillis() - start)); + for(BusinessBuyerUser user:list) { + List labelIds = cereBuyerLabelService.findByBuyerUserId(user.getBuyerUserId()); + user.setLabelIds(labelIds); + user.setPhone(encodeUtil.encodePhone(user.getPhone())); + user.setName(encodeUtil.encodeInfo(user.getName())); + } + PageInfo pageInfo=new PageInfo<>(list); + Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); + return page; + } + + @Override + public BusinessBuyerUserDetail getById(BusinessBuyerGetByIdParam param) throws CoBusinessException { + //查询客户数据 + BusinessBuyerUserDetail detail=businessBuyerUserDAO.getById(param.getBuyerUserId()); + if(detail!=null){ + detail.setName(encodeUtil.encodeInfo(detail.getName())); + detail.setPhone(encodeUtil.encodePhone(detail.getPhone())); + //查询用户标签数据 + detail.setLabels(businessBuyerUserDAO.findLabels(param.getBuyerUserId())); + //查询标签id + detail.setLabelIds(cereBuyerLabelService.findByBuyerUserId(detail.getBuyerUserId())); + //查询下单数 + detail.setOrders(businessBuyerUserDAO.findOrders(param.getBuyerUserId())); + //查询支付成功数 + detail.setPays(businessBuyerUserDAO.findPays(param.getBuyerUserId())); + //查询购买商品数 + detail.setProducts(businessBuyerUserDAO.findProducts(param.getBuyerUserId())); + //查询累计消费额 + detail.setPrice(businessBuyerUserDAO.findPrice(param.getBuyerUserId())); + //查询售后次数 + detail.setAfters(businessBuyerUserDAO.findAfters(param.getBuyerUserId())); + //查询售后单数 + detail.setAfterOrders(businessBuyerUserDAO.findAfterOrders(param.getBuyerUserId())); + //查询售后成功单数 + detail.setSuccessAfters(businessBuyerUserDAO.findSuccessAfters(param.getBuyerUserId())); + //查询订单列表 + detail.setOrderList(businessBuyerUserDAO.findOrderList(param)); + //查询评论列表 + detail.setComments(businessBuyerUserDAO.findComments(param.getBuyerUserId())); + //查询收货地址列表 + List receiveList = businessBuyerUserDAO.findReceives(param.getBuyerUserId()); + for (CereBuyerReceive receive:receiveList) { + receive.setReceivePhone(encodeUtil.encodePhone(receive.getReceivePhone())); + receive.setReceiveName(encodeUtil.encodeInfo(receive.getReceiveName())); + receive.setReceiveAdress(encodeUtil.encodeInfo(receive.getReceiveAdress())); + receive.setAddress(encodeUtil.encodeInfo(receive.getAddress())); + } + detail.setReceives(receiveList); + } + return detail; + } + + @Override + public List getLabels(BusinessBuyerGetLabelsParam param) throws CoBusinessException { + return businessBuyerUserDAO.getLabels(param); + } + + @Override + @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) + public void saveUserLabel(BusinessBuyerSaveUserLabelParam param, CerePlatformBusinessUser user) throws CoBusinessException { + String time= TimeUtils.yyMMddHHmmss(); + if(!EmptyUtils.isEmpty(param.getBuyerLabelIds())){ + //查询客户已有标签的 + List ids=cereBuyerLabelService.findAlreadyByUser(param); + if(!EmptyUtils.isEmpty(ids)){ + //过滤已有标签 + for (int i = 0; i < param.getBuyerLabelIds().size(); i++) { + if(ids.contains(param.getBuyerLabelIds().get(i))){ + param.getBuyerLabelIds().remove(i); + i--; + } + } + } + if(!EmptyUtils.isEmpty(param.getBuyerLabelIds())){ + for (Long id:param.getBuyerLabelIds()) { + CereBuyerLabel cereBuyerLabel=new CereBuyerLabel(); + cereBuyerLabel.setBuyerUserId(param.getBuyerUserId()); + cereBuyerLabel.setBuyerLabelId(id); + cereBuyerLabelService.insert(cereBuyerLabel); + //新增日志 + cerePlatformLogService.addLog(user,"客户管理","商家端操作","贴标签",param.getBuyerUserId(),time); + } + } + } + } + + @Override + @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) + public void blacklist(BusinessBuyerBlackListParam param, CerePlatformBusinessUser user) throws CoBusinessException { + String time =TimeUtils.yyMMddHHmmss(); + String describe=""; + CereBuyerUser cereBuyerUser=new CereBuyerUser(); + cereBuyerUser.setBuyerUserId(param.getBuyerUserId()); + cereBuyerUser.setIfBlack(param.getIfBlack()); + cereBuyerUser.setUpdateTime(time); + businessBuyerUserDAO.updateByPrimaryKeySelective(cereBuyerUser); + if(IntegerEnum.YES.getCode().equals(param.getIfBlack())){ + //加入黑名单 + describe="加入黑名单"; + }else { + //取消黑名单 + describe="取消黑名单"; + } + //新增日志 + cerePlatformLogService.addLog(user,"客户管理","商家端操作",describe,param.getBuyerUserId(),time); + } + + @Override + public List getUserLabels(BusinessBuyerGetLabelsParam param) throws CoBusinessException { + return businessBuyerUserDAO.getUserLabels(param); + } + + @Override + public void updateCredit(BusinessUpdateCreditParam param, CerePlatformBusinessUser user) throws CoBusinessException { + //定义加锁key + String key = CacheKeyConstants.CREDIT_LOCK + param.getBuyerUserId(); + //加锁 + RLock redissonLock = redissonClient.getLock(key); + String time = TimeUtils.yyMMddHHmmss(); + long buyerUserId = param.getBuyerUserId(); + Integer credit = param.getCredit(); + if (credit == 0) { + return; + } + Integer absCredit = Math.abs(param.getCredit()); + boolean notEnoughCredit = false; + try { + redissonLock.lock(); + CereBuyerUser buyerUser = businessBuyerUserDAO.selectById(buyerUserId); + if (credit < 0 && buyerUser.getCredit() < absCredit) { + notEnoughCredit = true; + } else { + CreditOptTypeEnum typeEnum = CreditOptTypeEnum.ADMIN_ADD; + String describe = "增加"+absCredit+"积分"; + if (credit < 0) { + typeEnum = CreditOptTypeEnum.ADMIN_SUB; + describe = "扣减"+absCredit+"积分"; + } + businessBuyerUserDAO.increaseCredit(buyerUserId, param.getCredit()); + //增加积分记录 + CereCreditRecord record = CreditOptTypeEnum.initRecord(typeEnum); + record.setBuyerUserId(buyerUserId); + record.setCreateTime(time); + record.setUpdateTime(time); + record.setCredit(absCredit); + record.setRemainCredit(buyerUser.getCredit() + credit); + cereCreditRecordDAO.insert(record); + //新增日志 + cerePlatformLogService.addLog(user,"客户管理","商家端操作",describe,param.getBuyerUserId(),time); + } + } catch (Exception e) { + log.error("increaseCredit fail: buyerUserId = {}, credit = {}" + e.getMessage(), + buyerUserId, credit, e); + } finally { + redissonLock.unlock(); + } + if (notEnoughCredit) { + throw new CoBusinessException(CoReturnFormat.CREDIT_NOT_ENOUGH); + } + } + + @Override + public Page searchUser(BusinessUserSearchParam param) { + PageHelper.startPage(param.getPage(),param.getPageSize()); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CereBuyerUser::getBuyerUserId, param.getSearchKey()) + .or() + .eq(CereBuyerUser::getWechatOpenId, param.getSearchKey()) + .or() + .like(CereBuyerUser::getName, param.getSearchKey()) + .or() + .eq(CereBuyerUser::getPhone, param.getSearchKey()); + List userList = businessBuyerUserDAO.selectList(wrapper); + PageInfo pageInfo=new PageInfo<>(userList); + Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); + return page; + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/ChannelService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/ChannelService.java new file mode 100644 index 0000000..741d196 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/ChannelService.java @@ -0,0 +1,38 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.service.channel; + +import com.shop.cereshop.business.page.channel.ChannelDTO; +import com.shop.cereshop.business.param.channel.ChannelGetAllParam; +import com.shop.cereshop.business.param.channel.ChannelParam; +import com.shop.cereshop.commons.domain.channel.Channel; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.user.CerePlatformUser; +import com.shop.cereshop.commons.exception.CoBusinessException; + +import java.util.List; + +/** + *

+ * 业务接口 + * 渠道表 + *

+ * + * @author + * @date 2022-08-25 + */ +public interface ChannelService { + + void save(ChannelParam param, CerePlatformUser user) throws CoBusinessException; + + void update(ChannelParam param, CerePlatformUser user) throws CoBusinessException; + + void delete(ChannelParam param, CerePlatformUser user) throws CoBusinessException; + + Page getAll(ChannelGetAllParam param) throws CoBusinessException; + + List selectByChannelCodeList(List channelCodeList); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/impl/ChannelServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/impl/ChannelServiceImpl.java new file mode 100644 index 0000000..59a8516 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/channel/impl/ChannelServiceImpl.java @@ -0,0 +1,120 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.service.channel.impl; + + +import cn.hutool.core.util.IdUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.shop.cereshop.business.dao.business.BusinessBuyerUserDAO; +import com.shop.cereshop.business.dao.channel.ChannelDAO; +import com.shop.cereshop.business.dao.order.CereShopOrderDAO; +import com.shop.cereshop.business.page.channel.ChannelDTO; +import com.shop.cereshop.business.param.channel.ChannelGetAllParam; +import com.shop.cereshop.business.param.channel.ChannelParam; +import com.shop.cereshop.business.service.channel.ChannelService; +import com.shop.cereshop.commons.constant.CoReturnFormat; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.channel.Channel; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.user.CerePlatformUser; +import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.TimeUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * 业务实现类 + * 渠道表 + *

+ * + * @author + * @date 2022-08-25 + */ +@Slf4j +@Service +public class ChannelServiceImpl implements ChannelService { + + @Autowired + private ChannelDAO channelDAO; + + @Value("${channelRegisterUrl}") + private String channelRegisterUrl; + + @Autowired + private BusinessBuyerUserDAO businessBuyerUserDAO; + + @Autowired + private CereShopOrderDAO cereShopOrderDAO; + + @Override + public void save(ChannelParam param, CerePlatformUser user) throws CoBusinessException { + Channel channel = new Channel(); + String now = TimeUtils.yyMMddHHmmss(); + channel.setChannelName(param.getChannelName()); + int count = 0; + while (true) { + if (count > 100) { + throw new CoBusinessException(CoReturnFormat.SYS_ERROR); + } + String channelCode = IdUtil.simpleUUID().substring(0,6); + int existsCount = channelDAO.selectCount(Wrappers.lambdaQuery().eq(Channel::getChannelCode, channelCode)); + if (existsCount == 0) { + channel.setChannelCode(channelCode); + break; + } + count++; + } + channel.setRegisterUrl(channelRegisterUrl + channel.getChannelCode()); + channel.setCreateTime(now); + channel.setUpdateTime(now); + channelDAO.insert(channel); + } + + @Override + public void update(ChannelParam param, CerePlatformUser user) throws CoBusinessException { + Channel channel = new Channel(); + channel.setId(param.getId()); + channel.setChannelName(param.getChannelName()); + channelDAO.updateById(channel); + } + + @Override + public void delete(ChannelParam param, CerePlatformUser user) throws CoBusinessException { + channelDAO.deleteById(param.getId()); + } + + @Override + public Page getAll(ChannelGetAllParam param) throws CoBusinessException { + PageHelper.startPage(param.getPage(),param.getPageSize()); + List list=channelDAO.selectList(Wrappers.emptyWrapper()); + List channelDTOList = new ArrayList<>(); + for (Channel channel:list) { + ChannelDTO channelDTO = new ChannelDTO(); + BeanUtils.copyProperties(channel, channelDTO); + channelDTO.setRegisterCount(businessBuyerUserDAO.selectCount(Wrappers.lambdaQuery().eq(CereBuyerUser::getChannelCode, channel.getChannelCode()))); + channelDTO.setOrderUserCount(cereShopOrderDAO.selectChannelOrderUserCount(channel.getChannelCode())); + channelDTO.setOrderCount(cereShopOrderDAO.selectChannelOrderCount(channel.getChannelCode())); + channelDTO.setOrderAmount(cereShopOrderDAO.selectChannelOrderAmount(channel.getChannelCode())); + channelDTOList.add(channelDTO); + } + PageInfo pageInfo=new PageInfo<>(channelDTOList); + return new Page<>(pageInfo.getList(),pageInfo.getTotal()); + } + + @Override + public List selectByChannelCodeList(List channelCodeList) { + return channelDAO.selectList(Wrappers.lambdaQuery().in(Channel::getChannelCode, channelCodeList)); + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditRecordService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditRecordService.java new file mode 100644 index 0000000..df8e54f --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditRecordService.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.credit; + + +import com.shop.cereshop.business.param.credit.CreditRecordGetAllParam; +import com.shop.cereshop.commons.domain.common.Page; + +/** + *

+ * 业务接口 + * 积分流水表 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +public interface CereCreditRecordService { + + Page getAll(CreditRecordGetAllParam param); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditSignSettingService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditSignSettingService.java new file mode 100644 index 0000000..0d50702 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/CereCreditSignSettingService.java @@ -0,0 +1,31 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.service.credit; + +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.common.PageParam; +import com.shop.cereshop.commons.domain.credit.CereCreditSignSetting; +import com.shop.cereshop.commons.exception.CoBusinessException; + +/** + *

+ * 业务接口 + * 积分签到配置 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +public interface CereCreditSignSettingService { + + Page getAll(PageParam param); + + int save(CereCreditSignSetting param) throws CoBusinessException; + + int update(CereCreditSignSetting param) throws CoBusinessException; + + int delete(Long id); +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditRecordServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditRecordServiceImpl.java new file mode 100644 index 0000000..581e1ed --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditRecordServiceImpl.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.credit.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.shop.cereshop.business.dao.credit.CereCreditRecordDAO; +import com.shop.cereshop.business.page.credit.CereCreditRecordPage; +import com.shop.cereshop.business.param.credit.CreditRecordGetAllParam; +import com.shop.cereshop.business.service.credit.CereCreditRecordService; +import com.shop.cereshop.business.utils.EncodeUtil; +import com.shop.cereshop.commons.domain.common.Page; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 业务实现类 + * 积分流水表 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +@Slf4j +@Service +public class CereCreditRecordServiceImpl implements CereCreditRecordService { + + @Autowired + private CereCreditRecordDAO cereCreditRecordDAO; + + @Autowired + private EncodeUtil encodeUtil; + + @Override + public Page getAll(CreditRecordGetAllParam param) { + PageHelper.startPage(param.getPage(),param.getPageSize()); + List list=cereCreditRecordDAO.getAll(param); + for (CereCreditRecordPage record:list) { + record.setName(encodeUtil.encodeInfo(record.getName())); + record.setPhone(encodeUtil.encodePhone(record.getPhone())); + } + PageInfo pageInfo=new PageInfo<>(list); + Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); + return page; + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditSignSettingServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditSignSettingServiceImpl.java new file mode 100644 index 0000000..23a6036 --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/credit/impl/CereCreditSignSettingServiceImpl.java @@ -0,0 +1,70 @@ +/* +* Copyright (C) 2017-2021 +* All rights reserved, Designed By 深圳中科鑫智科技有限公司 +* Copyright authorization contact 18814114118 +*/ +package com.shop.cereshop.business.service.credit.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.shop.cereshop.business.dao.credit.CereCreditSignSettingDAO; +import com.shop.cereshop.business.service.credit.CereCreditSignSettingService; +import com.shop.cereshop.commons.constant.CoReturnFormat; +import com.shop.cereshop.commons.domain.common.Page; +import com.shop.cereshop.commons.domain.common.PageParam; +import com.shop.cereshop.commons.domain.credit.CereCreditSignSetting; +import com.shop.cereshop.commons.exception.CoBusinessException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + *

+ * 业务实现类 + * 积分签到配置 + *

+ * + * @author JustArgo + * @date 2021-12-04 + */ +@Slf4j +@Service +public class CereCreditSignSettingServiceImpl implements CereCreditSignSettingService { + + @Autowired + private CereCreditSignSettingDAO cereCreditSignSettingDAO; + + @Override + public Page getAll(PageParam param) { + PageHelper.startPage(param.getPage(),param.getPageSize()); + List list=cereCreditSignSettingDAO.getAll(param); + PageInfo pageInfo=new PageInfo<>(list); + Page page=new Page(pageInfo.getList(),pageInfo.getTotal()); + return page; + } + + @Override + public int save(CereCreditSignSetting param) throws CoBusinessException { + int count = cereCreditSignSettingDAO.selectExistsDay(param.getDay(), param.getId()); + if (count > 0) { + throw new CoBusinessException(CoReturnFormat.CREDIT_SETTING_EXISTS); + } + return cereCreditSignSettingDAO.insert(param); + } + + @Override + public int update(CereCreditSignSetting param) throws CoBusinessException { + int count = cereCreditSignSettingDAO.selectExistsDay(param.getDay(), param.getId()); + if (count > 0) { + throw new CoBusinessException(CoReturnFormat.CREDIT_SETTING_EXISTS); + } + return cereCreditSignSettingDAO.updateById(param); + } + + @Override + public int delete(Long id) { + return cereCreditSignSettingDAO.deleteById(id); + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CereBuyerLabelService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CereBuyerLabelService.java index 2333d06..b83e0b4 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CereBuyerLabelService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CereBuyerLabelService.java @@ -5,5 +5,20 @@ */ package com.shop.cereshop.business.service.label; +import com.shop.cereshop.business.param.buyer.BusinessBuyerSaveUserLabelParam; +import com.shop.cereshop.commons.domain.label.CereBuyerLabel; +import com.shop.cereshop.commons.exception.CoBusinessException; + +import java.util.List; + public interface CereBuyerLabelService { + void insert(CereBuyerLabel cereBuyerLabel) throws CoBusinessException; + + void deleteLabelUser(List ids) throws CoBusinessException; + + void insertBatch(List collect); + + List findAlreadyByUser(BusinessBuyerSaveUserLabelParam param); + + List findByBuyerUserId(Long buyerUserId); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CereBuyerLabelServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CereBuyerLabelServiceImpl.java index b3af9cb..0814c52 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CereBuyerLabelServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CereBuyerLabelServiceImpl.java @@ -5,9 +5,45 @@ */ package com.shop.cereshop.business.service.label.impl; +import com.shop.cereshop.business.dao.label.CereBuyerLabelDAO; +import com.shop.cereshop.business.param.buyer.BusinessBuyerSaveUserLabelParam; import com.shop.cereshop.business.service.label.CereBuyerLabelService; +import com.shop.cereshop.commons.domain.label.CereBuyerLabel; +import com.shop.cereshop.commons.exception.CoBusinessException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class CereBuyerLabelServiceImpl implements CereBuyerLabelService { + + @Autowired + private CereBuyerLabelDAO cereBuyerLabelDAO; + + @Override + public void insert(CereBuyerLabel cereBuyerLabel) throws CoBusinessException { + cereBuyerLabelDAO.insert(cereBuyerLabel); + } + + @Override + public void deleteLabelUser(List ids) throws CoBusinessException { + cereBuyerLabelDAO.deleteLabelUser(ids); + } + + @Override + public void insertBatch(List collect) { + cereBuyerLabelDAO.insertBatch(collect); + } + + @Override + public List findAlreadyByUser(BusinessBuyerSaveUserLabelParam param) { + return cereBuyerLabelDAO.findAlreadyByUser(param); + } + + @Override + public List findByBuyerUserId(Long buyerUserId) { + return cereBuyerLabelDAO.findByBuyerUserId(buyerUserId); + } + } diff --git a/cereshop-business/src/main/resources/application-business-dev.yml b/cereshop-business/src/main/resources/application-business-dev.yml index 36d4071..7557af0 100644 --- a/cereshop-business/src/main/resources/application-business-dev.yml +++ b/cereshop-business/src/main/resources/application-business-dev.yml @@ -198,6 +198,9 @@ refreshSkuRealInfoUrl: ${spring.domain}/product/refreshSkuRealInfo #渠道券活动url channelCouponActivityUrl: ${spring.domain}/h5/#/pages_category_page2/channelCouponSeaMee/index? +#渠道注册链接 +channelRegisterUrl: ${spring.domain}/h5/#/pages_category_page2/userModule/register? + xspay: url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm mer_code: 10000000381 diff --git a/cereshop-business/src/main/resources/application-business-prod.yml b/cereshop-business/src/main/resources/application-business-prod.yml index 74320c7..29fcbb9 100644 --- a/cereshop-business/src/main/resources/application-business-prod.yml +++ b/cereshop-business/src/main/resources/application-business-prod.yml @@ -197,3 +197,6 @@ refreshSkuRealInfoUrl: ${spring.domain}/product/refreshSkuRealInfo #渠道券活动url channelCouponActivityUrl: ${spring.domain}/h5/#/pages_category_page2/channelCouponSeaMee/index? + +#渠道注册链接 +channelRegisterUrl: ${spring.domain}/h5/#/pages_category_page2/userModule/register? diff --git a/cereshop-business/src/main/resources/application-business-test.yml b/cereshop-business/src/main/resources/application-business-test.yml index 9838ff4..821afbe 100644 --- a/cereshop-business/src/main/resources/application-business-test.yml +++ b/cereshop-business/src/main/resources/application-business-test.yml @@ -197,3 +197,6 @@ refreshSkuRealInfoUrl: ${spring.domain}/product/refreshSkuRealInfo #渠道券活动url channelCouponActivityUrl: ${spring.domain}/h5/#/pages_category_page2/channelCouponSeaMee/index? + +#渠道注册链接 +channelRegisterUrl: ${spring.domain}/h5/#/pages_category_page2/userModule/register? diff --git a/cereshop-business/src/main/resources/mybatis/mapper/business/BusinessBuyerUserDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/business/BusinessBuyerUserDAO.xml new file mode 100644 index 0000000..538142e --- /dev/null +++ b/cereshop-business/src/main/resources/mybatis/mapper/business/BusinessBuyerUserDAO.xml @@ -0,0 +1,347 @@ + + + + + + + + + + + + + + + + + + + + + + + + buyer_user_id, `name`, sex, birthday, wechat_open_id, wechat_union_id, wechat_name, + wechat_number, phone, `password`, head_image, `state`,if_black, remark, token, create_time, + update_time + + + + delete from cere_buyer_user + where buyer_user_id = #{buyerUserId,jdbcType=BIGINT} + + + insert into cere_buyer_user + + + `name`, + + + sex, + + + birthday, + + + wechat_open_id, + + + wechat_union_id, + + + wechat_name, + + + wechat_number, + + + phone, + + + `password`, + + + head_image, + + + `state`, + + + if_black, + + + remark, + + + token, + + + create_time, + + + update_time, + + + + + #{name,jdbcType=VARCHAR}, + + + #{sex,jdbcType=VARCHAR}, + + + #{birthday,jdbcType=VARCHAR}, + + + #{wechatOpenId,jdbcType=VARCHAR}, + + + #{wechatUnionId,jdbcType=VARCHAR}, + + + #{wechatName,jdbcType=VARCHAR}, + + + #{wechatNumber,jdbcType=VARCHAR}, + + + #{phone,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{headImage,jdbcType=VARCHAR}, + + + #{state,jdbcType=BIT}, + + + #{ifBlack,jdbcType=BIT}, + + + #{remark,jdbcType=VARCHAR}, + + + #{token,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=VARCHAR}, + + + + + update cere_buyer_user + + + `name` = #{name,jdbcType=VARCHAR}, + + + sex = #{sex,jdbcType=VARCHAR}, + + + birthday = #{birthday,jdbcType=VARCHAR}, + + + wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}, + + + wechat_union_id = #{wechatUnionId,jdbcType=VARCHAR}, + + + wechat_name = #{wechatName,jdbcType=VARCHAR}, + + + wechat_number = #{wechatNumber,jdbcType=VARCHAR}, + + + phone = #{phone,jdbcType=VARCHAR}, + + + `password` = #{password,jdbcType=VARCHAR}, + + + head_image = #{headImage,jdbcType=VARCHAR}, + + + `state` = #{state,jdbcType=BIT}, + + + if_black = #{ifBlack,jdbcType=BIT}, + + + remark = #{remark,jdbcType=VARCHAR}, + + + token = #{token,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=VARCHAR}, + + + where buyer_user_id = #{buyerUserId,jdbcType=BIGINT} + + + update cere_buyer_user + set `name` = #{name,jdbcType=VARCHAR}, + sex = #{sex,jdbcType=VARCHAR}, + birthday = #{birthday,jdbcType=VARCHAR}, + wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}, + wechat_union_id = #{wechatUnionId,jdbcType=VARCHAR}, + wechat_name = #{wechatName,jdbcType=VARCHAR}, + wechat_number = #{wechatNumber,jdbcType=VARCHAR}, + phone = #{phone,jdbcType=VARCHAR}, + `password` = #{password,jdbcType=VARCHAR}, + head_image = #{headImage,jdbcType=VARCHAR}, + `state` = #{state,jdbcType=BIT}, + if_black = #{ifBlack,jdbcType=BIT}, + remark = #{remark,jdbcType=VARCHAR}, + token = #{token,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=VARCHAR} + where buyer_user_id = #{buyerUserId,jdbcType=BIGINT} + + + + update cere_buyer_user + set credit = credit + #{credit} + where buyer_user_id = #{buyerUserId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml index 0554400..4f2e4ad 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml @@ -302,4 +302,22 @@ join cere_pay_log b on a.order_formid = b.order_formid and b.state = '支付' group by a.shop_id, a.buyer_user_id + + + + + + diff --git a/cereshop-business/src/main/resources/mybatis/mapper/label/CereBuyerLabelDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/label/CereBuyerLabelDAO.xml index 8978046..faad10f 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/label/CereBuyerLabelDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/label/CereBuyerLabelDAO.xml @@ -24,4 +24,35 @@
+ + + DELETE FROM cere_buyer_label where buyer_label_id in ( + + #{id} + + ) + + + + insert into cere_buyer_label (buyer_user_id, buyer_label_id) values + + ( + #{item.buyerUserId}, + #{item.buyerLabelId} + ) + + + + + +