dy-hu
7 months ago
14 changed files with 982 additions and 3 deletions
-
2cereshop-admin/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml
-
154cereshop-business/src/main/java/com/shop/cereshop/business/controller/PlatformLabelController.java
-
28cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CerePlatformLabelDAO.java
-
26cereshop-business/src/main/java/com/shop/cereshop/business/param/label/BusinessBuyerLabelDeleteParam.java
-
34cereshop-business/src/main/java/com/shop/cereshop/business/param/label/BusinessBuyerLabelGetAllParam.java
-
24cereshop-business/src/main/java/com/shop/cereshop/business/param/label/BusinessBuyerLabelGetByIdParam.java
-
152cereshop-business/src/main/java/com/shop/cereshop/business/param/label/BusinessBuyerLabelSaveParam.java
-
148cereshop-business/src/main/java/com/shop/cereshop/business/param/label/BusinessBuyerLabelUpdateParam.java
-
26cereshop-business/src/main/java/com/shop/cereshop/business/param/label/LabelExcelParam.java
-
36cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CerePlatformLabelService.java
-
218cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CerePlatformLabelServiceImpl.java
-
130cereshop-business/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml
-
3cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/label/CerePlatformLabel.java
-
4doc/3.0/update.sql
@ -0,0 +1,154 @@ |
|||
/* |
|||
* 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.param.label.*; |
|||
import com.shop.cereshop.business.service.label.CerePlatformLabelService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.label.PlatformLabel; |
|||
import com.shop.cereshop.commons.domain.user.CerePlatformUser; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.poi.ExcelUtils; |
|||
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.poi.xssf.usermodel.XSSFWorkbook; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
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.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 标签管理 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("label") |
|||
/** |
|||
* 注解方式生成日志对象,指定topic生成对象类名 |
|||
*/ |
|||
@Slf4j(topic = "PlatformLabelController") |
|||
@Api(value = "标签管理", tags = "标签管理") |
|||
public class PlatformLabelController { |
|||
|
|||
@Autowired |
|||
private CerePlatformLabelService cerePlatformLabelService; |
|||
|
|||
/** |
|||
* 标签管理查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "标签管理查询") |
|||
public Result<Page<PlatformLabel>> getAll(@RequestBody BusinessBuyerLabelGetAllParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); |
|||
param.setBusinessId(user.getBusinessId()); |
|||
Page page=cerePlatformLabelService.getAll(param); |
|||
return new Result(page); |
|||
} |
|||
|
|||
/** |
|||
* 标签编辑查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "标签编辑查询") |
|||
public Result<PlatformLabel> getById(@RequestBody BusinessBuyerLabelGetByIdParam param) throws CoBusinessException{ |
|||
PlatformLabel label=cerePlatformLabelService.getById(param.getBuyerLabelId()); |
|||
return new Result(label); |
|||
} |
|||
|
|||
/** |
|||
* 添加标签 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "添加标签") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated BusinessBuyerLabelSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); |
|||
param.setBusinessId(user.getBusinessId()); |
|||
cerePlatformLabelService.save(param,user); |
|||
return new Result(user.getUsername(),"添加标签", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 修改标签 |
|||
* @param label |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "修改标签") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody BusinessBuyerLabelUpdateParam label, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); |
|||
label.setBusinessId(user.getBusinessId()); |
|||
cerePlatformLabelService.update(label,user); |
|||
return new Result(user.getUsername(),"修改标签", GsonUtil.objectToGson(label)); |
|||
} |
|||
|
|||
/** |
|||
* 删除标签 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除标签") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody BusinessBuyerLabelDeleteParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user"); |
|||
cerePlatformLabelService.delete(param,user); |
|||
return new Result(user.getUsername(),"删除标签", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 标签导出 |
|||
* @param param |
|||
* @param response |
|||
*/ |
|||
@PostMapping(value = "excel_platform_label") |
|||
@ApiOperation(value = "标签导出") |
|||
public void excelLabel(@RequestBody LabelExcelParam param, HttpServletResponse response) throws CoBusinessException,Exception{ |
|||
List<PlatformLabel> list=cerePlatformLabelService.findExcel(param); |
|||
List<String> titles=new ArrayList<>(); |
|||
titles.add("标签名"); |
|||
titles.add("客户"); |
|||
titles.add("标签类型"); |
|||
titles.add("达标条件"); |
|||
XSSFWorkbook excel = ExcelUtils.createPlatformLabelExcel(titles, list); |
|||
Date date = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String str = "订单管理表"+sdf.format(date); |
|||
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|||
response.setHeader("Content-disposition", "attachment;filename=" + str +".xls");// 默认Excel名称 |
|||
response.flushBuffer(); |
|||
excel.write(response.getOutputStream()); |
|||
excel.close(); |
|||
} |
|||
} |
@ -0,0 +1,26 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 删除标签请求 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "LabelDeleteParam", description = "删除标签请求") |
|||
public class BusinessBuyerLabelDeleteParam { |
|||
|
|||
/** |
|||
* 客户标签id数组 |
|||
*/ |
|||
@ApiModelProperty(value = "客户标签id数组") |
|||
private List<Long> ids; |
|||
} |
@ -0,0 +1,34 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 获取标签列表请求 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "LabelGetAllParam", description = "获取标签列表请求") |
|||
public class BusinessBuyerLabelGetAllParam extends PageParam { |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
@ApiModelProperty(value = "标签名称") |
|||
private String labelName; |
|||
|
|||
/** |
|||
* 标签类型 1-手动标签 2-自动标签 |
|||
*/ |
|||
@ApiModelProperty(value = "标签类型 1-手动标签 2-自动标签") |
|||
private Integer labelType; |
|||
|
|||
@ApiModelProperty(value = "商家id") |
|||
private Long businessId; |
|||
} |
@ -0,0 +1,24 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 获取标签详情 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "LabelGetByIdParam", description = "获取标签详情") |
|||
public class BusinessBuyerLabelGetByIdParam { |
|||
|
|||
/** |
|||
* 客户标签id |
|||
*/ |
|||
@ApiModelProperty(value = "客户标签id") |
|||
private Long buyerLabelId; |
|||
} |
@ -0,0 +1,152 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.shop.cereshop.commons.utils.EmptyUtils; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 添加标签请求 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "LabelSaveParam", description = "添加标签请求") |
|||
public class BusinessBuyerLabelSaveParam { |
|||
|
|||
/** |
|||
* 客户标签id |
|||
*/ |
|||
@ApiModelProperty(value = "客户标签id") |
|||
@TableId(type = IdType.AUTO) |
|||
private Long buyerLabelId; |
|||
|
|||
@ApiModelProperty(value = "客户标签所属商家id") |
|||
private Long businessId; |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
@ApiModelProperty(value = "标签名称") |
|||
@NotBlank(message = "标签名称不能为空") |
|||
private String labelName; |
|||
|
|||
/** |
|||
* 标签类型 1-手动标签 2-自动标签 |
|||
*/ |
|||
@ApiModelProperty(value = "标签类型 1-手动标签 2-自动标签") |
|||
private Integer labelType; |
|||
|
|||
/** |
|||
* 满足条件 1-满足任意一个被选中条件即可 2-必须满足所有被选中条件 |
|||
*/ |
|||
@ApiModelProperty(value = "满足条件 1-满足任意一个被选中条件即可 2-必须满足所有被选中条件") |
|||
private Integer meetConditions; |
|||
|
|||
/** |
|||
* 选中条件数组 |
|||
*/ |
|||
@ApiModelProperty(value = "选中条件数组") |
|||
private List<Integer> conditions; |
|||
|
|||
public void setConditions(List<Integer> conditions) { |
|||
if(!EmptyUtils.isEmpty(conditions)){ |
|||
if(conditions.contains(1)){ |
|||
this.lastConsumptionTime=1; |
|||
}else { |
|||
this.lastConsumptionTime=0; |
|||
} |
|||
if(conditions.contains(2)){ |
|||
this.consumptionFrequency=1; |
|||
}else { |
|||
this.consumptionFrequency=0; |
|||
} |
|||
if(conditions.contains(3)){ |
|||
this.consumptionMoney=1; |
|||
}else { |
|||
this.consumptionMoney=0; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 是否选中最后消费时间 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中最后消费时间 1-是 0-否") |
|||
private Integer lastConsumptionTime; |
|||
|
|||
/** |
|||
* 是否选中累计消费次数 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中累计消费次数 1-是 0-否") |
|||
private Integer consumptionFrequency; |
|||
|
|||
/** |
|||
* 是否选中累计交易金额 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中累计交易金额 1-是 0-否") |
|||
private Integer consumptionMoney; |
|||
|
|||
/** |
|||
* 最近几天(天) |
|||
*/ |
|||
@ApiModelProperty(value = "最近几天(天)") |
|||
private Integer consumptionDay; |
|||
|
|||
/** |
|||
* 最后消费开始时间 |
|||
*/ |
|||
@ApiModelProperty(value = "最后消费开始时间") |
|||
private String consumptionStartTime; |
|||
|
|||
/** |
|||
* 最后消费结束时间 |
|||
*/ |
|||
@ApiModelProperty(value = "最后消费结束时间") |
|||
private String consumptionEndTime; |
|||
|
|||
/** |
|||
* 起始次数 |
|||
*/ |
|||
@ApiModelProperty(value = "起始次数") |
|||
private Integer frequencyStart; |
|||
|
|||
/** |
|||
* 截止次数 |
|||
*/ |
|||
@ApiModelProperty(value = "截止次数") |
|||
private Integer frequencyEnd; |
|||
|
|||
/** |
|||
* 起始金额 |
|||
*/ |
|||
@ApiModelProperty(value = "起始金额") |
|||
private BigDecimal moneyStart; |
|||
|
|||
/** |
|||
* 截止金额 |
|||
*/ |
|||
@ApiModelProperty(value = "截止金额") |
|||
private BigDecimal moneyEnd; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@ApiModelProperty(value = "创建时间") |
|||
private String createTime; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@ApiModelProperty(value = "更新时间") |
|||
private String updateTime; |
|||
} |
@ -0,0 +1,148 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
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 = "LabelUpdateParam", description = "更新标签请求") |
|||
public class BusinessBuyerLabelUpdateParam { |
|||
|
|||
/** |
|||
* 客户标签id |
|||
*/ |
|||
@ApiModelProperty(value = "客户标签id") |
|||
private Long buyerLabelId; |
|||
|
|||
|
|||
@ApiModelProperty(value = "客户标签所属商家id") |
|||
private Long businessId; |
|||
|
|||
/** |
|||
* 标签名称 |
|||
*/ |
|||
@ApiModelProperty(value = "标签名称") |
|||
private String labelName; |
|||
|
|||
/** |
|||
* 标签类型 1-手动标签 2-自动标签 |
|||
*/ |
|||
@ApiModelProperty(value = "标签类型 1-手动标签 2-自动标签") |
|||
private Integer labelType; |
|||
|
|||
/** |
|||
* 满足条件 1-满足任意一个被选中条件即可 2-必须满足所有被选中条件 |
|||
*/ |
|||
@ApiModelProperty(value = "满足条件 1-满足任意一个被选中条件即可 2-必须满足所有被选中条件") |
|||
private Integer meetConditions; |
|||
|
|||
/** |
|||
* 选中条件数组 |
|||
*/ |
|||
@ApiModelProperty(value = "选中条件数组") |
|||
private List<Integer> conditions; |
|||
|
|||
public void setConditions(List<Integer> conditions) { |
|||
if(!EmptyUtils.isEmpty(conditions)){ |
|||
if(conditions.contains(1)){ |
|||
this.lastConsumptionTime=1; |
|||
}else { |
|||
this.lastConsumptionTime=0; |
|||
} |
|||
if(conditions.contains(2)){ |
|||
this.consumptionFrequency=1; |
|||
}else { |
|||
this.consumptionFrequency=0; |
|||
} |
|||
if(conditions.contains(3)){ |
|||
this.consumptionMoney=1; |
|||
}else { |
|||
this.consumptionMoney=0; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 是否选中最后消费时间 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中最后消费时间 1-是 0-否") |
|||
private Integer lastConsumptionTime; |
|||
|
|||
/** |
|||
* 是否选中累计消费次数 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中累计消费次数 1-是 0-否") |
|||
private Integer consumptionFrequency; |
|||
|
|||
/** |
|||
* 是否选中累计交易金额 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否选中累计交易金额 1-是 0-否") |
|||
private Integer consumptionMoney; |
|||
|
|||
/** |
|||
* 最近几天(天) |
|||
*/ |
|||
@ApiModelProperty(value = "最近几天(天)") |
|||
private Integer consumptionDay; |
|||
|
|||
/** |
|||
* 最后消费开始时间 |
|||
*/ |
|||
@ApiModelProperty(value = "最后消费开始时间") |
|||
private String consumptionStartTime; |
|||
|
|||
/** |
|||
* 最后消费结束时间 |
|||
*/ |
|||
@ApiModelProperty(value = "最后消费结束时间") |
|||
private String consumptionEndTime; |
|||
|
|||
/** |
|||
* 起始次数 |
|||
*/ |
|||
@ApiModelProperty(value = "起始次数") |
|||
private Integer frequencyStart; |
|||
|
|||
/** |
|||
* 截止次数 |
|||
*/ |
|||
@ApiModelProperty(value = "截止次数") |
|||
private Integer frequencyEnd; |
|||
|
|||
/** |
|||
* 起始金额 |
|||
*/ |
|||
@ApiModelProperty(value = "起始金额") |
|||
private BigDecimal moneyStart; |
|||
|
|||
/** |
|||
* 截止金额 |
|||
*/ |
|||
@ApiModelProperty(value = "截止金额") |
|||
private BigDecimal moneyEnd; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@ApiModelProperty(value = "创建时间") |
|||
private String createTime; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@ApiModelProperty(value = "更新时间") |
|||
private String updateTime; |
|||
} |
@ -0,0 +1,26 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.label; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 导出标签请求 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "LabelExcelParam", description = "导出标签请求") |
|||
public class LabelExcelParam { |
|||
|
|||
/** |
|||
* 标签id数组 |
|||
*/ |
|||
@ApiModelProperty(value = "标签id数组") |
|||
private List<Long> ids; |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue