From 7933a3d6e88f3fc7d3ed7e1b2b6eb2bee7ea698e Mon Sep 17 00:00:00 2001 From: "Stormeye.Wu" Date: Wed, 29 Aug 2018 22:19:35 +0800 Subject: [PATCH] =?UTF-8?q?[couponCar=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0]?= =?UTF-8?q?[=E6=96=B0=E5=A2=9E]:amtCount=E6=8E=A5=E5=8F=A3+=E5=81=9C?= =?UTF-8?q?=E8=BD=A6=E5=88=B8Detail=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/controller/WxCarController.java | 40 +++++++++++++ .../com/simple/domain/vo/WxCouponCarVo.java | 11 ++++ .../com/simple/mapper/WxCouponCarMapper.java | 6 +- .../simple/service/WxCouponCarService.java | 20 +++++-- .../service/impl/WxCouponCarServiceImpl.java | 17 ++++-- .../resources/mapper/WxCouponCarMapper.xml | 58 ++++++++++++++++++- 6 files changed, 139 insertions(+), 13 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java index 5889f7f3f..b52cd4146 100644 --- a/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java +++ b/mallinkAdmin/src/main/java/com/simple/controller/WxCarController.java @@ -17,8 +17,10 @@ import com.simple.utils.TJDCarUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import io.swagger.models.auth.In; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; +import org.apache.poi.hmef.attribute.MAPIAttribute; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -258,4 +260,42 @@ public class WxCarController extends BaseController return new ResultData(id); } + + + @ApiOperation("优免券模板已分配总数") + @GetMapping("/templateAmtCount") + @ApiImplicitParams({ + @ApiImplicitParam(name="templateId",value="模板ID",dataType="Long", paramType = "query",required=true)}) + public ResultData getTemplateAmountSum(Long templateId) { + Map map = new HashMap(); + Integer amountCount = 0; + try { + amountCount = wxCouponCarService.getAmtCountByTemplateId(templateId); + } catch (Exception e) { + logger.error(e.getMessage()); + } + map.put("amountCount", amountCount); + return new ResultData(map); + } + + @ApiOperation("停车券detail") + @GetMapping("/detail") + public ResultData getCouponCarDetail(@ModelAttribute WxCoupon coupon) { + MallUserInfo user = getUser(); + coupon.setTenantId(user.getTenantId()); + try { + WxCouponCarVo couponCarVo = wxCouponCarService.getByCoupon(coupon); + if (couponCarVo != null) { + return new ResultData(couponCarVo); + } else { + return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(), "券不存在"); + } + } catch (Exception e) { + logger.error(e.getMessage()); + return new ResultData(ErrorCode.DB_FAIL.getCode(), e.getMessage()); + } + + } + + } diff --git a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java index 15058319a..78aaf0113 100644 --- a/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java +++ b/mallinkService/src/main/java/com/simple/domain/vo/WxCouponCarVo.java @@ -128,6 +128,9 @@ public class WxCouponCarVo implements Serializable { /*业态**/ @io.swagger.annotations.ApiModelProperty(value="业态",name="business") private String business; + /*车场厂商类型**/ + @io.swagger.annotations.ApiModelProperty(value="车场厂商类型1:ETCP,2:TJD",name="vendorType") + private String vendorType; /*车场厂商相关信息**/ @io.swagger.annotations.ApiModelProperty(value="车场厂商相关信息",name="vendorParams") private String vendorParams; @@ -282,6 +285,14 @@ public class WxCouponCarVo implements Serializable { business = _business; } + public String getVendorType() { + return vendorType; + } + + public void setVendorType(String vendorType) { + this.vendorType = vendorType; + } + public String getVendorParams() { return vendorParams; } diff --git a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java index 5421db797..6ff40a08b 100644 --- a/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java +++ b/mallinkService/src/main/java/com/simple/mapper/WxCouponCarMapper.java @@ -2,6 +2,8 @@ package com.simple.mapper; import java.util.*; import com.simple.common.CommonMapper; +import com.simple.domain.po.WxCoupon; +import com.simple.domain.vo.WxCouponCarVo; import org.apache.ibatis.annotations.Param; import com.simple.domain.po.WxCouponCar; @@ -10,8 +12,8 @@ public interface WxCouponCarMapper extends CommonMapper { List findList(WxCouponCar wxCouponCar); + Integer findTemplateAmtCount(Long templateId); - - + WxCouponCarVo selectCouponCarDetail(WxCoupon coupon); } diff --git a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java index eb1d4625b..d79bb9979 100644 --- a/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java +++ b/mallinkService/src/main/java/com/simple/service/WxCouponCarService.java @@ -2,7 +2,9 @@ package com.simple.service; import java.util.*; import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponCar; +import com.simple.domain.vo.WxCouponCarVo; public interface WxCouponCarService { @@ -44,11 +46,21 @@ public interface WxCouponCarService { * @param id */ void deleteById(Long id); - - - - + /** + * 根据templateId获取分配总数 + * + * @param templateId + */ + Integer getAmtCountByTemplateId(Long templateId); + + /** + * 根据coupon获得实体 + * + * @param coupon + * @return + */ + WxCouponCarVo getByCoupon(WxCoupon coupon); diff --git a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java index e2913ca1f..6764e3093 100644 --- a/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java +++ b/mallinkService/src/main/java/com/simple/service/impl/WxCouponCarServiceImpl.java @@ -3,7 +3,9 @@ package com.simple.service.impl; import java.util.*; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.simple.domain.po.WxCoupon; import com.simple.domain.po.WxCouponCar; +import com.simple.domain.vo.WxCouponCarVo; import com.simple.mapper.WxCouponCarMapper; import com.simple.service.WxCouponCarService; import org.springframework.beans.factory.annotation.Autowired; @@ -41,10 +43,17 @@ public class WxCouponCarServiceImpl implements WxCouponCarService { public void deleteById(Long id) { wxCouponCarMapper.deleteByPrimaryKey(id); } - - - - + + + @Override + public Integer getAmtCountByTemplateId(Long templateId) { + return wxCouponCarMapper.findTemplateAmtCount(templateId); + } + + @Override + public WxCouponCarVo getByCoupon(WxCoupon coupon) { + return wxCouponCarMapper.selectCouponCarDetail(coupon); + } diff --git a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml index 593463c99..58c702a52 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponCarMapper.xml @@ -71,9 +71,61 @@ select from wx_coupon_car - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, + car.vendor_type, car.vendor_params + +