新增活动模块

This commit is contained in:
panshuling321 2022-04-06 17:25:43 +08:00
parent 460dabf5df
commit a0336c24bc
41 changed files with 3106 additions and 0 deletions

View File

@ -24,6 +24,7 @@
<module>xhpc-data-big-screen</module>
<module>xhpc-workorder</module>
<module>xhpc-tenant</module>
<module>xhpc-activity</module>
<module>xhpc-log</module>
</modules>

35
xhpc-modules/xhpc-activity/.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
HELP.md
target/
.mvn/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea/
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-modules</artifactId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-activity</artifactId>
<description>
活动服务
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common Core -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.12</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,24 @@
package com.xhpc;
import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableCustomConfig
@EnableRyFeignClients
@EnableFeignClients
@SpringBootApplication
@MapperScan("com.xhpc.activity.mapper")
public class XhpcActivityApplication {
public static void main(String[] args) {
SpringApplication.run(XhpcActivityApplication.class, args);
}
}

View File

@ -0,0 +1,152 @@
package com.xhpc.activity.controller;
import com.xhpc.activity.domain.XhpcActivityCashDomain;
import com.xhpc.activity.domain.XhpcActivityRecordDomain;
import com.xhpc.activity.service.XhpcActivityCashService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/activity/cash")
public class XhpcActivityCashController extends BaseController {
@Resource
XhpcActivityCashService cashService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getPage(HttpServletRequest request,
String status) {
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("status", status);
return getDataTable(cashService.getPage(params));
}
@GetMapping("/getNameList")
public R getNameList(HttpServletRequest request) {
LoginUser loginUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
return R.ok(cashService.getNameList(params));
}
@GetMapping("/detail")
public R getDetail(@RequestParam("activityId") Integer activityId) {
return R.ok(cashService.getDomainByPk(activityId));
}
@Log(title = "活动管理-新增现金红包活动", businessType = BusinessType.INSERT)
@PostMapping("/")
public R insertDomain(HttpServletRequest request, @RequestBody XhpcActivityCashDomain domain) {
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCreateBy(loginUser.getUserid().toString());
domain.setUpdateBy(loginUser.getUserid().toString());
domain.setTenantId(loginUser.getTenantId());
return R.ok(cashService.insertDomain(domain));
}
@Log(title = "活动管理-更新现金红包活动", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public R updateDomain(HttpServletRequest request, @RequestBody XhpcActivityCashDomain domain) {
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(cashService.updateDomain(domain));
}
@Log(title = "活动管理-审核现金红包活动", businessType = BusinessType.UPDATE)
@PutMapping("/check")
public R updateDomainConfig(HttpServletRequest request, @RequestBody XhpcActivityCashDomain domain) {
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCheckBy(loginUser.getUserid().toString());
return R.ok(cashService.checkDomain(domain));
}
@Log(title = "活动管理-更新现金红包活动状态", businessType = BusinessType.UPDATE)
@PutMapping("/status")
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcActivityCashDomain domain) {
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(cashService.updateDomainStatus(domain));
}
@Log(title = "活动管理-删除现金红包活动", businessType = BusinessType.DELETE)
@DeleteMapping("/{activityId}")
public R deleteDomainByPk(@PathVariable("activityId") Integer activityId) {
return R.ok(cashService.deleteByPk(activityId));
}
@GetMapping("/userList")
public TableDataInfo getUserList(@RequestParam("activityId")Integer activityId,
@RequestParam("userType") String userType,
@RequestParam("userAccount")String userAccount,
@RequestParam("pageNum")Integer pageNum,
@RequestParam("pageSize")Integer pageSize){
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
params.put("userType", userType);
params.put("userAccount", userAccount);
params.put("pageNum", pageNum);
params.put("pageSize", pageSize);
return getDataTable(cashService.getUserList(params));
}
@Log(title = "活动管理-领取红包", businessType = BusinessType.INSERT)
@PostMapping("/receive")
public R insertCashReceive(@RequestBody XhpcActivityRecordDomain domain) {
return R.ok(cashService.insertReceiveDomain(domain));
}
@GetMapping("/getReceivePage")
public TableDataInfo getReceivePage(HttpServletRequest request,
Integer activityId) {
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("activityId", activityId);
return getDataTable(cashService.getReceivePage(params));
}
}

View File

@ -0,0 +1,122 @@
package com.xhpc.activity.controller;
import com.xhpc.activity.domain.XhpcActivityDiscountDomain;
import com.xhpc.activity.service.XhpcActivityDiscountService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/activity/discount")
public class XhpcActivityDiscountController extends BaseController {
@Resource
XhpcActivityDiscountService discountService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getPage(HttpServletRequest request,
String status){
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("status", status);
return getDataTable(discountService.getPage(params));
}
@GetMapping("/getNameList")
public R getNameList(HttpServletRequest request){
LoginUser loginUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
return R.ok(discountService.getNameList(params));
}
@GetMapping("/detail")
public R getDetail(@RequestParam("activityId")Integer activityId){
return R.ok(discountService.getDomainByPk(activityId));
}
@GetMapping("/userList")
public TableDataInfo getUserList(@RequestParam("activityId")Integer activityId,
@RequestParam("userType") String userType,
@RequestParam("userAccount")String userAccount,
@RequestParam("pageNum")Integer pageNum,
@RequestParam("pageSize")Integer pageSize){
Map<String, Object> params = new HashMap<>();
params.put("activityId", activityId);
params.put("userType", userType);
params.put("userAccount", userAccount);
params.put("pageNum", pageNum);
params.put("pageSize", pageSize);
return getDataTable(discountService.getUserList(params));
}
@Log(title = "活动管理-新增折扣活动", businessType = BusinessType.INSERT)
@PostMapping("/")
public R insertDomain(HttpServletRequest request, @RequestBody XhpcActivityDiscountDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCreateBy(loginUser.getUserid().toString());
domain.setUpdateBy(loginUser.getUserid().toString());
domain.setTenantId(loginUser.getTenantId());
return R.ok(discountService.insertDomain(domain));
}
@Log(title = "活动管理-更新折扣活动", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public R updateDomain(HttpServletRequest request, @RequestBody XhpcActivityDiscountDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(discountService.updateDomain(domain));
}
@Log(title = "活动管理-审核折扣活动", businessType = BusinessType.UPDATE)
@PutMapping("/check")
public R updateDomainConfig(HttpServletRequest request, @RequestBody XhpcActivityDiscountDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCheckBy(loginUser.getUserid().toString());
return R.ok(discountService.checkDomain(domain));
}
@Log(title = "活动管理-更新折扣活动状态", businessType = BusinessType.UPDATE)
@PutMapping("/status")
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcActivityDiscountDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(discountService.updateDomainStatus(domain));
}
@Log(title = "活动管理-删除折扣活动", businessType = BusinessType.DELETE)
@DeleteMapping("/{activityId}")
public R deleteDomainByPk(@PathVariable("activityId")Integer activityId){
return R.ok(discountService.deleteByPk(activityId));
}
}

View File

