| @@ -290,7 +290,7 @@ public class WxCardPayController extends BaseController { | |||||
| if(Constant.UNDEFINED.equals(cardInfo.getTransactionId())){ | if(Constant.UNDEFINED.equals(cardInfo.getTransactionId())){ | ||||
| cardInfo.setTransactionId(null); | cardInfo.setTransactionId(null); | ||||
| } | } | ||||
| return wxCardInfoService.rechargeAmount(cardInfo); | |||||
| return wxCardInfoService.rechargeAmount(cardInfo,getUser()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -484,37 +484,37 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @TenantIgnore | |||||
| @ApiOperation("后置设置金额") | |||||
| @PostMapping("setPrice") | |||||
| public ResultData setPrice(@RequestBody WxCoupon wxCoupon) { | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| wxCoupon.updateTenantInfo(tenantEntity); | |||||
| WxCoupon coupon = wxCouponService.findById(wxCoupon); | |||||
| if (null == coupon ) { | |||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | |||||
| } | |||||
| if (EnumYesOrNo.YES.getCode() != coupon.getIsAfterSetPrice()) { | |||||
| return new ResultData(ResultData.ERROR, "当前不是后置类型,不能设置。"+wxCoupon.getId()); | |||||
| } | |||||
| if (null != coupon.getPrice() && coupon.getPrice() > 0 ) { | |||||
| return new ResultData(ResultData.ERROR, "当前已设置面额,不能设置。"+wxCoupon.getId()); | |||||
| } | |||||
| if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) { | |||||
| // 微信 立减 | |||||
| if (wxCoupon.getSubsidyNum() > coupon.getSalePrice()) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||||
| } | |||||
| } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) { | |||||
| // 线下补贴 | |||||
| int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice(); | |||||
| if (wxCoupon.getSubsidyNum() > subsidy_num) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||||
| } | |||||
| } | |||||
| ResultData resultData = wxCouponService.setPrice(wxCoupon); | |||||
| return resultData; | |||||
| } | |||||
| // @TenantIgnore | |||||
| // @ApiOperation("后置设置金额") | |||||
| // @PostMapping("setPrice") | |||||
| // public ResultData setPrice(@RequestBody WxCoupon wxCoupon) { | |||||
| // TenantEntity tenantEntity = getTenantInfo(); | |||||
| // wxCoupon.updateTenantInfo(tenantEntity); | |||||
| // WxCoupon coupon = wxCouponService.findById(wxCoupon); | |||||
| // if (null == coupon ) { | |||||
| // return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | |||||
| // } | |||||
| // if (EnumYesOrNo.YES.getCode() != coupon.getIsAfterSetPrice()) { | |||||
| // return new ResultData(ResultData.ERROR, "当前不是后置类型,不能设置。"+wxCoupon.getId()); | |||||
| // } | |||||
| // if (null != coupon.getPrice() && coupon.getPrice() > 0 ) { | |||||
| // return new ResultData(ResultData.ERROR, "当前已设置面额,不能设置。"+wxCoupon.getId()); | |||||
| // } | |||||
| // if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) { | |||||
| // // 微信 立减 | |||||
| // if (wxCoupon.getSubsidyNum() > coupon.getSalePrice()) { | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价"); | |||||
| // } | |||||
| // } else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) { | |||||
| // // 线下补贴 | |||||
| // int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice(); | |||||
| // if (wxCoupon.getSubsidyNum() > subsidy_num) { | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值"); | |||||
| // } | |||||
| // } | |||||
| // ResultData resultData = wxCouponService.setPrice(wxCoupon); | |||||
| // return resultData; | |||||
| // } | |||||
| @ApiOperation("根据id删除接口") | @ApiOperation("根据id删除接口") | ||||
| @@ -211,7 +211,7 @@ public class WxCouponPasswordController extends BaseController { | |||||
| if (null != cardInfo) { | if (null != cardInfo) { | ||||
| return new ResultData(ResultData.ERROR, "卡已绑定,不能再次设置面额。"); | return new ResultData(ResultData.ERROR, "卡已绑定,不能再次设置面额。"); | ||||
| } | } | ||||
| wxCouponPasswordService.setPrice(wxCouponPassword); | |||||
| wxCouponPasswordService.setPrice(wxCouponPassword,getUser()); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -0,0 +1,20 @@ | |||||
| ALTER TABLE `mallink`.`wx_card_spend` | |||||
| MODIFY COLUMN `remark` varchar(225) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注' AFTER `pos_order_id`; | |||||
| CREATE TABLE `wx_card_set_price` ( | |||||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||||
| `tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||||
| `parent_tenant_id` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||||
| `card_password_id` bigint(20) NOT NULL COMMENT '卡密Id', | |||||
| `ip` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ip地址', | |||||
| `price` int(10) DEFAULT NULL, | |||||
| `create_date` datetime(0) NOT NULL COMMENT '创建时间', | |||||
| `update_date` datetime(0) NOT NULL COMMENT '更新时间', | |||||
| `operator_type` smallint(1) NOT NULL COMMENT '操作人类型', | |||||
| `operator_id` bigint(20) DEFAULT NULL COMMENT '操作人', | |||||
| `operator_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||||
| `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', | |||||
| PRIMARY KEY (`id`) USING BTREE, | |||||
| UNIQUE INDEX `idx`(`id`) USING BTREE | |||||
| ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic; | |||||
| @@ -0,0 +1,40 @@ | |||||
| package com.iformall.domain.po; | |||||
| import cn.afterturn.easypoi.excel.annotation.Excel; | |||||
| import com.baomidou.mybatisplus.annotation.TableField; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @TableName(value = "wx_card_set_price") | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class WxCardSetPrice extends TenantEntity { | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="卡密id",name="cardPasswordId") | |||||
| private Long cardPasswordId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="ip",name="ip") | |||||
| private String ip; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="price") | |||||
| private Integer price; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="remark") | |||||
| private String remark; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="operatorType") | |||||
| private Integer operatorType; | |||||
| @io.swagger.annotations.ApiModelProperty(value="",name="operatorId") | |||||
| private Long operatorId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumUserType",name="operatorUser") | |||||
| private String operatorUser; | |||||
| } | |||||
| @@ -19,7 +19,7 @@ public class WxCardSpend extends TenantEntity { | |||||
| protected Long id; | protected Long id; | ||||
| @Excel(name = "订单类型", width = 20, orderNum = "8", replace = {"付款_0", "退款_1", "充值_1"}) | |||||
| @Excel(name = "订单类型", width = 20, orderNum = "8", replace = {"付款_0", "退款_1", "充值_10"}) | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumPayType",name="payType") | @io.swagger.annotations.ApiModelProperty(value="EnumPayType",name="payType") | ||||
| private Integer payType; | private Integer payType; | ||||
| @@ -0,0 +1,14 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxCardSetPrice; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| public interface WxCardSetPriceMapper extends CommonMapper<WxCardSetPrice, Long> { | |||||
| List<WxCardSetPrice> findList(WxCardSetPrice wxCardSpend); | |||||
| } | |||||
| @@ -2,10 +2,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxCardInfo; | |||||
| import com.iformall.domain.po.WxCardTransferInfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponPassword; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCardTransferVo; | import com.iformall.domain.vo.WxCardTransferVo; | ||||
| import com.iformall.domain.vo.WxCardVo; | import com.iformall.domain.vo.WxCardVo; | ||||
| @@ -70,5 +67,5 @@ public interface WxCardInfoService { | |||||
| ResultData updatePayPassword(WxCardInfo cardInfo, EnumCUserFrom userFrom); | ResultData updatePayPassword(WxCardInfo cardInfo, EnumCUserFrom userFrom); | ||||
| ResultData rechargeAmount(WxCardInfo cardInfo); | |||||
| ResultData rechargeAmount(WxCardInfo cardInfo, MallUserInfo user); | |||||
| } | } | ||||
| @@ -0,0 +1,26 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.*; | |||||
| public interface WxCardSetPriceService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxCardSetPrice> listAsPage(WxCardSetPrice record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxCardSetPrice record); | |||||
| } | |||||
| @@ -86,7 +86,7 @@ public interface WxCouponPasswordService { | |||||
| void startOrStop(WxCouponPassword wxCouponPassword); | void startOrStop(WxCouponPassword wxCouponPassword); | ||||
| Integer setPrice(WxCouponPassword wxCouponPassword); | |||||
| Integer setPrice(WxCouponPassword wxCouponPassword,MallUserInfo user); | |||||
| void exportTemplate(HttpServletRequest request, HttpServletResponse response); | void exportTemplate(HttpServletRequest request, HttpServletResponse response); | ||||
| void importPrice(MallUserInfo user,String importKey, WxCardPriceTemplate template); | void importPrice(MallUserInfo user,String importKey, WxCardPriceTemplate template); | ||||
| @@ -90,7 +90,7 @@ public interface WxCouponService { | |||||
| */ | */ | ||||
| ResultData saveOrUpdate(WxCoupon record); | ResultData saveOrUpdate(WxCoupon record); | ||||
| ResultData setPrice(WxCoupon record); | |||||
| // ResultData setPrice(WxCoupon record); | |||||
| ResultData updateTtProduct(WxCoupon wxCoupon); | ResultData updateTtProduct(WxCoupon wxCoupon); | ||||
| /** | /** | ||||
| @@ -445,7 +445,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| @Override | @Override | ||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | ||||
| public ResultData rechargeAmount(WxCardInfo cardInfo) { | |||||
| public ResultData rechargeAmount(WxCardInfo cardInfo,MallUserInfo user) { | |||||
| WxCardInfo wxCardInfo = wxCardInfoMapper.selectById(cardInfo.getId()); | WxCardInfo wxCardInfo = wxCardInfoMapper.selectById(cardInfo.getId()); | ||||
| if(wxCardInfo == null){ | if(wxCardInfo == null){ | ||||
| return new ResultData(ErrorCode.CARD_IS_NOT_FOUND); | return new ResultData(ErrorCode.CARD_IS_NOT_FOUND); | ||||
| @@ -490,7 +490,7 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||||
| record.setMerchantId(0l);//充值订单无商户 | record.setMerchantId(0l);//充值订单无商户 | ||||
| record.setPayFrom(EnumCardSpendFrom.recharge.getCode()); | record.setPayFrom(EnumCardSpendFrom.recharge.getCode()); | ||||
| record.setDeductionAmount(cardInfo.getAmount()); | record.setDeductionAmount(cardInfo.getAmount()); | ||||
| record.setRemark("充值"); | |||||
| record.setRemark(user.getUsername()+"【"+user.getId()+"】"+"充值"); | |||||
| record.setPayment(0); | record.setPayment(0); | ||||
| record.setRealPayment(0); | record.setRealPayment(0); | ||||
| @@ -0,0 +1,70 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.dto.WxSharingOrderDto; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.po.msg.WxMsg; | |||||
| import com.iformall.domain.vo.PromotionCalc; | |||||
| import com.iformall.domain.vo.WxCardSpendMerchantVo; | |||||
| import com.iformall.domain.vo.WxCardSpendVo; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.*; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.utils.Constant; | |||||
| import com.iformall.utils.PayUtils; | |||||
| import org.apache.commons.beanutils.BeanUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Lazy; | |||||
| import org.springframework.stereotype.Service; | |||||
| import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import javax.servlet.http.HttpServletRequest; | |||||
| import javax.servlet.http.HttpServletResponse; | |||||
| import java.lang.reflect.InvocationTargetException; | |||||
| import java.math.BigDecimal; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.*; | |||||
| @Service | |||||
| public class WxCardSetPriceServiceImpl implements WxCardSetPriceService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxCardSetPriceMapper wxCardSetPriceMapper; | |||||
| @Override | |||||
| public PageInfo<WxCardSetPrice> listAsPage(WxCardSetPrice record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardSetPriceMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxCardSetPrice record) { | |||||
| Date now = new Date(); | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| record.setCreateDate(now); | |||||
| record.setUpdateDate(now); | |||||
| wxCardSetPriceMapper.insert(record); | |||||
| } else { | |||||
| record.setUpdateDate(now); | |||||
| wxCardSetPriceMapper.updateById(record); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -20,11 +20,7 @@ import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCardInfoMapper; | import com.iformall.mapper.WxCardInfoMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | import com.iformall.mapper.WxCouponMapper; | ||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.service.ExcelService; | |||||
| import com.iformall.service.SysConfigService; | |||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxCardInfoService; | |||||
| import com.iformall.service.WxCouponPasswordService; | |||||
| import com.iformall.service.*; | |||||
| import com.iformall.utils.sign.AppUtils; | import com.iformall.utils.sign.AppUtils; | ||||
| import org.apache.commons.beanutils.BeanUtils; | import org.apache.commons.beanutils.BeanUtils; | ||||
| @@ -35,6 +31,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Lazy; | import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.data.redis.core.StringRedisTemplate; | import org.springframework.data.redis.core.StringRedisTemplate; | ||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Propagation; | |||||
| import org.springframework.transaction.annotation.Transactional; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| @@ -78,6 +76,9 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Autowired | @Autowired | ||||
| WxCardInfoService wxCardInfoService; | WxCardInfoService wxCardInfoService; | ||||
| @Autowired | |||||
| WxCardSetPriceService wxCardSetPriceService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | ||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findList(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findList(record)); | ||||
| @@ -341,12 +342,45 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Integer setPrice(WxCouponPassword wxCouponPassword) { | |||||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(wxCouponPassword.getId(), wxCouponPassword); | |||||
| if (null == cardInfo) { | |||||
| return wxCouponPasswordMapper.setPrice(wxCouponPassword); | |||||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||||
| public Integer setPrice(WxCouponPassword wxCouponPassword,MallUserInfo user) { | |||||
| WxCouponPassword couponPassword = this.getById(wxCouponPassword.getId()); | |||||
| if(couponPassword == null){ | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_NOT_FOUND.getCode(),"卡未找到"); | |||||
| } | |||||
| if(wxCouponPassword.getPrice() == null || wxCouponPassword.getPrice() < 0){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"价格参数异常"); | |||||
| } | |||||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(couponPassword.getId(), couponPassword); | |||||
| if(cardInfo != null){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"卡已激活"); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponMapper.selectById(couponPassword.getCouponId(), couponPassword.getTenantId()); | |||||
| if(wxCoupon == null){ | |||||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); | |||||
| } | |||||
| if(!EnumCouponType.CARD_MULTIMCH.getCode().equals(wxCoupon.getType()) | |||||
| || !EnumYesOrNo.YES.getCode().equals(wxCoupon.getIsAfterSetPrice())){ | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"当前不是后置类型"); | |||||
| } | |||||
| WxCouponPassword wxCouponPasswordUpd = new WxCouponPassword(); | |||||
| wxCouponPasswordUpd.setId(couponPassword.getId()); | |||||
| wxCouponPasswordUpd.updateTenantInfo(couponPassword); | |||||
| wxCouponPasswordUpd.setPrice(wxCouponPassword.getPrice()); | |||||
| Integer count = wxCouponPasswordMapper.setPrice(wxCouponPasswordUpd); | |||||
| if(count > 0){ | |||||
| //设置面额记录 | |||||
| WxCardSetPrice cardSetPrice = new WxCardSetPrice(); | |||||
| cardSetPrice.updateTenantInfo(wxCouponPasswordUpd); | |||||
| cardSetPrice.setCardPasswordId(wxCouponPasswordUpd.getId()); | |||||
| cardSetPrice.setPrice(wxCouponPasswordUpd.getPrice()); | |||||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||||
| cardSetPrice.setOperatorId(user.getId()); | |||||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||||
| wxCardSetPriceService.saveOrUpdate(cardSetPrice); | |||||
| } | } | ||||
| return 0; | |||||
| return count; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -388,7 +422,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| password.updateTenantInfo(user); | password.updateTenantInfo(user); | ||||
| password.setId(Long.parseLong(template.getCouponPasswordId())); | password.setId(Long.parseLong(template.getCouponPasswordId())); | ||||
| password.setPrice(new BigDecimal(template.getPrice()).multiply(new BigDecimal(100)).intValue()); | password.setPrice(new BigDecimal(template.getPrice()).multiply(new BigDecimal(100)).intValue()); | ||||
| Integer count = setPrice(password); | |||||
| Integer count = setPrice(password,user); | |||||
| if (null != count && count > 0 ) { | if (null != count && count > 0 ) { | ||||
| }else { | }else { | ||||
| stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); | ||||
| @@ -1046,21 +1046,21 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return false; | return false; | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||||
| public ResultData setPrice(WxCoupon record) { | |||||
| Integer count = wxCouponMapper.setPrice(record); | |||||
| if (null == count || count <= 0 ) { | |||||
| 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(); | |||||
| } | |||||
| // @Override | |||||
| // @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||||
| // public ResultData setPrice(WxCoupon record) { | |||||
| // Integer count = wxCouponMapper.setPrice(record); | |||||
| // if (null == count || count <= 0 ) { | |||||
| // 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(); | |||||
| // } | |||||
| @Override | @Override | ||||
| public ResultData updateTtProduct(WxCoupon record) { | public ResultData updateTtProduct(WxCoupon record) { | ||||
| @@ -0,0 +1,64 @@ | |||||
| <?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.iformall.mapper.WxCardSetPriceMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardSetPrice"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="card_password_id" jdbcType="BIGINT" property="cardPasswordId"/> | |||||
| <result column="ip" jdbcType="VARCHAR" property="ip"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="operator_type" jdbcType="INTEGER" property="operatorType"/> | |||||
| <result column="operator_id" jdbcType="BIGINT" property="operatorId"/> | |||||
| <result column="operator_user" jdbcType="VARCHAR" property="operatorUser"/> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`card_password_id`,`ip`,`create_date`,`update_date`, | |||||
| `price`,`operator_type`,`operator_id`,`operator_user`, `remark` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != cardPasswordId "> | |||||
| and `card_password_id` = #{cardPasswordId} | |||||
| </if> | |||||
| <if test=" null != operatorType "> | |||||
| and `operator_type` = #{operatorType} | |||||
| </if> | |||||
| <if test=" null != operatorId "> | |||||
| and `operator_id` = #{operatorId} | |||||
| </if> | |||||
| <if test=" null != operatorUser and '' != operatorUser"> | |||||
| and `operator_user` like concat('%', #{operatorUser},'%') | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardSetPrice" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_card_set_price | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||