| @@ -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(wxCouponPassword); | |||||
| 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 inner join wx_coupon_89 c on cp.coupon_id = c.id set cp.price = c.price where cp.price = 0 and c.price > 0 ; | |||||
| @@ -87,16 +87,9 @@ public class WxCardInfoController extends BaseController { | |||||
| map.put("cardType", cardInfo.getType()); | map.put("cardType", cardInfo.getType()); | ||||
| }else { | }else { | ||||
| //第一次刷卡的时候没有cardInfo | //第一次刷卡的时候没有cardInfo | ||||
| WxCoupon cq = new WxCoupon(); | |||||
| cq.updateTenantInfo(password); | |||||
| cq.setId(password.getCouponId()); | |||||
| WxCoupon coupon = wxCouponService.findById(cq); | |||||
| if (null == coupon) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到券:"+cardIdStr); | |||||
| } | |||||
| map.put("cardId", couponPasswordId); | map.put("cardId", couponPasswordId); | ||||
| map.put("amount", coupon.getPrice()); | |||||
| map.put("remainAmount", coupon.getPrice()); | |||||
| map.put("amount", password.getPrice()); | |||||
| map.put("remainAmount", password.getPrice()); | |||||
| map.put("cardType", EnumCardInfoType.CARD.getCode()); | map.put("cardType", EnumCardInfoType.CARD.getCode()); | ||||
| } | } | ||||
| } | } | ||||
| @@ -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); | ||||
| @@ -93,7 +96,7 @@ public class WxCouponPasswordController extends BaseController { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | ||||
| } | } | ||||
| if (coupon.getPrice() <= 0) { | if (coupon.getPrice() <= 0) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"面值未设置,请联系管理员."); | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF.getCode(),"卡面值未设置,请联系管理员."); | |||||
| } | } | ||||
| // 卡密领取卡券 | // 卡密领取卡券 | ||||
| @@ -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") | ||||
| @@ -13,11 +13,11 @@ public class WxCardSpendMerchantVo { | |||||
| private Long merchantId; | private Long merchantId; | ||||
| @Excel(name = "商户名称", width = 20, orderNum = "2") | @Excel(name = "商户名称", width = 20, orderNum = "2") | ||||
| private String merchantName; | private String merchantName; | ||||
| @Excel(name = "交易总金额", width = 20, orderNum = "3") | |||||
| @Excel(name = "交易总金额(分)", width = 20, orderNum = "3") | |||||
| private BigDecimal total; | private BigDecimal total; | ||||
| @Excel(name = "总手续费", width = 20, orderNum = "4") | |||||
| @Excel(name = "总手续费(分)", width = 20, orderNum = "4") | |||||
| private BigDecimal fee; | private BigDecimal fee; | ||||
| @Excel(name = "总补贴", width = 20, orderNum = "5") | |||||
| @Excel(name = "总补贴(分)", width = 20, orderNum = "5") | |||||
| private BigDecimal subsidy; | private BigDecimal subsidy; | ||||
| } | } | ||||
| @@ -25,40 +25,45 @@ public class WxCouponPasswordVo extends TenantEntity { | |||||
| @Excel(name = "卡号", width = 20, orderNum = "1", prefix = "`") | @Excel(name = "卡号", width = 20, orderNum = "1", prefix = "`") | ||||
| protected Long id; | protected Long id; | ||||
| @Excel(name = "卡密", width = 20, orderNum = "2", prefix = "`") | |||||
| @Excel(name = "卡名称", width = 20, orderNum = "2", prefix = "`") | |||||
| protected String couponTitile; | |||||
| @Excel(name = "卡密", width = 20, orderNum = "3", 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, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "3") | |||||
| @Excel(name = "卡密面额(分)", width = 20, orderNum = "4", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密面额", name = "couponPasswordPrice") | |||||
| private Integer couponPasswordPrice; | |||||
| @Excel(name = "创建时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "5") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | @io.swagger.annotations.ApiModelProperty(value = "", name = "createDate") | ||||
| private Date createDate; | private Date createDate; | ||||
| @Excel(name = "卡密状态", width = 20, orderNum = "4", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`") | |||||
| @Excel(name = "卡密状态", width = 20, orderNum = "6", replace = {"初始化_0", "消息发送中_1", "消息已发送_2", "已兑换_3","已作废_4"},prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密状态", name = "remainPrice") | @io.swagger.annotations.ApiModelProperty(value = "卡密状态", name = "remainPrice") | ||||
| private Integer status; | private Integer status; | ||||
| @Excel(name = "卡密是否停用", width = 20, orderNum = "5", replace = {"否_0", "是_1"},prefix = "`") | |||||
| @Excel(name = "卡密是否停用", width = 20, orderNum = "7", replace = {"否_0", "是_1"},prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡密是否停用", name = "isStop") | @io.swagger.annotations.ApiModelProperty(value = "卡密是否停用", name = "isStop") | ||||
| private Integer isStop; | private Integer isStop; | ||||
| @Excel(name = "卡激活状态", width = 20, orderNum = "6",replace = {"未激活_0", "已激活_1"}, prefix = "`") | |||||
| @Excel(name = "卡激活状态", width = 20, orderNum = "8",replace = {"未激活_0", "已激活_1"}, prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "卡激活状态EnumYesOrNo", name = "used") | @io.swagger.annotations.ApiModelProperty(value = "卡激活状态EnumYesOrNo", name = "used") | ||||
| private Integer used; | private Integer used; | ||||
| @Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "7") | |||||
| @Excel(name = "激活时间", width = 20, exportFormat = "yyyy-MM-dd HH:mm:ss", orderNum = "9") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "", name = "activeDate") | @io.swagger.annotations.ApiModelProperty(value = "", name = "activeDate") | ||||
| private Date activeDate; | private Date activeDate; | ||||
| @Excel(name = "激活手机号", width = 20, orderNum = "8", prefix = "`") | |||||
| @Excel(name = "激活手机号", width = 20, orderNum = "10", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "激活手机号", name = "phone") | @io.swagger.annotations.ApiModelProperty(value = "激活手机号", name = "phone") | ||||
| private String phone; | private String phone; | ||||
| @Excel(name = "激活会员", width = 20, orderNum = "9", prefix = "`") | |||||
| @Excel(name = "激活会员", width = 20, orderNum = "11", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "激活会员", name = "userName") | @io.swagger.annotations.ApiModelProperty(value = "激活会员", name = "userName") | ||||
| private String userName; | private String userName; | ||||
| @Excel(name = "电子卡卡号", width = 20, orderNum = "10", prefix = "`") | |||||
| @Excel(name = "电子卡卡号", width = 20, orderNum = "12", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "电子卡卡号", name = "cardId") | @io.swagger.annotations.ApiModelProperty(value = "电子卡卡号", name = "cardId") | ||||
| private Long cardId; | private Long cardId; | ||||
| @Excel(name = "面额(元)", width = 20, orderNum = "11", prefix = "`") | |||||
| @Excel(name = "面额(元)", width = 20, orderNum = "13", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "面额(元)", name = "price") | @io.swagger.annotations.ApiModelProperty(value = "面额(元)", name = "price") | ||||
| private Double price; | private Double price; | ||||
| @Excel(name = "余额(元)", width = 20, orderNum = "12", prefix = "`") | |||||
| @Excel(name = "余额(元)", width = 20, orderNum = "14", prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "余额(元)", name = "remainPrice") | @io.swagger.annotations.ApiModelProperty(value = "余额(元)", name = "remainPrice") | ||||
| private Double remainPrice; | private Double remainPrice; | ||||
| @Excel(name = "电子卡状态", width = 20, orderNum = "13",replace = {"正常_0", "已禁用_1"}, prefix = "`") | |||||
| @Excel(name = "电子卡状态", width = 20, orderNum = "15",replace = {"正常_0", "已禁用_1"}, prefix = "`") | |||||
| @io.swagger.annotations.ApiModelProperty(value = "电子卡状态EnumYesOrNo", name = "cardStatus") | @io.swagger.annotations.ApiModelProperty(value = "电子卡状态EnumYesOrNo", name = "cardStatus") | ||||
| private Integer cardStatus; | private Integer cardStatus; | ||||
| @@ -42,7 +42,7 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | ||||
| Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price,@Param("subsidyNum")Integer subsidyNum); | |||||
| Integer setPrice(WxCoupon wxCoupon); | |||||
| Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | ||||
| @@ -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(WxCouponPassword wxCouponPassword); | |||||
| } | } | ||||
| @@ -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); | ||||
| @@ -22,6 +22,7 @@ import com.iformall.domain.vo.WxMerchantProductVo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxCardInfoMapper; | import com.iformall.mapper.WxCardInfoMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | |||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.service.ExcelService; | import com.iformall.service.ExcelService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | import com.iformall.service.WxCUserBasicInfoService; | ||||
| @@ -59,6 +60,8 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| WxCUserBasicInfoService wxCUserBasicInfoService; | WxCUserBasicInfoService wxCUserBasicInfoService; | ||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| @Autowired | @Autowired | ||||
| ExcelService excelService; | ExcelService excelService; | ||||
| @@ -83,13 +86,31 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| private List<WxCouponPasswordVo> handleQueryResult(List<WxCouponPassword> list,TenantEntity tenantEntity) { | private List<WxCouponPasswordVo> handleQueryResult(List<WxCouponPassword> list,TenantEntity tenantEntity) { | ||||
| if (null != list && list.size() > 0) { | if (null != list && list.size() > 0) { | ||||
| List<Long> couponPasswordIdList = new ArrayList<Long>(); | List<Long> couponPasswordIdList = new ArrayList<Long>(); | ||||
| List<Long> couponIdList = new ArrayList<Long>(); | |||||
| for (int i = 0 ; i < list.size() ; i ++ ) { | for (int i = 0 ; i < list.size() ; i ++ ) { | ||||
| WxCouponPassword bo = list.get(i); | WxCouponPassword bo = list.get(i); | ||||
| if (null != bo.getId() && (!couponPasswordIdList.contains(bo.getId()))) { | if (null != bo.getId() && (!couponPasswordIdList.contains(bo.getId()))) { | ||||
| couponPasswordIdList.add(bo.getId()); | couponPasswordIdList.add(bo.getId()); | ||||
| } | } | ||||
| if (null != bo.getCouponId() && (!couponIdList.contains(bo.getCouponId()))) { | |||||
| couponIdList.add(bo.getCouponId()); | |||||
| } | |||||
| } | } | ||||
| Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); | |||||
| if (couponIdList.size() > 0 ) { | |||||
| WxCoupon cQ = new WxCoupon(); | |||||
| cQ.updateTenantInfo(tenantEntity); | |||||
| cQ.setIds(couponIdList); | |||||
| List<WxCoupon> cList = wxCouponMapper.findList(cQ); | |||||
| if (null != cList && cList.size() > 0) { | |||||
| for (int i = 0 ; i < cList.size(); i++) { | |||||
| WxCoupon c = cList.get(i); | |||||
| couponMap.put(c.getId(), c); | |||||
| } | |||||
| } | |||||
| } | |||||
| List<Long> cUserIdList = new ArrayList<Long>(); | List<Long> cUserIdList = new ArrayList<Long>(); | ||||
| Map<Long,WxCardInfo> passwordCardInfoMap = new HashMap<Long,WxCardInfo>(); | Map<Long,WxCardInfo> passwordCardInfoMap = new HashMap<Long,WxCardInfo>(); | ||||
| if (couponPasswordIdList.size() > 0 ) { | if (couponPasswordIdList.size() > 0 ) { | ||||
| @@ -129,7 +150,14 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| WxCouponPasswordVo co = new WxCouponPasswordVo(); | WxCouponPasswordVo co = new WxCouponPasswordVo(); | ||||
| WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); | WxCardInfo cardInfo = passwordCardInfoMap.get(coo.getId()); | ||||
| co.setId(coo.getId()); | co.setId(coo.getId()); | ||||
| if (null != coo.getCouponId()) { | |||||
| WxCoupon coupon = couponMap.get(coo.getCouponId()); | |||||
| if (null != coupon) { | |||||
| co.setCouponTitile(coupon.getTitle()); | |||||
| } | |||||
| } | |||||
| 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 +331,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); | |||||
| } | |||||
| } | } | ||||
| @@ -1022,10 +1022,16 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData setPrice(WxCoupon record) { | public ResultData setPrice(WxCoupon record) { | ||||
| Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice(),record.getSubsidyNum()); | |||||
| Integer count = wxCouponMapper.setPrice(record); | |||||
| if (null == count || count <= 0 ) { | if (null == count || count <= 0 ) { | ||||
| return new ResultData(Result.ERROR,"设置失败"); | return new ResultData(Result.ERROR,"设置失败"); | ||||
| } | } | ||||
| //设置卡密price | |||||
| WxCouponPassword couponPassword = new WxCouponPassword(); | |||||
| couponPassword.updateTenantInfo(record); | |||||
| couponPassword.setCouponId(record.getId()); | |||||
| couponPassword.setPrice(record.getPrice()); | |||||
| couponPasswordMapper.setPrice(couponPassword); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -1524,8 +1524,8 @@ | |||||
| update wx_coupon set make_merchant_id = #{makeMerchantId} where id = #{id} and tenant_id = #{tenantId} | update wx_coupon set make_merchant_id = #{makeMerchantId} where id = #{id} and tenant_id = #{tenantId} | ||||
| </update> | </update> | ||||
| <update id="setPrice" parameterType="HashMap"> | |||||
| update wx_coupon set price = #{price},subsidy_num={subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0 | |||||
| <update id="setPrice" parameterType="com.iformall.domain.po.WxCoupon"> | |||||
| update wx_coupon set price = #{price},subsidy_num=#{subsidyNum} where id = #{id} and tenant_id = #{tenantId} and price = 0 | |||||
| </update> | </update> | ||||
| </mapper> | </mapper> | ||||
| @@ -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,16 @@ | |||||
| <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="com.iformall.domain.po.WxCouponPassword"> | |||||
| update wx_coupon_password set price = #{price} , update_date = now() | |||||
| where tenant_id = #{tenantId} and price = 0 | |||||
| <if test=" null != couponId"> | |||||
| and coupon_id = #{couponId} | |||||
| </if> | |||||
| <if test=" null != id"> | |||||
| and id = #{id} | |||||
| </if> | |||||
| </update> | |||||
| </mapper> | </mapper> | ||||