@ -0,0 +1,107 @@
package com.xhpc.activity.controller;
import com.xhpc.activity.domain.XhpcActivityInternetDomain;
import com.xhpc.activity.service.XhpcActivityInternetService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/activity/internet")
public class XhpcActivityInternetController extends BaseController {
@Resource
XhpcActivityInternetService internetService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getPage(HttpServletRequest request,
String status){
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("status", status);
return getDataTable(internetService.getPage(params));
}
@GetMapping("/getNameList")
public R getNameList(HttpServletRequest request){
LoginUser loginUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
return R.ok(internetService.getNameList(params));
}
@GetMapping("/detail")
public R getDetail(@RequestParam("activityId")Integer activityId){
return R.ok(internetService.getDomainByPk(activityId));
}
@Log(title = "活动管理-新增流量方活动", businessType = BusinessType.INSERT)
@PostMapping("/")
public R insertDomain(HttpServletRequest request, @RequestBody XhpcActivityInternetDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCreateBy(loginUser.getUserid().toString());
domain.setUpdateBy(loginUser.getUserid().toString());
domain.setTenantId(loginUser.getTenantId());
domain.setStatus(Short.valueOf("1"));
return R.ok(internetService.insertDomain(domain));
}
@Log(title = "活动管理-更新流量方活动模板", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public R updateDomain(HttpServletRequest request, @RequestBody XhpcActivityInternetDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(internetService.updateDomain(domain));
}
@Log(title = "活动管理-更新流量方活动状态", businessType = BusinessType.UPDATE)
@PutMapping("/status")
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcActivityInternetDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(internetService.updateDomainStatus(domain));
}
@Log(title = "活动管理-审核流量方活动", businessType = BusinessType.UPDATE)
@PutMapping("/check")
public R checkDomain(HttpServletRequest request, @RequestBody XhpcActivityInternetDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCheckBy(loginUser.getUserid().toString());
return R.ok(internetService.checkDomain(domain));
}
@Log(title = "活动管理-删除流量方活动", businessType = BusinessType.DELETE)
@DeleteMapping("/{activityId}")
public R deleteDomainByPk(@PathVariable("activityId")Integer activityId){
return R.ok(internetService.deleteByPk(activityId));
}
}

View File

@ -0,0 +1,96 @@
package com.xhpc.activity.controller;
import com.xhpc.activity.domain.XhpcActivityTemplateDomain;
import com.xhpc.activity.service.XhpcActivityTemplateService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/activity/template")
public class XhpcActivityTemplateController extends BaseController {
@Resource
XhpcActivityTemplateService templateService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getPage(HttpServletRequest request,
String status){
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
params.put("status", status);
return getDataTable(templateService.getPage(params));
}
@GetMapping("/getNameList")
public R getNameList(HttpServletRequest request){
LoginUser loginUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
return R.ok(templateService.getNameList(params));
}
@GetMapping("/detail")
public R getDetail(@RequestParam("templateId")Integer templateId){
return R.ok(templateService.getDomainByPk(templateId));
}
@Log(title = "活动管理-新增折扣活动模版", businessType = BusinessType.INSERT)
@PostMapping("/")
public R insertDomain(HttpServletRequest request, @RequestBody XhpcActivityTemplateDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setCreateBy(loginUser.getUserid().toString());
domain.setUpdateBy(loginUser.getUserid().toString());
domain.setTenantId(loginUser.getTenantId());
return R.ok(templateService.insertDomain(domain));
}
@Log(title = "活动管理-更新折扣活动模板", businessType = BusinessType.UPDATE)
@PutMapping("/detail")
public R updateDomain(HttpServletRequest request, @RequestBody XhpcActivityTemplateDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(templateService.updateDomain(domain));
}
@Log(title = "活动管理-更新折扣活动模板状态", businessType = BusinessType.UPDATE)
@PutMapping("/status")
public R updateDomainStatus(HttpServletRequest request, @RequestBody XhpcActivityTemplateDomain domain){
LoginUser loginUser = logUserUtils.getLogUser(request);
domain.setUpdateBy(loginUser.getUserid().toString());
return R.ok(templateService.updateDomainStatus(domain));
}
@Log(title = "活动管理-删除折扣活动模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{templateId}")
public R deleteDomainByPk(@PathVariable("templateId")Integer templateId){
return R.ok(templateService.deleteByPk(templateId));
}
}

View File

