From 6bcb67f93848fb7b79b246589dd31ae6c52533c7 Mon Sep 17 00:00:00 2001 From: gongbiao Date: Thu, 19 Sep 2019 16:06:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E7=B3=BB=E7=BB=9F=E5=8F=91=E5=8D=A1][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9][=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../market/WxCouponPasswordController.java | 62 +++++++++++++++++++ .../market/WxCouponPresentController.java | 54 ++++++++++++++++ .../iformall/domain/po/WxCouponPassword.java | 8 ++- .../iformall/domain/po/WxCouponPresent.java | 46 ++++++++++++++ .../vo/WxCouponPasswordCountInfoVO.java | 14 +++++ .../mapper/WxCouponPasswordMapper.java | 8 ++- .../mapper/WxCouponPresentMapper.java | 13 ++++ .../service/WxCouponPasswordService.java | 13 ++-- .../service/WxCouponPresentService.java | 15 +++++ .../impl/WxCouponPasswordServiceImpl.java | 10 ++- .../impl/WxCouponPresentServiceImpl.java | 31 ++++++++++ .../mapper/WxCouponPasswordMapper.xml | 26 +++++++- .../mapper/WxCouponPresentMapper.xml | 57 +++++++++++++++++ 13 files changed, 342 insertions(+), 15 deletions(-) create mode 100644 mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java create mode 100644 mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java create mode 100644 mallinkService/src/main/java/com/iformall/domain/po/WxCouponPresent.java create mode 100644 mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordCountInfoVO.java create mode 100644 mallinkService/src/main/java/com/iformall/mapper/WxCouponPresentMapper.java create mode 100644 mallinkService/src/main/java/com/iformall/service/WxCouponPresentService.java create mode 100644 mallinkService/src/main/java/com/iformall/service/impl/WxCouponPresentServiceImpl.java create mode 100644 mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java new file mode 100644 index 000000000..ebcd99cf2 --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPasswordController.java @@ -0,0 +1,62 @@ +package com.iformall.controller.market; + +import com.github.pagehelper.PageInfo; +import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.Result; +import com.iformall.common.ResultData; +import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.BaseEntity; +import com.iformall.domain.po.WxCouponPassword; +import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; +import com.iformall.service.WxCouponPasswordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author gongbiao + */ +@RestController +@RequestMapping("couponPassword") +@Api(description = "免费卡接口") +public class WxCouponPasswordController extends BaseController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxCouponPasswordService wxCouponPasswordService; + + @ApiOperation("分页列表接口") + @GetMapping("/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + @SystemControllerLog(description = "列表") + public ResultData list(@ModelAttribute WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::list"); + wxCouponPassword.setTenantId(getTenantId()); + wxCouponPassword.setSortColumns(BaseEntity.SortField.CreateDate_DESC, BaseEntity.SortField.Id_DESC); + final PageInfo page = wxCouponPasswordService.listAsPage(wxCouponPassword, pageNum, pageSize); + return new ResultData(page); + } + + @ApiOperation("可发送卡数据") + @GetMapping("/findCouponList") + @SystemControllerLog(description = "可发送卡数据") + public ResultData findCouponList() { + logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::findCouponList"); + List voList = wxCouponPasswordService.findCouponList(getTenantId()); + return new ResultData(Result.SUCCESS, "查询成功", voList); + } + + +} diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java new file mode 100644 index 000000000..dc1d3663d --- /dev/null +++ b/mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponPresentController.java @@ -0,0 +1,54 @@ +package com.iformall.controller.market; + +import com.github.pagehelper.PageInfo; +import com.iformall.annotation.SystemControllerLog; +import com.iformall.common.ResultData; +import com.iformall.controller.base.BaseController; +import com.iformall.domain.po.BaseEntity; +import com.iformall.domain.po.WxCouponPresent; +import com.iformall.service.WxCouponPresentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * @author gongbiao + */ +@RestController +@RequestMapping("couponPrsent") +@Api(description = "卡投放接口") +public class WxCouponPresentController extends BaseController { + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + private WxCouponPresentService wxCouponPresentService; + + @ApiOperation("分页列表接口") + @GetMapping("/list") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), + @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) + @SystemControllerLog(description = "列表") + public ResultData list(@ModelAttribute WxCouponPresent wxCouponPresent, Integer pageNum, Integer pageSize) { + logger.debug("[" + getIpAddr() + "] WxCouponPresentController::list"); + wxCouponPresent.setTenantId(getTenantId()); + wxCouponPresent.setSortColumns(BaseEntity.SortField.CreateTime_DESC, BaseEntity.SortField.Id_DESC); + final PageInfo page = wxCouponPresentService.listAsPage(wxCouponPresent, pageNum, pageSize); + return new ResultData(page); + } + + @ApiOperation("根据id查询接口") + @GetMapping("/findById") + @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) + @SystemControllerLog(description = "查询") + public ResultData findById(@RequestParam Long id) { + logger.debug("[" + getIpAddr() + "] WxCouponPresentController::findById"); + return new ResultData(wxCouponPresentService.findById(id)); + } + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java index 2ea4dbab4..46266be8c 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPassword.java @@ -3,11 +3,11 @@ package com.iformall.domain.po; import lombok.Data; import lombok.EqualsAndHashCode; -import javax.persistence.*; -import java.util.*; +import javax.persistence.Id; +import javax.persistence.Table; import javax.persistence.Transient; +import java.util.Date; import java.util.List; -import javax.persistence.Id; @Table(name = "wx_coupon_password") @Data @@ -41,5 +41,7 @@ public class WxCouponPassword extends BaseEntity { @io.swagger.annotations.ApiModelProperty(value="过期时间",name="expireDate") private Date expireDate; + @Transient + private String statusStr; } diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPresent.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPresent.java new file mode 100644 index 000000000..9ceac242d --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponPresent.java @@ -0,0 +1,46 @@ +package com.iformall.domain.po; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; +import java.util.Date; +import java.util.List; + +@Table(name = "wx_coupon_present") +@Data +@EqualsAndHashCode(callSuper = true) +public class WxCouponPresent extends BaseEntity { + + @Id + protected Long id; + + @Transient + protected List ids; + + @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId") + private String tenantId; + @io.swagger.annotations.ApiModelProperty(value = "用户ID", name = "userId") + private Long userId; + @io.swagger.annotations.ApiModelProperty(value = "卡券ID", name = "couponId") + private Long couponId; + @io.swagger.annotations.ApiModelProperty(value = "卡券名称", name = "couponName") + private String couponName; + @io.swagger.annotations.ApiModelProperty(value = "手机", name = "phones") + private String phones; + @io.swagger.annotations.ApiModelProperty(value = "创建时间", name = "createDate") + private Date createTime; + @io.swagger.annotations.ApiModelProperty(value = "更新时间", name = "updateDate") + private Date updateTime; + + + @Transient + protected Date sendTimeStart; + + @Transient + protected Date sendTimeEnd; + + +} diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordCountInfoVO.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordCountInfoVO.java new file mode 100644 index 000000000..acbd15f6c --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxCouponPasswordCountInfoVO.java @@ -0,0 +1,14 @@ +package com.iformall.domain.vo; + +import lombok.Data; + +/** + * @author gongbiao + */ +@Data +public class WxCouponPasswordCountInfoVO { + + private Long couponId; + private String couponName; + private Long couponCount; +} diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java index b7338242d..72649d2a1 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponPasswordMapper.java @@ -1,8 +1,10 @@ package com.iformall.mapper; -import java.util.*; import com.iformall.common.CommonMapper; import com.iformall.domain.po.WxCouponPassword; +import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; + +import java.util.List; public interface WxCouponPasswordMapper extends CommonMapper { @@ -11,7 +13,7 @@ public interface WxCouponPasswordMapper extends CommonMapper pwdlist); int updateStatusByCouponId(Long couponId); List findCouponGroupList(WxCouponPassword wxCouponPassword); - - + + List findCouponCountInfo(WxCouponPassword wxCouponPassword); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponPresentMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponPresentMapper.java new file mode 100644 index 000000000..aefc18519 --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponPresentMapper.java @@ -0,0 +1,13 @@ +package com.iformall.mapper; + +import com.iformall.common.CommonMapper; +import com.iformall.domain.po.WxCouponPassword; +import com.iformall.domain.po.WxCouponPresent; + +import java.util.List; + +public interface WxCouponPresentMapper extends CommonMapper { + + List findList(WxCouponPresent wxCouponPresent); + +} diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java index 8cfef2b3b..1db8e8bcc 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponPasswordService.java @@ -2,6 +2,9 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; import com.iformall.domain.po.WxCouponPassword; +import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; + +import java.util.List; public interface WxCouponPasswordService { @@ -44,12 +47,8 @@ public interface WxCouponPasswordService { * @param inventory */ void mkPasswords(String tenantId, Long couponId, Integer inventory); - - - - - - - + + List findCouponList(String tenantId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponPresentService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponPresentService.java new file mode 100644 index 000000000..dfa7f8ddc --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponPresentService.java @@ -0,0 +1,15 @@ +package com.iformall.service; + +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxCouponPresent; + +/** + * @author gongbiao + */ +public interface WxCouponPresentService { + + + PageInfo listAsPage(WxCouponPresent wxCouponPresent, Integer pageNum, Integer pageSize); + + WxCouponPresent findById(Long id); +} diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java index 427898dbf..4db59340b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPasswordServiceImpl.java @@ -2,13 +2,14 @@ package com.iformall.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.iformall.common.IdWorker; import com.iformall.domain.po.WxCouponPassword; import com.iformall.enums.EnumCouponPasswordStatus; +import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; import com.iformall.mapper.WxCouponPasswordMapper; import com.iformall.service.WxCouponPasswordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.iformall.common.IdWorker; import java.util.ArrayList; import java.util.Date; @@ -49,6 +50,13 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { wxCouponPasswordMapper.deleteByPrimaryKey(id); } + @Override + public List findCouponList(String tenantId) { + WxCouponPassword wxCouponPassword = new WxCouponPassword(); + wxCouponPassword.setTenantId(tenantId); + return wxCouponPasswordMapper.findCouponCountInfo(wxCouponPassword); + } + @Override public void mkPasswords(String tenantId, Long couponId, Integer inventory) { String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPresentServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPresentServiceImpl.java new file mode 100644 index 000000000..f8396f59e --- /dev/null +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponPresentServiceImpl.java @@ -0,0 +1,31 @@ +package com.iformall.service.impl; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.iformall.domain.po.WxCouponPresent; +import com.iformall.mapper.WxCouponPresentMapper; +import com.iformall.service.WxCouponPresentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author gongbiao + */ +@Service +public class WxCouponPresentServiceImpl implements WxCouponPresentService { + + @Autowired + WxCouponPresentMapper wxCouponPresentMapper; + + + @Override + public PageInfo listAsPage(WxCouponPresent record, Integer pageIndex, Integer pageSize) { + return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPresentMapper.findList(record)); + } + + @Override + public WxCouponPresent findById(Long id) { + return wxCouponPresentMapper.selectByPrimaryKey(id); + } + +} diff --git a/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml index d68e8c1bb..40b069abc 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponPasswordMapper.xml @@ -59,7 +59,12 @@ #{idItem} - + + + + and status in (${statusStr}) + + order by ${sortColumns} @@ -93,4 +98,23 @@ + + + + + + + + diff --git a/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml new file mode 100644 index 000000000..098bee4d5 --- /dev/null +++ b/mallinkService/src/main/resources/mapper/WxCouponPresentMapper.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + `id`,`tenant_id`,`coupon_id`,`coupon_name`,`user_id`,`create_time`,`update_time` + + + + where 1 = 1 + + and `id` = #{id} + + + and `tenant_id` = #{tenantId} + + + and `coupon_id` = #{couponId} + + + and `coupon_name` like concat('%', #{couponName},'%') + + + and `phones` like concat('%', #{phones},'%') + + + and `create_date` between #{sendTimeStart} and #{sendTimeEnd} + + + and `update_date` = #{updateTime} + + + and id in + + #{idItem} + + + order by ${sortColumns} + + + + +