| @@ -2,14 +2,19 @@ package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.annotation.TenantIgnore; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | ||||
| import com.iformall.domain.vo.WxCouponPasswordVo; | import com.iformall.domain.vo.WxCouponPasswordVo; | ||||
| import com.iformall.enums.EnumCouponPasswordStatus; | import com.iformall.enums.EnumCouponPasswordStatus; | ||||
| import com.iformall.enums.EnumCouponSubsidyType; | |||||
| import com.iformall.enums.EnumYesOrNo; | |||||
| import com.iformall.service.WxCouponPasswordService; | import com.iformall.service.WxCouponPasswordService; | ||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| @@ -112,6 +117,25 @@ public class WxCouponPasswordController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @TenantIgnore | |||||
| @ApiOperation("后置设置金额") | |||||
| @PostMapping("setPrice") | |||||
| public ResultData setPrice(@RequestBody WxCouponPassword wxCouponPassword) { | |||||
| wxCouponPassword.updateTenantInfo(getTenantInfo()); | |||||
| WxCouponPassword couponPassword = wxCouponPasswordService.getById(wxCouponPassword.getId()); | |||||
| if (null == couponPassword ) { | |||||
| return new ResultData(ResultData.ERROR, "卡密未查询到。"+wxCouponPassword.getId()); | |||||
| } | |||||
| if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue() ) { | |||||
| return new ResultData(ResultData.ERROR, "已停用,不能设置。"); | |||||
| } | |||||
| if (couponPassword.getPrice() > 0 ) { | |||||
| return new ResultData(ResultData.ERROR, "已设置面额,不能再次设置面额。"); | |||||
| } | |||||
| wxCouponPasswordService.setPrice(couponPassword); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,10 @@ | |||||
| alter table wx_coupon_password add column price int(11) not null default 0 comment '面额'; | |||||
| update wx_coupon_password cp , wx_coupon_89 c on cp.coupon_id = c.id set cp.price = c.price where cp.price = 0 and c.price > 0 ; | |||||
| @@ -90,10 +90,6 @@ public class WxCardPayController extends BaseController { | |||||
| WxMerchantBUser user = getLoginBUser(); | WxMerchantBUser user = getLoginBUser(); | ||||
| wxCardSpendVo.updateTenantInfo(user); | wxCardSpendVo.updateTenantInfo(user); | ||||
| wxCardSpendVo.setMerchantId(user.getMerchantId()); | wxCardSpendVo.setMerchantId(user.getMerchantId()); | ||||
| // List<Integer> sources = new ArrayList<Integer>(); | |||||
| // sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| // wxCardSpendVo.setSources(sources); | |||||
| // wxCardSpendVo.setCardSpendListShow(1); | |||||
| wxCardSpendVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | wxCardSpendVo.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | ||||
| final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | final PageInfo<WxCardSpendVo> page = wxCardSpendService.listAsPage(wxCardSpendVo, pageNum, pageSize); | ||||
| return new ResultData(page); | return new ResultData(page); | ||||
| @@ -108,10 +104,6 @@ public class WxCardPayController extends BaseController { | |||||
| WxMerchantBUser user = getLoginBUser(); | WxMerchantBUser user = getLoginBUser(); | ||||
| wxCardSpend.updateTenantInfo(user); | wxCardSpend.updateTenantInfo(user); | ||||
| wxCardSpend.setMerchantId(user.getMerchantId()); | wxCardSpend.setMerchantId(user.getMerchantId()); | ||||
| // List<Integer> sources = new ArrayList<Integer>(); | |||||
| // sources.add(EnumMerchantSubsidySource.CARD.getCode()); | |||||
| // wxCardSpend.setSources(sources); | |||||
| // wxCardSpend.setCardSpendListShow(1); | |||||
| final Map<String, BigDecimal> mapList = wxCardSpendService.sumCardSpend(wxCardSpend); | final Map<String, BigDecimal> mapList = wxCardSpendService.sumCardSpend(wxCardSpend); | ||||
| return new ResultData(mapList); | return new ResultData(mapList); | ||||
| } | } | ||||
| @@ -194,6 +186,9 @@ public class WxCardPayController extends BaseController { | |||||
| if (EnumYesOrNo.YES.getCode().intValue() == couponPassword.getIsStop().intValue()) { | if (EnumYesOrNo.YES.getCode().intValue() == couponPassword.getIsStop().intValue()) { | ||||
| return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡已被禁用."); | return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡已被禁用."); | ||||
| } | } | ||||
| if (couponPassword.getPrice().intValue() <= 0 ) { | |||||
| return new ResultData(ErrorCode.CARD_IS_NOT_FOUND.getCode(),"卡密面额未设置."); | |||||
| } | |||||
| WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); | WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); | ||||
| if (coupon == null) { | if (coupon == null) { | ||||
| @@ -80,6 +80,9 @@ public class WxCouponPasswordController extends BaseController { | |||||
| if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | if (couponPassword.getIsStop().intValue() == EnumYesOrNo.YES.getCode().intValue()) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"卡密已经停用"); | return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"卡密已经停用"); | ||||
| } | } | ||||
| if (couponPassword.getPrice() <= 0) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"卡密面值未设置,请联系管理员."); | |||||
| } | |||||
| WxCUserBasicInfo member = userService.getById(memberId,getFinalTenantId()); | WxCUserBasicInfo member = userService.getById(memberId,getFinalTenantId()); | ||||
| if(member == null) { | if(member == null) { | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId); | throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId); | ||||
| @@ -20,6 +20,8 @@ public class WxCouponPassword extends TenantEntity { | |||||
| protected Long id; | protected Long id; | ||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| private String idLike; | private String idLike; | ||||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | |||||
| private Integer price; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | @io.swagger.annotations.ApiModelProperty(value="卡券ID",name="couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="卡券短ID",name="couponShort") | @io.swagger.annotations.ApiModelProperty(value="卡券短ID",name="couponShort") | ||||
| @@ -28,6 +28,9 @@ public class WxCouponPasswordVo extends TenantEntity { | |||||
| @Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`") | @Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密", name = "couponPassword") | @io.swagger.annotations.ApiModelProperty(value = "卡密", name = "couponPassword") | ||||
| private String couponPassword; | private String couponPassword; | ||||
| @Excel(name = "卡密面额", width = 20, orderNum = "2", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密面额", name = "couponPasswordPrice") | |||||
| private Integer couponPasswordPrice; | |||||
| @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3") | @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3") | ||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @@ -29,5 +29,7 @@ public interface WxCouponPasswordMapper extends CommonMapper<WxCouponPassword, L | |||||
| void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime); | void updateExpiredTime(@Param("couponId")Long couponId,@Param("expiredTime")Date expiredTime); | ||||
| void updateIsStop(@Param("tenantId")String tenantId,@Param("id")Long Id,@Param("isStop")Integer isStop); | void updateIsStop(@Param("tenantId")String tenantId,@Param("id")Long Id,@Param("isStop")Integer isStop); | ||||
| void setPrice(@Param("tenantId")String tenantId,@Param("couponId")Long couponId,@Param("price")Integer price); | |||||
| } | } | ||||
| @@ -77,4 +77,6 @@ public interface WxCouponPasswordService { | |||||
| void postpone(WxCouponPassword wxCouponPassword); | void postpone(WxCouponPassword wxCouponPassword); | ||||
| void startOrStop(WxCouponPassword wxCouponPassword); | void startOrStop(WxCouponPassword wxCouponPassword); | ||||
| void setPrice(WxCouponPassword wxCouponPassword); | |||||
| } | } | ||||
| @@ -310,10 +310,10 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| cardInfo.setId(couponPassword.getId()); | cardInfo.setId(couponPassword.getId()); | ||||
| cardInfo.updateTenantInfo(couponPassword); | cardInfo.updateTenantInfo(couponPassword); | ||||
| cardInfo.setCouponId(couponPassword.getCouponId()); | cardInfo.setCouponId(couponPassword.getCouponId()); | ||||
| cardInfo.setAmount(coupon.getPrice()); | |||||
| cardInfo.setAmount(couponPassword.getPrice()); | |||||
| cardInfo.setSaleAmount(coupon.getSalePrice()); | cardInfo.setSaleAmount(coupon.getSalePrice()); | ||||
| cardInfo.setCouponPasswordId(couponPassword.getId()); | cardInfo.setCouponPasswordId(couponPassword.getId()); | ||||
| cardInfo.setRemainingAmount(coupon.getPrice()); | |||||
| cardInfo.setRemainingAmount(couponPassword.getPrice()); | |||||
| cardInfo.setShareFeeAmount(0); | cardInfo.setShareFeeAmount(0); | ||||
| cardInfo.setRemainingShareFeeAmount(0); | cardInfo.setRemainingShareFeeAmount(0); | ||||
| cardInfo.setRateAmount(0); | cardInfo.setRateAmount(0); | ||||
| @@ -130,6 +130,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); | WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); | ||||
| co.setId(coo.getId()); | co.setId(coo.getId()); | ||||
| co.setCouponPassword(coo.getPassword()); | co.setCouponPassword(coo.getPassword()); | ||||
| co.setCouponPasswordPrice(coo.getPrice()); | |||||
| if (null != cardInfo) { | if (null != cardInfo) { | ||||
| co.setUsed(EnumYesOrNo.YES.getCode()); | co.setUsed(EnumYesOrNo.YES.getCode()); | ||||
| co.setPrice(new BigDecimal(cardInfo.getAmount()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); | co.setPrice(new BigDecimal(cardInfo.getAmount()).divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); | ||||
| @@ -303,5 +304,10 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| public void startOrStop(WxCouponPassword wxCouponPassword) { | public void startOrStop(WxCouponPassword wxCouponPassword) { | ||||
| wxCouponPasswordMapper.updateIsStop(wxCouponPassword.getTenantId(), wxCouponPassword.getId(), wxCouponPassword.getIsStop()); | wxCouponPasswordMapper.updateIsStop(wxCouponPassword.getTenantId(), wxCouponPassword.getId(), wxCouponPassword.getIsStop()); | ||||
| } | } | ||||
| @Override | |||||
| public void setPrice(WxCouponPassword wxCouponPassword) { | |||||
| wxCouponPasswordMapper.setPrice(wxCouponPassword.getTenantId(), wxCouponPassword.getCouponId(), wxCouponPassword.getPrice()); | |||||
| } | |||||
| } | } | ||||
| @@ -1026,6 +1026,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| if (null == count || count <= 0 ) { | if (null == count || count <= 0 ) { | ||||
| return new ResultData(Result.ERROR,"设置失败"); | return new ResultData(Result.ERROR,"设置失败"); | ||||
| } | } | ||||
| //设置卡密price | |||||
| couponPasswordMapper.setPrice(record.getTenantId(), record.getId(), record.getPrice()); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -5,6 +5,7 @@ | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | <id column="id" jdbcType="BIGINT" property="id" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | ||||
| <result column="price" jdbcType="INTEGER" property="price" /> | |||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | ||||
| <result column="coupon_short" jdbcType="VARCHAR" property="couponShort" /> | <result column="coupon_short" jdbcType="VARCHAR" property="couponShort" /> | ||||
| <result column="password" jdbcType="VARCHAR" property="password" /> | <result column="password" jdbcType="VARCHAR" property="password" /> | ||||
| @@ -19,7 +20,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id`,`is_stop` | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`price`,`coupon_id`,`coupon_short`,`password`,`status`,`sended_phone`,`card_id`,`create_date`,`update_date`,`expire_date`,`present_id`,`is_stop` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -213,5 +214,10 @@ | |||||
| <update id="updateIsStop" parameterType="map"> | <update id="updateIsStop" parameterType="map"> | ||||
| update wx_coupon_password set is_stop = #{isStop} , update_date = now() where id = #{id} and tenant_id = #{tenantId} | update wx_coupon_password set is_stop = #{isStop} , update_date = now() where id = #{id} and tenant_id = #{tenantId} | ||||
| </update> | </update> | ||||
| <update id="setPrice" parameterType="map"> | |||||
| update wx_coupon_password set price = #{price} , update_date = now() | |||||
| where coupon_id = #{couponId} and tenant_id = #{tenantId} and price = 0 | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||