@ -0,0 +1,110 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Data;
/**
* xhpc_activity_cash
* @author
*/
@Data
public class XhpcActivityCashDomain implements Serializable {
/**
* 活动ID
*/
private Integer activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 领取次数
*/
private Integer receiveCount;
/**
* 红包金额
*/
private BigDecimal amount;
/**
* C端用户ID-1表示全部
*/
private String appUserList;
/**
* 社区用户ID列表-1表示全部
*/
private String comUserList;
/**
* B端用户ID列表-1表示全部
*/
private String cusUserList;
/**
* 租户ID
*/
private String tenantId;
/**
* 状态0-编辑1-提交待审核2-审核失败3-审核通过4-立即失效
*/
private Short status;
/**
* 删除标记0-正常2-已删除
*/
private Short delFlag;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 审核人
*/
private String checkBy;
/**
* 审核时间
*/
private Date checkTime;
private List<XhpcActivityImgDomain> checkImgList;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,119 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* xhpc_activity_discount
* @author
*/
@Data
public class XhpcActivityDiscountDomain implements Serializable {
/**
* 活动ID
*/
private Integer activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 模板ID
*/
private Integer templateId;
/**
* C端用户列表(以逗号分隔-1表示全部用户)
*/
private String appUserList;
/**
* 社区用户列表(以逗号分隔-1表示全部用户)
*/
private String comUserList;
/**
* B端用户列表(以逗号分隔-1表示全部用户)
*/
private String cusUserList;
/**
* 场站列表
*/
private String stationList;
/**
* 租户ID
*/
private String tenantId;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 状态0-编辑1-提交待审核2-审核失败3-审核通过4-立即失效
*/
private Short status = 0;
/**
* 删除标识0-正常2-删除
*/
private Short delFlag = 0;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 审核人
*/
private String checkBy;
/**
* 审核时间
*/
private Date checkTime;
private XhpcActivityTemplateDomain templateDomain;
/**
* 优惠类型1-总金额2-服务费3-电量
*/
private Short discountType;
/**
* 优惠比率
*/
private BigDecimal discountRate;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,65 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* xhpc_activity_formula
* @author
*/
@Data
public class XhpcActivityFormulaDomain implements Serializable {
/**
* 活动计算ID
*/
private Long activityFormulaId;
/**
* 活动ID
*/
private Integer activityId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
/**
* 服务费
*/
private BigDecimal servicePrice;
/**
* 计算公式
*/
private String computeFormula;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建人
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新人
*/
private String updateBy;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,54 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* xhpc_activity_img
* @author
*/
@Data
public class XhpcActivityImgDomain implements Serializable {
/**
* 图片ID
*/
private Long activityImgId;
/**
* 活动类型CASH, DISCOUNT
*/
private String activityType;
/**
* 活动ID
*/
private Integer activityId;
/**
* 图片名称
*/
private String imgName;
/**
* 图片地址
*/
private String imgUrl;
/**
* 删除标志0-正常2-已删除
*/
private Short delFlag;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,112 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import lombok.Data;
/**
* xhpc_activity_internet
* @author
*/
@Data
public class XhpcActivityInternetDomain implements Serializable {
/**
* 活动ID
*/
private Integer activityId;
/**
* 活动名称
*/
private String activityName;
/**
* 流量方名称
*/
private String internetName;
/**
* 计算类型1-总金额2-服务费3-电量
*/
private Short computeType;
/**
* 服务费
*/
private BigDecimal servicePrice;
/**
* 计算公式
*/
private String computeFormula;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 参与场站列表
*/
private String stationList;
/**
* 租户ID
*/
private String tenantId;
/**
* 状态0-编辑1-提交生效2-审核失败3-审核成功4-失效
*/
private Short status;
/**
* 删除标志0-正常2-删除
*/
private Short delFlag;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 审核人
*/
private String checkBy;
/**
* 审核时间
*/
private Date checkTime;
/**
* 分时段费用计算公式列表
*/
List<XhpcActivityFormulaDomain> formulaList;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,50 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* xhpc_activity_record
* @author
*/
@Data
public class XhpcActivityRecordDomain implements Serializable {
/**
* 活动参与记录ID
*/
private Long activityRecordId;
/**
* 活动类型CASH,DISCOUNT
*/
private String activityType;
/**
* 活动ID
*/
private Integer activityId;
/**
* 人员类型0 C端用户 1 流量方用户 2社区用户 3B端用户
*/
private Short source;
/**
* 用户ID
*/
private String userId;
/**
* 红包金额
*/
private BigDecimal amount;
/**
* 领取时间
*/
private Date createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,95 @@
package com.xhpc.activity.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* xhpc_activity_template
* @author
*/
@Data
public class XhpcActivityTemplateDomain implements Serializable {
/**
* 模板ID
*/
private Integer activityTemplateId;
/**
* 模板名称
*/
private String templateName;
/**
* 优惠类型1-总金额2-服务费3-电量
*/
private Short discountType;
/**
* 优惠比率
*/
private BigDecimal discountRate;
/**
* 开始时间
*/
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 折扣次数
*/
private Short discountCount;
/**
* 小程序弹出次数
*/
private Short miniDisplay;
/**
* 活动背景图
*/
private String backgroundUrl;
/**
* 状态0-编辑未发布,1-已发布2-已失效
*/
private Short status;
/**
* 删除标识0-正常2-删除
*/
private Short delFlag;
/**
* 租户ID
*/
private String tenantId;
/**
* 创建人
*/
private String createBy;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新人
*/
private String updateBy;
/**
* 更新时间
*/
private Date updateTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,51 @@
package com.xhpc.activity.enums;
public enum ActivityTypeEnum {
CASH("CASH", "现金活动"),
DISCOUNT("DISCOUNT", "折扣活动"),
;
private final String code;
private final String name;
ActivityTypeEnum(String code, String name){
this.code = code;
this.name = name;
}
//根据code获取name
public static String getNameByCode(String code) {
for (ActivityTypeEnum typeEnum : ActivityTypeEnum.values()) {
//移除交办
if (typeEnum.code.equals(code)) {
return typeEnum.name;
}
}
return "";
}
//根据name获取code
public static String getCodeByName(String name) {
for (ActivityTypeEnum typeEnum : ActivityTypeEnum.values()) {
//移除交办
if (typeEnum.name.equals(name)) {
return typeEnum.code;
}
}
return null;
}
public String getCode() {
return code;
}
public String getName() {
return name;
}
}

View File

@ -0,0 +1,39 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityCashDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcActivityCashMapper {
List<XhpcActivityCashDomain> selectByParams(@Param("params") Map<String, Object> params);
List<Map<String,Object>> selectNameMapList(@Param("params")Map<String, Object> params);
int deleteLogicByPrimaryKey(Integer activity_id);
int deleteByPrimaryKey(Integer activity_id);
int insert(XhpcActivityCashDomain record);
XhpcActivityCashDomain selectByPrimaryKey(Integer activity_id);
int updateByPrimaryKey(XhpcActivityCashDomain record);
int updateStatusByPrimaryKey(XhpcActivityCashDomain record);
int checkByPrimaryKey(XhpcActivityCashDomain record);
int updateReceiveCountByActivityId(XhpcActivityCashDomain record);
List<Map<String, Object>> selectAPPUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectComUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectBUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectUserListByParams(@Param("params")Map params);
}

View File

@ -0,0 +1,39 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityDiscountDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcActivityDiscountMapper {
List<XhpcActivityDiscountDomain> selectByParams(@Param("params") Map<String, Object> params);
List<Map<String,Object>> selectNameMapList(@Param("params")Map<String, Object> params);
int deleteLogicByPrimaryKey(Integer activity_id);
int deleteByPrimaryKey(Integer activity_id);
int insert(XhpcActivityDiscountDomain record);
XhpcActivityDiscountDomain selectByPrimaryKey(Integer activity_id);
int updateByPrimaryKey(XhpcActivityDiscountDomain record);
int checkByPrimaryKey(XhpcActivityDiscountDomain record);
int updateStatusByPrimaryKey(XhpcActivityDiscountDomain record);
int updateStatusByTemplateId(@Param("templateId") Integer templateId, @Param("status") Short status);
List<Map<String, Object>> selectAPPUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectComUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectBUserListByUserIds(@Param("userIds") String userIds);
List<Map<String, Object>> selectUserListByParams(@Param("params")Map params);
}

View File

@ -0,0 +1,19 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityFormulaDomain;
import java.util.List;
public interface XhpcActivityFormulaMapper {
int deleteByPrimaryKey(Long activityFormulaId);
int insert(XhpcActivityFormulaDomain record);
XhpcActivityFormulaDomain selectByPrimaryKey(Long activityFormulaId);
int updateByPrimaryKey(XhpcActivityFormulaDomain record);
List<XhpcActivityFormulaDomain> selectByActivityId(Integer activityId);
int deleteByActivityId(Integer activityId);
}

View File

@ -0,0 +1,24 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityImgDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface XhpcActivityImgMapper {
List<XhpcActivityImgDomain> selectListByActivityId(@Param("activityId") Integer activityId, @Param("activityType") String activityType);
int deleteLogicByActivityId(@Param("activityId") Integer activityId, @Param("activityType") String activityType);
int deleteLogicByPrimaryKey(Long activity_img_id);
int deleteByPrimaryKey(Long activity_img_id);
int insert(XhpcActivityImgDomain record);
XhpcActivityImgDomain selectByPrimaryKey(Long activity_img_id);
int updateByPrimaryKey(XhpcActivityImgDomain record);
}

View File

@ -0,0 +1,30 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityInternetDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcActivityInternetMapper {
List<XhpcActivityInternetDomain> selectByParams(@Param("params") Map<String, Object> params);
List<Map<String,Object>> selectNameMapList(@Param("params")Map<String, Object> params);
int deleteLogicByPrimaryKey(Integer activity_id);
int deleteByPrimaryKey(Integer activity_id);
int insert(XhpcActivityInternetDomain record);
XhpcActivityInternetDomain selectByPrimaryKey(Integer activity_id);
int updateByPrimaryKey(XhpcActivityInternetDomain record);
int updateStatusByPrimaryKey(XhpcActivityInternetDomain record);
int checkByPrimaryKey(XhpcActivityInternetDomain record);
}

View File

@ -0,0 +1,29 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityRecordDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcActivityRecordMapper {
XhpcActivityRecordDomain selectByActivityAndUser(@Param("activityType") String activityType,
@Param("activityId") Integer activityId,
@Param("userId") String userId);
List<XhpcActivityRecordDomain> selectByActivity(@Param("activityType") String activityType,
@Param("activityId") Integer activityId);
List<Map<String, Object>> selectByParams(@Param("params") Map<String, Object> params);
int deleteLogicByPrimaryKey(Long activity_record_id);
int deleteByPrimaryKey(Long activity_record_id);
int insert(XhpcActivityRecordDomain record);
XhpcActivityRecordDomain selectByPrimaryKey(Long activity_record_id);
int updateByPrimaryKey(XhpcActivityRecordDomain record);
}

View File

@ -0,0 +1,26 @@
package com.xhpc.activity.mapper;
import com.xhpc.activity.domain.XhpcActivityTemplateDomain;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface XhpcActivityTemplateMapper {
List<XhpcActivityTemplateDomain> selectByParams(@Param("params") Map<String, Object> params);
List<Map<String,Object>> selectNameMapList(@Param("params")Map<String, Object> params);
int deleteLogicByPrimaryKey(Integer activity_temlpate_id);
int deleteByPrimaryKey(Integer activity_temlpate_id);
int insert(XhpcActivityTemplateDomain record);
XhpcActivityTemplateDomain selectByPrimaryKey(Integer activity_temlpate_id);
int updateByPrimaryKey(XhpcActivityTemplateDomain record);
int updateStatusByPrimaryKey(XhpcActivityTemplateDomain record);
}

View File

@ -0,0 +1,34 @@
package com.xhpc.activity.service;
import com.xhpc.activity.domain.XhpcActivityCashDomain;
import com.xhpc.activity.domain.XhpcActivityRecordDomain;
import java.util.List;
import java.util.Map;
public interface XhpcActivityCashService {
List<XhpcActivityCashDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getNameList(Map<String, Object> params);
XhpcActivityCashDomain getDomainByPk(Integer activityId);
boolean insertDomain(XhpcActivityCashDomain domain);
boolean updateDomain(XhpcActivityCashDomain domain);
boolean checkDomain(XhpcActivityCashDomain domain);
boolean updateDomainStatus(XhpcActivityCashDomain domain);
boolean deleteByPk(Integer activityId);
List<Map<String, Object>> getUserList(Map<String, Object> params);
// ---------- 红包领取 --------
boolean insertReceiveDomain(XhpcActivityRecordDomain domain);
List<Map<String, Object>> getReceivePage(Map<String, Object> params);
}

View File

@ -0,0 +1,27 @@
package com.xhpc.activity.service;
import com.xhpc.activity.domain.XhpcActivityDiscountDomain;
import java.util.List;
import java.util.Map;
public interface XhpcActivityDiscountService {
List<XhpcActivityDiscountDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getNameList(Map<String, Object> params);
XhpcActivityDiscountDomain getDomainByPk(Integer activityId);
boolean insertDomain(XhpcActivityDiscountDomain domain);
boolean updateDomain(XhpcActivityDiscountDomain domain);
boolean checkDomain(XhpcActivityDiscountDomain domain);
boolean updateDomainStatus(XhpcActivityDiscountDomain domain);
boolean deleteByPk(Integer activityId);
List<Map<String, Object>> getUserList(Map<String, Object> params);
}

View File

@ -0,0 +1,25 @@
package com.xhpc.activity.service;
import com.xhpc.activity.domain.XhpcActivityInternetDomain;
import java.util.List;
import java.util.Map;
public interface XhpcActivityInternetService {
List<XhpcActivityInternetDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getNameList(Map<String, Object> params);
XhpcActivityInternetDomain getDomainByPk(Integer activityId);
boolean insertDomain(XhpcActivityInternetDomain domain);
boolean updateDomain(XhpcActivityInternetDomain domain);
boolean updateDomainStatus(XhpcActivityInternetDomain domain);
boolean checkDomain(XhpcActivityInternetDomain domain);
boolean deleteByPk(Integer activityId);
}

View File

@ -0,0 +1,23 @@
package com.xhpc.activity.service;
import com.xhpc.activity.domain.XhpcActivityTemplateDomain;
import java.util.List;
import java.util.Map;
public interface XhpcActivityTemplateService {
List<XhpcActivityTemplateDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getNameList(Map<String, Object> params);
XhpcActivityTemplateDomain getDomainByPk(Integer templateId);
boolean insertDomain(XhpcActivityTemplateDomain domain);
boolean updateDomain(XhpcActivityTemplateDomain domain);
boolean updateDomainStatus(XhpcActivityTemplateDomain domain);
boolean deleteByPk(Integer templateId);
}

View File

@ -0,0 +1,167 @@
package com.xhpc.activity.service.impl;
import com.xhpc.activity.domain.XhpcActivityCashDomain;
import com.xhpc.activity.domain.XhpcActivityImgDomain;
import com.xhpc.activity.domain.XhpcActivityRecordDomain;
import com.xhpc.activity.enums.ActivityTypeEnum;
import com.xhpc.activity.mapper.XhpcActivityCashMapper;
import com.xhpc.activity.mapper.XhpcActivityImgMapper;
import com.xhpc.activity.mapper.XhpcActivityRecordMapper;
import com.xhpc.activity.service.XhpcActivityCashService;
import com.xhpc.common.core.exception.CustomException;
import com.xhpc.common.core.web.service.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class XhpcActivityCashServiceImpl extends BaseService implements XhpcActivityCashService {
@Resource
XhpcActivityCashMapper cashMapper;
@Resource
XhpcActivityImgMapper imgMapper;
@Resource
XhpcActivityRecordMapper recordMapper;
@Override
public List<XhpcActivityCashDomain> getPage(Map<String, Object> params){
List<XhpcActivityCashDomain> domainList = cashMapper.selectByParams(params);
return domainList;
}
@Override
public List<Map<String, Object>> getNameList(Map<String, Object> params){
return cashMapper.selectNameMapList(params);
}
@Override
public XhpcActivityCashDomain getDomainByPk(Integer activityId){
XhpcActivityCashDomain domain = cashMapper.selectByPrimaryKey(activityId);
List<XhpcActivityImgDomain> checkImgList = imgMapper.selectListByActivityId(activityId, ActivityTypeEnum.CASH.getCode());
domain.setCheckImgList(checkImgList);
return domain;
}
@Override
public boolean insertDomain(XhpcActivityCashDomain domain){
cashMapper.insert(domain);
for(XhpcActivityImgDomain imgDomain: domain.getCheckImgList()){
imgDomain.setActivityType(ActivityTypeEnum.CASH.getCode());
imgDomain.setActivityId(domain.getActivityId());
imgMapper.insert(imgDomain);
}
return true;
}
@Override
public boolean updateDomain(XhpcActivityCashDomain domain){
cashMapper.updateByPrimaryKey(domain);
imgMapper.deleteLogicByActivityId(domain.getActivityId(), ActivityTypeEnum.CASH.getCode());
for(XhpcActivityImgDomain imgDomain: domain.getCheckImgList()){
imgDomain.setActivityType(ActivityTypeEnum.CASH.getCode());
imgDomain.setActivityId(domain.getActivityId());
imgMapper.insert(imgDomain);
}
return true;
}
@Override
public boolean checkDomain(XhpcActivityCashDomain domain){
return cashMapper.checkByPrimaryKey(domain) > 0;
}
@Override
public boolean updateDomainStatus(XhpcActivityCashDomain domain){
return cashMapper.updateStatusByPrimaryKey(domain) > 0;
}
@Override
public boolean deleteByPk(Integer activityId){
return cashMapper.deleteLogicByPrimaryKey(activityId) > 0;
}
@Override
public List<Map<String, Object>> getUserList(Map<String, Object> params){
XhpcActivityCashDomain cashDomain = cashMapper.selectByPrimaryKey(Integer.parseInt(params.get("activityId").toString()));
String appUserIds = "";
if(cashDomain.getAppUserList() != null){
appUserIds = cashDomain.getAppUserList();
}
String comUserIds = "";
if(cashDomain.getComUserList() != null){
comUserIds = cashDomain.getComUserList();
}
String bUserIds = "";
if(cashDomain.getCusUserList() != null){
bUserIds = cashDomain.getCusUserList();
}
params.put("appUserIds", appUserIds);
params.put("comUserIds", comUserIds);
params.put("bUserIds", bUserIds);
startPage();
List<Map<String, Object>> userList = cashMapper.selectUserListByParams(params);
return userList;
}
// ---------- 红包领取 --------
@Override
public boolean insertReceiveDomain(XhpcActivityRecordDomain domain){
XhpcActivityCashDomain cashDomain = cashMapper.selectByPrimaryKey(domain.getActivityId());
if(cashDomain == null){
throw new CustomException("活动不存在");
}
XhpcActivityRecordDomain recordDomain = recordMapper.selectByActivityAndUser(domain.getActivityType(),
domain.getActivityId(), domain.getUserId());
if(recordDomain != null){
throw new CustomException("您已参与该活动,请勿重复领取");
}
recordMapper.insert(domain);
cashDomain.setReceiveCount(cashDomain.getReceiveCount() + 1);
cashMapper.updateReceiveCountByActivityId(cashDomain);
return true;
}
@Override
public List<Map<String, Object>> getReceivePage(Map<String, Object> params){
params.put("activityType", ActivityTypeEnum.CASH.getCode());
return recordMapper.selectByParams(params);
}
}

View File

@ -0,0 +1,123 @@
package com.xhpc.activity.service.impl;
import com.xhpc.activity.domain.XhpcActivityDiscountDomain;
import com.xhpc.activity.domain.XhpcActivityTemplateDomain;
import com.xhpc.activity.mapper.XhpcActivityDiscountMapper;
import com.xhpc.activity.mapper.XhpcActivityTemplateMapper;
import com.xhpc.activity.service.XhpcActivityDiscountService;
import com.xhpc.common.core.exception.CustomException;
import com.xhpc.common.core.web.service.BaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class XhpcActivityDiscountServiceImpl extends BaseService implements XhpcActivityDiscountService {
@Resource
XhpcActivityDiscountMapper discountMapper;
@Resource
XhpcActivityTemplateMapper templateMapper;
@Override
public List<XhpcActivityDiscountDomain> getPage(Map<String, Object> params){
return discountMapper.selectByParams(params);
}
@Override
public List<Map<String, Object>> getNameList(Map<String, Object> params){
return discountMapper.selectNameMapList(params);
}
@Override
public XhpcActivityDiscountDomain getDomainByPk(Integer activityId) {
XhpcActivityDiscountDomain discountDomain = discountMapper.selectByPrimaryKey(activityId);
discountDomain.setTemplateDomain(templateMapper.selectByPrimaryKey(discountDomain.getTemplateId()));
return discountDomain;
}
@Override
public boolean insertDomain(XhpcActivityDiscountDomain domain){
XhpcActivityTemplateDomain templateDomain = templateMapper.selectByPrimaryKey(domain.getTemplateId());
if(templateDomain == null){
throw new CustomException("折扣模版不存在");
}
if(templateDomain.getStatus() != 0){
throw new CustomException("折扣模版不能重复发布");
}
discountMapper.insert(domain);
templateDomain.setStatus(Short.valueOf("1"));
templateDomain.setUpdateBy(domain.getCheckBy());
templateMapper.updateStatusByPrimaryKey(templateDomain);
return true;
}
@Override
public boolean updateDomain(XhpcActivityDiscountDomain domain){
return discountMapper.updateByPrimaryKey(domain) > 0;
}
@Override
public boolean checkDomain(XhpcActivityDiscountDomain domain){
return discountMapper.checkByPrimaryKey(domain) > 0;
}
@Override
public boolean updateDomainStatus(XhpcActivityDiscountDomain domain){
return discountMapper.updateStatusByPrimaryKey(domain) > 0;
}
@Override
public boolean deleteByPk(Integer activityId){
return discountMapper.deleteLogicByPrimaryKey(activityId) > 0;
}
@Override
public List<Map<String, Object>> getUserList(Map<String, Object> params){
XhpcActivityDiscountDomain discountDomain = discountMapper.selectByPrimaryKey(Integer.parseInt(params.get("activityId").toString()));
String appUserIds = "";
if(discountDomain.getAppUserList() != null){
appUserIds = discountDomain.getAppUserList();
}
String comUserIds = "";
if(discountDomain.getComUserList() != null){
comUserIds = discountDomain.getComUserList();
}
String bUserIds = "";
if(discountDomain.getCusUserList() != null){
bUserIds = discountDomain.getCusUserList();
}
params.put("appUserIds", appUserIds);
params.put("comUserIds", comUserIds);
params.put("bUserIds", bUserIds);
startPage();
List<Map<String, Object>> userList = discountMapper.selectUserListByParams(params);
return userList;
}
}

View File

@ -0,0 +1,95 @@
package com.xhpc.activity.service.impl;
import com.xhpc.activity.domain.XhpcActivityFormulaDomain;
import com.xhpc.activity.domain.XhpcActivityInternetDomain;
import com.xhpc.activity.mapper.XhpcActivityFormulaMapper;
import com.xhpc.activity.mapper.XhpcActivityInternetMapper;
import com.xhpc.activity.service.XhpcActivityInternetService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class XhpcActivityInternetServiceImpl implements XhpcActivityInternetService {
@Resource
XhpcActivityInternetMapper internetMapper;
@Resource
XhpcActivityFormulaMapper formulaMapper;
@Override
public List<XhpcActivityInternetDomain> getPage(Map<String, Object> params) {
return internetMapper.selectByParams(params);
}
@Override
public List<Map<String, Object>> getNameList(Map<String, Object> params) {
return internetMapper.selectNameMapList(params);
}
@Override
public XhpcActivityInternetDomain getDomainByPk(Integer activityId) {
XhpcActivityInternetDomain domain = internetMapper.selectByPrimaryKey(activityId);
domain.setFormulaList(formulaMapper.selectByActivityId(activityId));
return domain;
}
@Override
public boolean insertDomain(XhpcActivityInternetDomain domain) {
internetMapper.insert(domain);
for (XhpcActivityFormulaDomain formulaDomain : domain.getFormulaList()) {
formulaDomain.setActivityId(domain.getActivityId());
formulaDomain.setCreateBy(domain.getCreateBy());
formulaDomain.setUpdateBy(domain.getUpdateBy());
formulaMapper.insert(formulaDomain);
}
return true;
}
@Override
public boolean updateDomain(XhpcActivityInternetDomain domain) {
internetMapper.updateByPrimaryKey(domain);
formulaMapper.deleteByActivityId(domain.getActivityId());
for (XhpcActivityFormulaDomain formulaDomain : domain.getFormulaList()) {
formulaDomain.setActivityId(domain.getActivityId());
formulaDomain.setCreateBy(domain.getCreateBy());
formulaDomain.setUpdateBy(domain.getUpdateBy());
formulaMapper.insert(formulaDomain);
}
return true;
}
@Override
public boolean updateDomainStatus(XhpcActivityInternetDomain domain) {
return internetMapper.updateStatusByPrimaryKey(domain) > 0;
}
@Override
public boolean checkDomain(XhpcActivityInternetDomain domain){
return internetMapper.checkByPrimaryKey(domain) > 0;
}
@Override
public boolean deleteByPk(Integer activityId) {
return internetMapper.deleteLogicByPrimaryKey(activityId) > 0;
}
}

View File

@ -0,0 +1,70 @@
package com.xhpc.activity.service.impl;
import com.xhpc.activity.domain.XhpcActivityTemplateDomain;
import com.xhpc.activity.mapper.XhpcActivityDiscountMapper;
import com.xhpc.activity.mapper.XhpcActivityTemplateMapper;
import com.xhpc.activity.service.XhpcActivityTemplateService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
@Transactional
public class XhpcActivityTemplateServiceImpl implements XhpcActivityTemplateService {
@Resource
XhpcActivityTemplateMapper templateMapper;
@Resource
XhpcActivityDiscountMapper discountMapper;
@Override
public List<XhpcActivityTemplateDomain> getPage(Map<String, Object> params){
return templateMapper.selectByParams(params);
}
@Override
public List<Map<String, Object>> getNameList(Map<String, Object> params){
return templateMapper.selectNameMapList(params);
}
@Override
public XhpcActivityTemplateDomain getDomainByPk(Integer templateId) {
return templateMapper.selectByPrimaryKey(templateId);
}
@Override
public boolean insertDomain(XhpcActivityTemplateDomain domain){
return templateMapper.insert(domain) > 0;
}
@Override
public boolean updateDomain(XhpcActivityTemplateDomain domain){
return templateMapper.updateByPrimaryKey(domain) > 0;
}
@Override
public boolean updateDomainStatus(XhpcActivityTemplateDomain domain){
if(domain.getStatus() == 2){
discountMapper.updateStatusByTemplateId(domain.getActivityTemplateId(), Short.valueOf("4"));
}
return templateMapper.updateStatusByPrimaryKey(domain) > 0;
}
@Override
public boolean deleteByPk(Integer templateId){
return templateMapper.deleteLogicByPrimaryKey(templateId) > 0;
}
}

View File

@ -0,0 +1,8 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
__ ___ _ ____ ____ _ ____ _____ _____ _____ _______ __
\ \/ / | | | _ \ / ___| / \ / ___|_ _|_ _\ \ / /_ _|_ _\ \ / /
\ /| |_| | |_) | | / _ \| | | | | | \ \ / / | | | | \ V /
/ \| _ | __/| |___ / ___ \ |___ | | | | \ V / | | | | | |
/_/\_\_| |_|_| \____| /_/ \_\____| |_| |___| \_/ |___| |_| |_|

View File

@ -0,0 +1,30 @@
# Tomcat
server:
port: 8912
# Spring
spring:
application:
# 应用名称
name: xhpc-activity
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
root: info
com.xhpc.activity.mapper: debug

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/xhpc-activity"/>
<!-- 日志输出格式 -->
<property name="log.pattern"
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xhpc" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityCashMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityCashDomain">
<id column="activity_id" jdbcType="INTEGER" property="activityId" />
<result column="activity_name" jdbcType="VARCHAR" property="activityName" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="receive_count" jdbcType="INTEGER" property="receiveCount" />
<result column="app_user_list" jdbcType="VARCHAR" property="appUserList" />
<result column="com_user_list" jdbcType="VARCHAR" property="comUserList" />
<result column="cus_user_list" jdbcType="VARCHAR" property="cusUserList" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="check_by" jdbcType="VARCHAR" property="checkBy" />
<result column="check_time" jdbcType="TIMESTAMP" property="checkTime" />
</resultMap>
<sql id="Base_Column_List">
activity_id, activity_name, start_time, end_time, receive_count, amount, app_user_list, com_user_list, cus_user_list,
tenant_id, `status`, del_flag, create_by, create_time, update_by, update_time, check_by,
check_time
</sql>
<select id="selectByParams" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_cash
where del_flag=0
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
<if test="params.status!=null and params.status !=''">
and status=#{params.status}
</if>
</select>
<select id="selectNameMapList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
activity_id as 'activityId',
activity_name as 'activityName'
from xhpc_activity_cash
where del_flag=0 and status = 3
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_cash
where activity_id = #{activityId,jdbcType=INTEGER}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Integer">
update xhpc_activity_cash set del_flag=2
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from xhpc_activity_cash
where activity_id = #{activityId,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="activity_id" keyProperty="activityId" parameterType="com.xhpc.activity.domain.XhpcActivityCashDomain" useGeneratedKeys="true">
insert into xhpc_activity_cash (start_time, end_time, amount, receive_count,
app_user_list, com_user_list, cus_user_list,
tenant_id, `status`, del_flag,
create_by, create_time, update_by,
update_time, check_by, check_time
)
values (#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{amount,jdbcType=DECIMAL}, 0,
#{appUserList,jdbcType=VARCHAR}, #{comUserList,jdbcType=VARCHAR}, #{cusUserList,jdbcType=VARCHAR},
#{tenantId,jdbcType=VARCHAR}, 1, 0,
#{createBy,jdbcType=VARCHAR}, sysdate(), #{updateBy,jdbcType=VARCHAR},
sysdate(), null, null
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityCashDomain">
update xhpc_activity_cash
set start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
amount = #{amount,jdbcType=DECIMAL},
app_user_list = #{appUserList,jdbcType=VARCHAR},
com_user_list = #{comUserList,jdbcType=VARCHAR},
cus_user_list = #{cusUserList,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityCashDomain">
update xhpc_activity_cash
set `status` = #{status,jdbcType=SMALLINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="checkByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityCashDomain">
update xhpc_activity_cash
set `status` = #{status,jdbcType=SMALLINT},
check_by = #{checkBy,jdbcType=VARCHAR},
check_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="updateReceiveCountByActivityId">
update xhpc_activity_cash
set receive_count = #{receiveCount}
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<select id="selectAPPUserListByUserIds" resultType="java.util.Map">
SELECT 'C端用户' as 'userType', phone as 'usreAccount' from xhpc_app_user
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(app_user_id, #{userIds})
</if>
</select>
<select id="selectComUserListByUserIds" resultType="java.util.Map">
SELECT '社区用户' as 'userType', account as 'usreAccount' from xhpc_community_personnel
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(community_personnel_id, #{userIds})
</if>
</select>
<select id="selectBUserListByUserIds" resultType="java.util.Map">
SELECT 'B端用户' as 'userType', account as 'usreAccount' from xhpc_customers_personnel
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(customers_personnel_id, #{userIds})
</if>
</select>
<select id="selectUserListByParams" resultType="java.util.Map">
select us.* from (
SELECT app_user_id as 'userId','C端用户' AS 'userType', phone AS 'userAccount' FROM xhpc_app_user where del_flag=0 and status=0
UNION ALL
( SELECT community_personnel_id as 'userId' ,'社区用户' AS 'userType', account AS 'userAccount' FROM xhpc_community_personnel WHERE del_flag = 0 AND STATUS = 0 )
UNION ALL
( SELECT customers_personnel_id as 'userId' ,'B端用户' AS 'userType', account AS 'userAccount' FROM xhpc_customers_personnel WHERE del_flag = 0 AND STATUS = 0 )
) us
where
((us.userType='C端用户'
<if test="params.appUserIds !='-1'">
and find_in_set(us.userId, #{params.appUserIds})
</if>
)
or (us.userType='社区用户'
<if test="params.comUserIds !='-1'">
and find_in_set(us.userId, #{params.comUserIds})
</if>
)
or (us.userType='B端用户'
<if test="params.bUserIds !='-1'">
and find_in_set(us.userId, #{params.bUserIds})
</if>
))
<if test="params.userType != null and params.userType !=''">
and us.userType=#{params.userType}
</if>
<if test="params.userAccount != null and params.userAccount !=''">
and us.userAccount=#{params.userAccount}
</if>
</select>
</mapper>

View File

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityDiscountMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityDiscountDomain">
<id column="activity_id" jdbcType="INTEGER" property="activityId"/>
<result column="activity_name" jdbcType="VARCHAR" property="activityName"/>
<result column="template_id" jdbcType="INTEGER" property="templateId"/>
<result column="app_user_list" jdbcType="VARCHAR" property="appUserList"/>
<result column="com_user_list" jdbcType="VARCHAR" property="comUserList"/>
<result column="cus_user_list" jdbcType="VARCHAR" property="cusUserList"/>
<result column="station_list" jdbcType="VARCHAR" property="stationList"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
<result column="del_flag" jdbcType="SMALLINT" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="check_by" jdbcType="VARCHAR" property="checkBy"/>
<result column="check_time" jdbcType="TIMESTAMP" property="checkTime"/>
</resultMap>
<sql id="Base_Column_List">
ad.activity_id, ad.activity_name, ad.template_id, ad.app_user_list, ad.com_user_list, ad.cus_user_list,
ad.station_list,ad.tenant_id, ad.start_time, ad.end_time,
ad.`status`, ad.del_flag, ad.create_by, ad.create_time, ad.update_by, ad.update_time, ad.check_by, ad.check_time
</sql>
<select id="selectByParams" parameterType="java.lang.Integer"
resultType="com.xhpc.activity.domain.XhpcActivityDiscountDomain">
select
<include refid="Base_Column_List"/>,
att.discount_type, att.discount_rate
from xhpc_activity_discount ad
left join xhpc_activity_template att on att.activity_template_id=ad.template_id
where ad.del_flag=0
<if test="params.tenantId!= null and params.tenantId!=''">
and ad.tenant_id=#{params.tenantId}
</if>
<if test="params.status!= null and params.status!=''">
and ad.status=#{params.status}
</if>
</select>
<select id="selectNameMapList" parameterType="java.lang.Integer" resultType="java.util.Map">
select
activity_id as 'activityId',
activity_name as 'activityName'
from xhpc_activity_discount
where del_flag=0 and status=3
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_discount ad
where ad.activity_id = #{activityId,jdbcType=INTEGER}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Integer">
update xhpc_activity_discount
set del_flag=2
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from xhpc_activity_discount
where activity_id = #{activityId,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="activity_id" keyProperty="activityId"
parameterType="com.xhpc.activity.domain.XhpcActivityDiscountDomain" useGeneratedKeys="true">
insert into xhpc_activity_discount (activity_name, template_id, app_user_list, com_user_list, cus_user_list,
station_list, tenant_id, `status`, start_time, end_time,
del_flag, create_by, create_time,
update_by, update_time,
check_by, check_time)
values (#{activityName, jdbcType=VARCHAR}, #{templateId, jdbcType=INTEGER}, #{appUserList,jdbcType=VARCHAR},
#{comUserList,jdbcType=VARCHAR}, #{cusUserList,jdbcType=VARCHAR},
#{stationList,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT},
#{startTime, jdbcType=TIMESTAMP}, #{endTime, jdbcType=TIMESTAMP},
0, #{createBy,jdbcType=VARCHAR}, sysdate(),
#{updateBy,jdbcType=VARCHAR}, sysdate(), null, null)
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityDiscountDomain">
update xhpc_activity_discount
set activity_name = #{activityName,jdbcType=VARCHAR},
app_user_list = #{appUserList,jdbcType=VARCHAR},
com_user_list = #{comUserList,jdbcType=VARCHAR},
cus_user_list = #{cusUserList,jdbcType=VARCHAR},
station_list = #{stationList,jdbcType=VARCHAR},
start_time = #{startTime, jdbcType=TIMESTAMP},
end_time = #{endTime, jdbcType=TIMESTAMP},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="checkByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityDiscountDomain">
update xhpc_activity_discount
set `status` = #{status,jdbcType=SMALLINT},
check_by = #{checkBy,jdbcType=VARCHAR},
check_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityCashDomain">
update xhpc_activity_discount
set `status` = #{status,jdbcType=SMALLINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="updateStatusByTemplateId">
update xhpc_activity_discount
set status=#{status}
where status = 3
and template_id = #{templateId}
</update>
<select id="selectAPPUserListByUserIds" resultType="java.util.Map">
SELECT 'C端用户' as 'userType', phone as 'usreAccount' from xhpc_app_user
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(app_user_id, #{userIds})
</if>
</select>
<select id="selectComUserListByUserIds" resultType="java.util.Map">
SELECT '社区用户' as 'userType', account as 'usreAccount' from xhpc_community_personnel
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(community_personnel_id, #{userIds})
</if>
</select>
<select id="selectBUserListByUserIds" resultType="java.util.Map">
SELECT 'B端用户' as 'userType', account as 'usreAccount' from xhpc_customers_personnel
where del_flag=0 and status=0
<if test="userIds!=null and userIds!=''">
and find_in_set(customers_personnel_id, #{userIds})
</if>
</select>
<select id="selectUserListByParams" resultType="java.util.Map">
select us.* from (
SELECT app_user_id as 'userId','C端用户' AS 'userType', phone AS 'userAccount' FROM xhpc_app_user where del_flag=0 and status=0
UNION ALL
( SELECT community_personnel_id as 'userId' ,'社区用户' AS 'userType', account AS 'userAccount' FROM xhpc_community_personnel WHERE del_flag = 0 AND STATUS = 0 )
UNION ALL
( SELECT customers_personnel_id as 'userId' ,'B端用户' AS 'userType', account AS 'userAccount' FROM xhpc_customers_personnel WHERE del_flag = 0 AND STATUS = 0 )
) us
where
((us.userType='C端用户'
<if test="params.appUserIds !='-1'">
and find_in_set(us.userId, #{params.appUserIds})
</if>
)
or (us.userType='社区用户'
<if test="params.comUserIds !='-1'">
and find_in_set(us.userId, #{params.comUserIds})
</if>
)
or (us.userType='B端用户'
<if test="params.bUserIds !='-1'">
and find_in_set(us.userId, #{params.bUserIds})
</if>
))
<if test="params.userType != null and params.userType !=''">
and us.userType=#{params.userType}
</if>
<if test="params.userAccount != null and params.userAccount !=''">
and us.userAccount=#{params.userAccount}
</if>
</select>
</mapper>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityFormulaMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityFormulaDomain">
<id column="activity_formula_id" jdbcType="BIGINT" property="activityFormulaId"/>
<result column="activity_id" jdbcType="INTEGER" property="activityId"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="service_price" javaType="DECIMAL" property="servicePrice"/>
<result column="compute_formula" jdbcType="VARCHAR" property="computeFormula"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
</resultMap>
<sql id="Base_Column_List">
activity_formula_id
, activity_id, start_time, end_time, service_price, compute_formula, create_time,
create_by, update_time, update_by
</sql>
<select id="selectByActivityId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_formula
where activity_id = #{activityId}
</select>
<delete id="deleteByActivityId">
delete
from xhpc_activity_formula
where activity_id = #{activityId}
</delete>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_formula
where activity_formula_id = #{activityFormulaId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_activity_formula
where activity_formula_id = #{activityFormulaId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="activity_formula_id" keyProperty="activityFormulaId"
parameterType="com.xhpc.activity.domain.XhpcActivityFormulaDomain" useGeneratedKeys="true">
insert into xhpc_activity_formula (activity_id, start_time, end_time,
service_price, compute_formula, create_time, create_by,
update_time, update_by)
values (#{activityId,jdbcType=INTEGER}, #{startTime}, #{endTime},
#{servicePrice}, #{computeFormula,jdbcType=VARCHAR}, sysdate(), #{createBy,jdbcType=VARCHAR},
sysdate(), #{updateBy,jdbcType=VARCHAR})
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityFormulaDomain">
update xhpc_activity_formula
set activity_id = #{activityId,jdbcType=INTEGER},
start_time = #{startTime},
end_time = #{endTime},
service_price = #{servicePrice},
compute_formula = #{computeFormula,jdbcType=VARCHAR},
update_time = sysdate(),
update_by = #{updateBy,jdbcType=VARCHAR}
where activity_formula_id = #{activityComputeId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityImgMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityImgDomain">
<id column="activity_img_id" jdbcType="BIGINT" property="activityImgId" />
<result column="activity_type" jdbcType="VARCHAR" property="activityType" />
<result column="activity_id" jdbcType="INTEGER" property="activityId" />
<result column="img_name" jdbcType="VARCHAR" property="imgName" />
<result column="img_url" jdbcType="VARCHAR" property="imgUrl" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
activity_img_id, activity_type, activity_id, img_name, img_url, del_flag, create_by,
create_time
</sql>
<select id="selectListByActivityId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_img
where del_flag = 0 and activity_type=#{activityType} and activity_id=#{activityId}
</select>
<update id="deleteLogicByActivityId">
update xhpc_activity_img set del_flag=2
where activity_type=#{activityType} and activity_id=#{activityId}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_img
where activity_img_id = #{activityImgId,jdbcType=BIGINT}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Long">
update xhpc_activity_img set del_flag=2
where activity_img_id = #{activityImgId,jdbcType=BIGINT}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from xhpc_activity_img
where activity_img_id = #{activityImgId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="activity_img_id" keyProperty="activityImgId" parameterType="com.xhpc.activity.domain.XhpcActivityImgDomain" useGeneratedKeys="true">
insert into xhpc_activity_img (activity_type, activity_id, img_name,
img_url, del_flag, create_by,
create_time)
values (#{activityType,jdbcType=VARCHAR}, #{activityId,jdbcType=INTEGER}, #{imgName,jdbcType=VARCHAR},
#{imgUrl,jdbcType=VARCHAR}, 0, #{createBy,jdbcType=VARCHAR},
sysdate())
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityImgDomain">
update xhpc_activity_img
set activity_type = #{activityType,jdbcType=VARCHAR},
activity_id = #{activityId,jdbcType=INTEGER},
img_name = #{imgName,jdbcType=VARCHAR},
img_url = #{imgUrl,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = sysdate()
where activity_img_id = #{activityImgId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityInternetMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityInternetDomain">
<id column="activity_id" jdbcType="INTEGER" property="activityId"/>
<result column="activity_name" jdbcType="VARCHAR" property="activityName"/>
<result column="internet_name" jdbcType="VARCHAR" property="internetName"/>
<result column="compute_type" jdbcType="SMALLINT" property="computeType"/>
<result column="service_price" javaType="DECIMAL" property="servicePrice"/>
<result column="compute_formula" jdbcType="VARCHAR" property="computeFormula"/>
<result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
<result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
<result column="station_list" jdbcType="VARCHAR" property="stationList"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
<result column="del_flag" jdbcType="SMALLINT" property="delFlag"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="check_by" jdbcType="VARCHAR" property="checkBy"/>
<result column="check_time" jdbcType="TIMESTAMP" property="checkTime"/>
</resultMap>
<sql id="Base_Column_List">
activity_id
, activity_name, internet_name, compute_type, service_price, compute_formula, start_time,
end_time, station_list, tenant_id, `status`, del_flag, create_by, create_time, update_by,
update_time, check_by, check_time
</sql>
<select id="selectByParams" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_internet
where del_flag=0
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
<if test="params.status!= null and params.status!=''">
and status=#{params.status}
</if>
</select>
<select id="selectNameMapList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
activity_id as 'activityId',
activity_name as 'activityName'
from xhpc_activity_internet
where del_flag=0 and status=1
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_activity_internet
where activity_id = #{activityId,jdbcType=INTEGER}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Integer">
update xhpc_activity_internet
set del_flag=2
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from xhpc_activity_internet
where activity_id = #{activityId,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="activity_id" keyProperty="activityId"
parameterType="com.xhpc.activity.domain.XhpcActivityInternetDomain" useGeneratedKeys="true">
insert into xhpc_activity_internet (activity_name, internet_name, compute_type,
service_price, compute_formula, start_time, end_time,
station_list, tenant_id, `status`,
del_flag, create_by, create_time,
update_by, update_time, check_by, check_time)
values (#{activityName,jdbcType=VARCHAR}, #{internetName,jdbcType=VARCHAR}, #{computeType,jdbcType=SMALLINT},
#{servicePrice}, #{computeFormula,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP},
#{endTime,jdbcType=TIMESTAMP},
#{stationList,jdbcType=VARCHAR}, #{tenantId,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT},
0, #{createBy,jdbcType=VARCHAR}, sysdate(),
#{updateBy,jdbcType=VARCHAR}, sysdate(), null, null)
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityInternetDomain">
update xhpc_activity_internet
set activity_name = #{activityName,jdbcType=VARCHAR},
internet_name = #{internetName,jdbcType=VARCHAR},
compute_type = #{computeType,jdbcType=SMALLINT},
service_price = #{servicePrice},
compute_formula = #{computeFormula,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
station_list = #{stationList,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityInternetDomain">
update xhpc_activity_internet
set `status` = #{status,jdbcType=SMALLINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
<update id="checkByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityInternetDomain">
update xhpc_activity_internet
set `status` = #{status,jdbcType=SMALLINT},
check_by = #{updateBy,jdbcType=VARCHAR},
check_time = sysdate()
where activity_id = #{activityId,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityRecordMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityRecordDomain">
<id column="activity_record_id" jdbcType="BIGINT" property="activityRecordId" />
<result column="activity_type" jdbcType="VARCHAR" property="activityType" />
<result column="activity_id" jdbcType="INTEGER" property="activityId" />
<result column="source" jdbcType="SMALLINT" property="source" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="amount" jdbcType="DECIMAL" property="amount" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap>
<sql id="Base_Column_List">
activity_record_id, activity_type, activity_id, `source`, user_id, amount, create_time
</sql>
<select id="selectByActivityAndUser" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_record
where activity_type=#{activityType} and activity_id=#{activityId} and user_id=#{userId}
</select>
<select id="selectByActivity" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_record
where activity_type=#{activityType} and activity_id=#{activityId}
</select>
<select id="selectByParams" resultType="java.util.Map">
select
ar.activity_record_id as 'activityRecordId',
ar.activity_type as 'activityType',
ar.activity_id as 'activityId',
ar.source,
ar.user_id as 'userId',
ar.amount,
ar.create_time as 'createTime',
us.userAccount
from xhpc_activity_record ar
left join (SELECT app_user_id as 'userId','0' AS 'userType', phone AS 'userAccount' FROM xhpc_app_user where del_flag=0 and status=0
UNION ALL
( SELECT community_personnel_id as 'userId' ,'2' AS 'userType', account AS 'userAccount' FROM xhpc_community_personnel WHERE del_flag = 0 AND STATUS = 0 )
UNION ALL
( SELECT customers_personnel_id as 'userId' ,'3' AS 'userType', account AS 'userAccount' FROM xhpc_customers_personnel WHERE del_flag = 0 AND STATUS = 0 )
) us on us.userId=ar.user_id and us.userType=ar.source
<where>
<if test="params.activityType != null and params.activityType!=''">
and ar.activity_type=#{params.activityType}
</if>
<if test="params.activityId != null and params.activityId!=''">
and ar.activity_id=#{params.activityId}
</if>
</where>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_record
where activity_record_id = #{activityRecordId,jdbcType=BIGINT}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Long">
update xhpc_activity_record set del_flag=2
where activity_record_id = #{activityRecordId,jdbcType=BIGINT}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from xhpc_activity_record
where activity_record_id = #{activityRecordId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="activity_record_id" keyProperty="activityRecordId" parameterType="com.xhpc.activity.domain.XhpcActivityRecordDomain" useGeneratedKeys="true">
insert into xhpc_activity_record (activity_type, activity_id, `source`,
user_id, amount, create_time
)
values (#{activityType,jdbcType=VARCHAR}, #{activityId,jdbcType=INTEGER}, #{source,jdbcType=SMALLINT},
#{userId,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL}, sysdate()
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityRecordDomain">
update xhpc_activity_record
set activity_type = #{activityType,jdbcType=VARCHAR},
activity_id = #{activityId,jdbcType=INTEGER},
`source` = #{source,jdbcType=SMALLINT},
user_id = #{userId,jdbcType=VARCHAR},
amount = #{amount,jdbcType=DECIMAL},
create_time = sysdate()
where activity_record_id = #{activityRecordId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.activity.mapper.XhpcActivityTemplateMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcActivityTemplateDomain">
<id column="activity_template_id" jdbcType="INTEGER" property="activityTemplateId" />
<result column="template_name" jdbcType="VARCHAR" property="templateName" />
<result column="discount_type" jdbcType="SMALLINT" property="discountType" />
<result column="discount_rate" jdbcType="DECIMAL" property="discountRate" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="discount_count" jdbcType="SMALLINT" property="discountCount" />
<result column="mini_display" jdbcType="SMALLINT" property="miniDisplay" />
<result column="background_url" jdbcType="VARCHAR" property="backgroundUrl" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
activity_template_id, template_name, discount_type, discount_rate, start_time, end_time,
discount_count, mini_display, background_url, `status`, del_flag, tenant_id, create_by,
create_time, update_by, update_time
</sql>
<select id="selectByParams" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_template
where del_flag=0
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
<if test="params.status!=null and params.status !=''">
and status=#{params.status}
</if>
</select>
<select id="selectNameMapList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
activity_temlpate_id as 'activityTemplateId',
template_name as 'templateName'
from xhpc_activity_template
where del_flag=0 and status=1
<if test="params.tenantId!= null and params.tenantId!=''">
and tenant_id=#{params.tenantId}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_activity_template
where activity_template_id = #{activityTemplateId}
</select>
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Integer">
update xhpc_activity_template set del_flag=2
where activity_template_id = #{activityTemplateId}
</update>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from xhpc_activity_template
where activity_template_id = #{activityTemplateId}
</delete>
<insert id="insert" keyColumn="activity_temlpate_id" keyProperty="activityTemplateId" parameterType="com.xhpc.activity.domain.XhpcActivityTemplateDomain" useGeneratedKeys="true">
insert into xhpc_activity_template (template_name, discount_type, discount_rate,
start_time, end_time, discount_count,
mini_display, background_url, `status`,
del_flag, tenant_id, create_by,
create_time, update_by, update_time
)
values (#{templateName,jdbcType=VARCHAR}, #{discountType,jdbcType=SMALLINT}, #{discountRate,jdbcType=DECIMAL},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{discountCount,jdbcType=SMALLINT},
#{miniDisplay,jdbcType=SMALLINT}, #{backgroundUrl,jdbcType=VARCHAR}, #{status,jdbcType=SMALLINT},
0, #{tenantId,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
sysdate(), #{updateBy,jdbcType=VARCHAR}, sysdate()
)
</insert>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityTemplateDomain">
update xhpc_activity_template
set template_name = #{templateName,jdbcType=VARCHAR},
discount_type = #{discountType,jdbcType=SMALLINT},
discount_rate = #{discountRate,jdbcType=DECIMAL},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
discount_count = #{discountCount,jdbcType=SMALLINT},
mini_display = #{miniDisplay,jdbcType=SMALLINT},
background_url = #{backgroundUrl,jdbcType=VARCHAR},
`status` = #{status,jdbcType=SMALLINT},
tenant_id = #{tenantId,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_template_id = #{activityTemplateId}
</update>
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcActivityTemplateDomain">
update xhpc_activity_template
set `status` = #{status,jdbcType=SMALLINT},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = sysdate()
where activity_template_id = #{activityTemplateId}
</update>
</mapper>