| @@ -230,7 +230,7 @@ public class WxCarController extends BaseController { | |||
| // check End | |||
| coupon.updateTenantInfo(tenantEntity); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(coupon); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(coupon, null); | |||
| if (resultData.code != ResultData.SUCCESS){ | |||
| return resultData; | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.iformall.controller.market; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.WxCardDailyLog; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.service.WxCardDailyLogService; | |||
| import com.iformall.service.WxCardSpendService; | |||
| 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.*; | |||
| /** | |||
| * @version 1.0 | |||
| * @Author LWH | |||
| * @date: 2023/6/26 16:53 | |||
| */ | |||
| @RestController | |||
| @RequestMapping("cardDailyLog") | |||
| @Api(description = "消费卡记录") | |||
| public class WxCardDailyLogController extends BaseController { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCardDailyLogService wxCardDailyLogService; | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData list(@ModelAttribute WxCardDailyLog wxCardDailyLog, Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] WxCouponController::list"); | |||
| if (wxCardDailyLog == null) wxCardDailyLog = new WxCardDailyLog(); | |||
| wxCardDailyLog.updateTenantInfo(getTenantInfo()); | |||
| PageInfo<WxCardDailyLog> info = wxCardDailyLogService.listAsPage(wxCardDailyLog, pageNum, pageSize); | |||
| return new ResultData(info); | |||
| } | |||
| } | |||
| @@ -177,7 +177,7 @@ public class WxCardInfoController extends BaseController { | |||
| public ResultData startOrStop(@RequestBody WxCardInfo WxCardInfo) { | |||
| try { | |||
| WxCardInfo.updateTenantInfo(getTenantInfo()); | |||
| wxCardInfoService.startOrStop(WxCardInfo); | |||
| wxCardInfoService.startOrStop(WxCardInfo,getUser()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.COUPON_PASSWORD_POSTPONE_ERR.getCode(),"更新失败"); | |||
| @@ -9,12 +9,9 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtCouponVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.douyin.web.bean.GoodsTemplateGet; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.util.CouponCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -24,8 +21,6 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -183,7 +178,7 @@ public class WxCouponController extends BaseController { | |||
| } | |||
| wxCoupon.setSourceType(EnumCouponSourceType.COUPONSource_Admin.getCode()); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon,getUser()); | |||
| if (resultData.code != 200) { | |||
| return resultData; | |||
| } | |||
| @@ -242,9 +237,9 @@ public class WxCouponController extends BaseController { | |||
| ResultData result = null; | |||
| if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ | |||
| result = wxCouponService.disable(wxCoupon, wxCoupon.getId()); | |||
| result = wxCouponService.disable(wxCoupon, wxCoupon.getId(),getUser()); | |||
| }else{ | |||
| result = wxCouponService.saveOrUpdate(wxCoupon); | |||
| result = wxCouponService.saveOrUpdate(wxCoupon, null); | |||
| if(wxCoupon.getRemainInventory() != null){ | |||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | |||
| } | |||
| @@ -186,7 +186,7 @@ public class WxCouponPasswordController extends BaseController { | |||
| public ResultData startOrStop(@RequestBody WxCouponPassword wxCouponPassword) { | |||
| try { | |||
| wxCouponPassword.updateTenantInfo(getTenantInfo()); | |||
| wxCouponPasswordService.startOrStop(wxCouponPassword); | |||
| wxCouponPasswordService.startOrStop(wxCouponPassword,getUser()); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| return new ResultData(ErrorCode.COUPON_PASSWORD_POSTPONE_ERR.getCode(),"更新失败"); | |||
| @@ -0,0 +1,21 @@ | |||
| CREATE TABLE `wx_card_daily_log` | |||
| ( | |||
| `id` bigint(20) NOT NULL COMMENT '主键ID', | |||
| `tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '租户ID', | |||
| `parent_tenant_id` varchar(5) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '父租户ID', | |||
| `coupon_id` bigint(20) NOT NULL COMMENT '父卷Id', | |||
| `card_info_id` bigint(20) NOT NULL COMMENT '卡卷Id', | |||
| `card_password_id` bigint(20) NOT NULL COMMENT '卡密Id', | |||
| `type` int(10) NOT NULL COMMENT '操作类型 1-创建,2-设置面额,3-充值 EnumOperateType', | |||
| `ip` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ip地址', | |||
| `price` int(10) DEFAULT NULL, | |||
| `count` int(10) DEFAULT NULL, | |||
| `create_date` datetime NOT NULL COMMENT '创建时间', | |||
| `update_date` datetime NOT NULL COMMENT '更新时间', | |||
| `operator_type` smallint(1) NOT NULL COMMENT '操作人类型', | |||
| `operator_id` bigint(20) DEFAULT NULL COMMENT '操作人', | |||
| `operator_user` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, | |||
| `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', | |||
| PRIMARY KEY (`id`), | |||
| UNIQUE KEY `idx` (`id`) USING BTREE | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC; | |||
| @@ -6,7 +6,6 @@ import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.Result; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponChannel; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.po.WxFlowModel; | |||
| import com.iformall.domain.po.WxFlowRecord; | |||
| @@ -15,7 +14,6 @@ import com.iformall.domain.po.WxMerchantBUser; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.mapper.WxCouponChannelMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.service.util.CouponCacheUtils; | |||
| import com.iformall.utils.DateUtils; | |||
| @@ -24,7 +22,6 @@ import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.collections.map.HashedMap; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -209,7 +206,7 @@ public class WxCouponController extends BaseController { | |||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon); | |||
| ResultData resultData = wxCouponService.saveOrUpdate(wxCoupon, null); | |||
| if (resultData.code != 200) { | |||
| return resultData; | |||
| } | |||
| @@ -271,7 +268,7 @@ public class WxCouponController extends BaseController { | |||
| ResultData result = null; | |||
| if(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode().equals(wxCoupon.getStatus())){ | |||
| result = wxCouponService.disable(wxCoupon, wxCoupon.getId()); | |||
| result = wxCouponService.disable(wxCoupon, wxCoupon.getId(), null); | |||
| }else{ | |||
| List<WxMerchant> merchantList = new ArrayList<>(); | |||
| WxMerchant wxMerchant = wxMerchantService.selectById(getLoginBUser().getMerchantId()); | |||
| @@ -279,7 +276,7 @@ public class WxCouponController extends BaseController { | |||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | |||
| result = wxCouponService.saveOrUpdate(wxCoupon); | |||
| result = wxCouponService.saveOrUpdate(wxCoupon, null); | |||
| if(wxCoupon.getRemainInventory() != null){ | |||
| redisLock.setCouponStock(wxCoupon.getId(), wxCoupon.getRemainInventory()); | |||
| } | |||
| @@ -446,7 +446,7 @@ public enum ErrorCode{ | |||
| OUT_OF_CREDIT(13103, "超出最大积分"), | |||
| MEM_IS_SIGNIN(13104, "该用户已签到"), | |||
| MEM_MONTH_IS_USED(13105, "该用户本月已领取或未到领取条件"), | |||
| SMALL_TICKET_IS_USED(13106, "小票号已存在"), | |||
| /** | |||
| * 标签 | |||
| @@ -1,20 +1,16 @@ | |||
| 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") | |||
| @TableName(value = "wx_card_daily_log") | |||
| @Data | |||
| @EqualsAndHashCode(callSuper = true) | |||
| public class WxCardSetPrice extends TenantEntity { | |||
| public class WxCardDailyLog extends TenantEntity { | |||
| protected Long id; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡密id",name="cardPasswordId") | |||
| private Long cardPasswordId; | |||
| @@ -37,4 +33,13 @@ public class WxCardSetPrice extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumUserType",name="operatorUser") | |||
| private String operatorUser; | |||
| @io.swagger.annotations.ApiModelProperty(value="父卷id",name="couponId") | |||
| private Long couponId; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡卷Id",name="cardInfoId") | |||
| private Long cardInfoId; | |||
| @io.swagger.annotations.ApiModelProperty(value="操作类型 1-创建,2-设置面额,3-充值 EnumOperateLogType",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="卡卷总数",name="count") | |||
| private Integer count; | |||
| } | |||
| @@ -0,0 +1,44 @@ | |||
| package com.iformall.enums; | |||
| import com.baomidou.mybatisplus.annotation.EnumValue; | |||
| import com.fasterxml.jackson.annotation.JsonValue; | |||
| /** | |||
| * 操作类型:0-添加;1-更新;2-删除 | |||
| */ | |||
| public enum EnumOperateLogType { | |||
| CREATE(0, "创建"), | |||
| SET_DENOMINATION(1, "设置面额"), | |||
| RECHARGE(2, "充值"), | |||
| STOP_USING(3,"停用"), | |||
| ENABLE(4,"启用"), | |||
| DISABLE(5,"作废"), | |||
| ; | |||
| public static EnumOperateLogType getEnum(Integer code) { | |||
| for (EnumOperateLogType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| @EnumValue | |||
| private final Integer code; | |||
| private final String info; | |||
| EnumOperateLogType(Integer code, String info) { | |||
| this.code = code; | |||
| this.info = info; | |||
| } | |||
| @JsonValue | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getInfo() { | |||
| return info; | |||
| } | |||
| } | |||
| @@ -0,0 +1,12 @@ | |||
| package com.iformall.mapper; | |||
| import com.iformall.common.CommonMapper; | |||
| import com.iformall.domain.po.WxCardDailyLog; | |||
| import java.util.List; | |||
| public interface WxCardDailyLogMapper extends CommonMapper<WxCardDailyLog, Long> { | |||
| List<WxCardDailyLog> findList(WxCardDailyLog wxCardSpend); | |||
| } | |||
| @@ -1,14 +0,0 @@ | |||
| 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); | |||
| } | |||
| @@ -3,7 +3,7 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.domain.po.*; | |||
| public interface WxCardSetPriceService { | |||
| public interface WxCardDailyLogService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -13,7 +13,7 @@ public interface WxCardSetPriceService { | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxCardSetPrice> listAsPage(WxCardSetPrice record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| @@ -21,6 +21,6 @@ public interface WxCardSetPriceService { | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCardSetPrice record); | |||
| void saveOrUpdate(WxCardDailyLog record); | |||
| } | |||
| @@ -52,7 +52,7 @@ public interface WxCardInfoService { | |||
| void exportData(WxCardVo wxCardVo, HttpServletRequest request, HttpServletResponse response); | |||
| void startOrStop(WxCardInfo cardInfo); | |||
| void startOrStop(WxCardInfo cardInfo, MallUserInfo user); | |||
| PageInfo<WxCardTransferVo> listTransferAsPage(WxCardTransferInfo transferRecord, Integer pageIndex, Integer pageSize); | |||
| @@ -5,9 +5,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxCoupon; | |||
| import com.iformall.domain.po.WxCouponPassword; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCardPriceTemplate; | |||
| import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||
| import com.iformall.enums.EnumCUserFrom; | |||
| @@ -64,11 +62,13 @@ public interface WxCouponPasswordService { | |||
| /** | |||
| * 生产卡密 | |||
| * | |||
| * @param tenantEntity | |||
| * @param couponId | |||
| * @param inventory | |||
| * @param user | |||
| */ | |||
| void mkPasswords(WxCoupon coupon); | |||
| void mkPasswords(WxCoupon coupon, MallUserInfo user); | |||
| /** | |||
| * 导出兑换码 | |||
| @@ -84,7 +84,7 @@ public interface WxCouponPasswordService { | |||
| void postpone(WxCouponPassword wxCouponPassword); | |||
| void startOrStop(WxCouponPassword wxCouponPassword); | |||
| void startOrStop(WxCouponPassword wxCouponPassword, MallUserInfo user); | |||
| Integer setPrice(WxCouponPassword wxCouponPassword,MallUserInfo user); | |||
| @@ -9,7 +9,6 @@ import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.TtCouponVo; | |||
| import com.iformall.domain.vo.WxCouponCVo; | |||
| import com.iformall.domain.vo.WxCouponStatisVo; | |||
| import com.iformall.domain.vo.WxMerchantVo; | |||
| @@ -87,8 +86,9 @@ public interface WxCouponService { | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| * @param user | |||
| */ | |||
| ResultData saveOrUpdate(WxCoupon record); | |||
| ResultData saveOrUpdate(WxCoupon record, MallUserInfo user); | |||
| // ResultData setPrice(WxCoupon record); | |||
| @@ -281,11 +281,13 @@ public interface WxCouponService { | |||
| /** | |||
| * 作废卷 | |||
| * | |||
| * @param tenantInfo | |||
| * @param couponId | |||
| * @param user | |||
| * @return | |||
| */ | |||
| ResultData disable(TenantEntity tenantInfo, Long couponId); | |||
| ResultData disable(TenantEntity tenantInfo, Long couponId, MallUserInfo user); | |||
| void setParentCouponMallMerchants(TenantEntity mallTenantEntity,WxCoupon wxCoupon) throws Exception; | |||
| @@ -0,0 +1,46 @@ | |||
| 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.*; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.service.*; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.*; | |||
| @Service | |||
| public class WxCardDailyLogServiceImpl implements WxCardDailyLogService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @Autowired | |||
| WxCardDailyLogMapper wxCardDailyLogMapper; | |||
| @Override | |||
| public PageInfo<WxCardDailyLog> listAsPage(WxCardDailyLog record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCardDailyLogMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCardDailyLog 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); | |||
| wxCardDailyLogMapper.insert(record); | |||
| } else { | |||
| record.setUpdateDate(now); | |||
| wxCardDailyLogMapper.updateById(record); | |||
| } | |||
| } | |||
| } | |||
| @@ -11,8 +11,6 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxCardTransferVo; | |||
| import com.iformall.domain.vo.WxCardVo; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.*; | |||
| @@ -34,7 +32,6 @@ import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.lang.reflect.InvocationTargetException; | |||
| import java.math.BigDecimal; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| @@ -84,7 +81,8 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| @Autowired | |||
| WxCardSpendService wxCardSpendService; | |||
| @Autowired | |||
| WxCardDailyLogService wxCardDailyLogService; | |||
| @Override | |||
| public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) { | |||
| handleQueryParam(record); | |||
| @@ -356,7 +354,21 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| } | |||
| @Override | |||
| public void startOrStop(WxCardInfo cardInfo) { | |||
| public void startOrStop(WxCardInfo cardInfo, MallUserInfo user) { | |||
| try { | |||
| WxCardInfo wxCardInfo = wxCardInfoMapper.selectById(cardInfo.getId()); | |||
| WxCoupon wxCoupon = wxCouponMapper.selectById(wxCardInfo.getCouponId(), wxCardInfo.getTenantId()); | |||
| Integer type = cardInfo.getStatus() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode(); | |||
| String remark = user.getUsername() + "给卡密[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(type).getInfo(); | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon, type, remark); | |||
| }catch (Exception e){ | |||
| logger.error("startOrStop insert error"); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "startOrStop 插入出错!"); | |||
| } | |||
| wxCardInfoMapper.updateStatus(cardInfo); | |||
| } | |||
| @@ -509,6 +521,9 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "card spend 插入出错!"); | |||
| } | |||
| String remark = user.getUsername() + "给卡密[" + wxCardInfo.getId() + "]" + "充值,金额:" + wxCardInfo.getAmount() + "分"; | |||
| insertWxCardDailyLogInfo(user, wxCardInfo, wxCoupon,EnumOperateLogType.RECHARGE.getCode(),remark); | |||
| if(record.getCardBeforeAmount().equals(0)){ | |||
| if (wxCardSpendService.cardFinishedUsing(currentDate, cardInfo)) { | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "couponOrder status 更新出错!"); | |||
| @@ -520,6 +535,27 @@ public class WxCardInfoServiceImpl implements WxCardInfoService { | |||
| } | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCardInfo wxCardInfo, WxCoupon wxCoupon, Integer code, String remark) { | |||
| try { | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| cardSetPrice.updateTenantInfo(wxCardInfo); | |||
| cardSetPrice.setCardPasswordId(wxCardInfo.getCouponPasswordId()); | |||
| cardSetPrice.setPrice(wxCardInfo.getAmount()); | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| cardSetPrice.setCouponId(wxCoupon.getId()); | |||
| cardSetPrice.setCardInfoId(wxCardInfo.getId()); | |||
| cardSetPrice.setType(code); | |||
| cardSetPrice.setCount(1); | |||
| cardSetPrice.setRemark(remark); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| } catch (Exception e) { | |||
| logger.error("insertWxCardDailyLogInfo insert error"); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "insertWxCardDailyLogInfo 插入出错!"); | |||
| } | |||
| } | |||
| private List<WxCardTransferVo> toTransferVoList(List<WxCardTransferInfo> transferList,TenantEntity tenantEntity) { | |||
| List<WxCardTransferVo> retList = new ArrayList<WxCardTransferVo>(); | |||
| if (null != transferList && transferList.size() > 0 ) { | |||
| @@ -1,70 +0,0 @@ | |||
| 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); | |||
| } | |||
| } | |||
| } | |||
| @@ -4,17 +4,12 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.common.SysConfigConstant; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||
| import com.iformall.domain.vo.WxCardPriceTemplate; | |||
| import com.iformall.domain.vo.WxCardSpendVo; | |||
| import com.iformall.domain.vo.WxCouponOrderBVo; | |||
| import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||
| import com.iformall.domain.vo.WxCouponPasswordVo; | |||
| import com.iformall.domain.vo.WxMerchantProductVo; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCardInfoMapper; | |||
| @@ -22,8 +17,6 @@ import com.iformall.mapper.WxCouponMapper; | |||
| import com.iformall.mapper.WxCouponPasswordMapper; | |||
| import com.iformall.service.*; | |||
| import com.iformall.utils.sign.AppUtils; | |||
| import org.apache.commons.beanutils.BeanUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -37,13 +30,10 @@ 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.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.Iterator; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.Random; | |||
| @@ -77,7 +67,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| WxCardInfoService wxCardInfoService; | |||
| @Autowired | |||
| WxCardSetPriceService wxCardSetPriceService; | |||
| WxCardDailyLogService wxCardDailyLogService; | |||
| @Override | |||
| public PageInfo<WxCouponPassword> listAsPage(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | |||
| @@ -237,7 +227,7 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| } | |||
| @Override | |||
| public void mkPasswords(WxCoupon coupon) { | |||
| public void mkPasswords(WxCoupon coupon, MallUserInfo user) { | |||
| String strAll = "0123456789abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ"; | |||
| // 1.获取 coupon short 1 | |||
| int couponShort = 0; | |||
| @@ -337,11 +327,37 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| } | |||
| @Override | |||
| public void startOrStop(WxCouponPassword wxCouponPassword) { | |||
| wxCouponPasswordMapper.updateIsStop(wxCouponPassword.getTenantId(), wxCouponPassword.getId(), wxCouponPassword.getIsStop()); | |||
| public void startOrStop(WxCouponPassword wxCouponPassword, MallUserInfo user) { | |||
| insertWxCardDailyLogInfo(wxCouponPassword, user); | |||
| wxCouponPasswordMapper.updateIsStop(wxCouponPassword.getTenantId(), wxCouponPassword.getId(), wxCouponPassword.getIsStop()); | |||
| } | |||
| @Override | |||
| public void insertWxCardDailyLogInfo(WxCouponPassword wxCouponPassword, MallUserInfo user) { | |||
| try { | |||
| WxCouponPassword couponPassword = this.getById(wxCouponPassword.getId()); | |||
| WxCardInfo cardInfo = wxCardInfoService.getByCouponPasswordId(couponPassword.getId(), couponPassword); | |||
| WxCoupon wxCoupon = wxCouponMapper.selectById(couponPassword.getCouponId(), couponPassword.getTenantId()); | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| cardSetPrice.updateTenantInfo(wxCouponPassword); | |||
| cardSetPrice.setCardPasswordId(wxCouponPassword.getId()); | |||
| cardSetPrice.setPrice(cardInfo.getAmount()); | |||
| cardSetPrice.setOperatorType(EnumUserType.MALLUSER.getCode()); | |||
| cardSetPrice.setOperatorId(user.getId()); | |||
| cardSetPrice.setOperatorUser(user.getUsername()); | |||
| cardSetPrice.setCouponId(wxCoupon.getId()); | |||
| cardSetPrice.setCardInfoId(cardInfo.getId()); | |||
| cardSetPrice.setType(wxCouponPassword.getIsStop() == 0 ? EnumOperateLogType.ENABLE.getCode() : EnumOperateLogType.STOP_USING.getCode()); | |||
| cardSetPrice.setCount(1); | |||
| cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardInfo.getId() + "]" + EnumOperateLogType.getEnum(cardSetPrice.getType()).getInfo()); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| }catch (Exception e){ | |||
| logger.error("startOrStop insert error"); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "startOrStop 插入出错!"); | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public Integer setPrice(WxCouponPassword wxCouponPassword,MallUserInfo user) { | |||
| @@ -371,14 +387,18 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||
| Integer count = wxCouponPasswordMapper.setPrice(wxCouponPasswordUpd); | |||
| if(count > 0){ | |||
| //设置面额记录 | |||
| WxCardSetPrice cardSetPrice = new WxCardSetPrice(); | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| 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); | |||
| cardSetPrice.setCouponId(wxCouponPassword.getCouponId()); | |||
| cardSetPrice.setType(EnumOperateLogType.SET_DENOMINATION.getCode()); | |||
| cardSetPrice.setCount(1); | |||
| cardSetPrice.setRemark(user.getUsername() + "给卡密[" + cardSetPrice.getCardInfoId() + "]设置了面额,金额:" + cardSetPrice.getPrice() + "分"); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| } | |||
| return count; | |||
| } | |||
| @@ -35,6 +35,7 @@ import com.iformall.service.pay.PayServiceFactory; | |||
| import com.iformall.service.pay.service.share.PayShareAdapterService; | |||
| import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import io.swagger.models.auth.In; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| @@ -157,6 +158,9 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Autowired | |||
| WxMallMapper wxMallMapper; | |||
| @Autowired | |||
| WxCardDailyLogService wxCardDailyLogService; | |||
| @Override | |||
| public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { | |||
| if (null == wxCoupon) wxCoupon = new WxCoupon(); | |||
| @@ -465,7 +469,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Override | |||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData saveOrUpdate(WxCoupon record) { | |||
| public ResultData saveOrUpdate(WxCoupon record, MallUserInfo user) { | |||
| //金额处理 | |||
| if (StringUtils.isNotEmpty(record.getSalePriceStr())) { | |||
| record.setSalePrice(new BigDecimal(record.getSalePriceStr()).multiply(new BigDecimal(100)).intValue()); | |||
| @@ -644,7 +648,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| if (record.getPasswordSupport() != null && record.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) { | |||
| // todo 生成卡密无法修改, 调整 | |||
| couponPasswordService.mkPasswords(record); | |||
| couponPasswordService.mkPasswords(record,user); | |||
| } | |||
| record.setCreateDate(new Date()); | |||
| @@ -654,6 +658,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| } | |||
| wxCouponMapper.insert(record); | |||
| insertWxCardDailyLogInfo(user, record, true); | |||
| } else { | |||
| if(EnumCouponType.getDouYinType().contains(record.getType())){ | |||
| TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(record.getTenantId(),record.getId()); | |||
| @@ -1795,7 +1801,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| @Override | |||
| @Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | |||
| public ResultData disable(TenantEntity tenantInfo, Long couponId) { | |||
| public ResultData disable(TenantEntity tenantInfo, Long couponId, MallUserInfo user) { | |||
| WxCoupon couponUpd = new WxCoupon(); | |||
| couponUpd.updateTenantInfo(tenantInfo); | |||
| couponUpd.setId(couponId); | |||
| @@ -1820,11 +1826,35 @@ public class WxCouponServiceImpl implements WxCouponService { | |||
| //同步抖音状态 | |||
| wxCouponChannelService.spuStatusSyncByCoupon(tenantInfo,couponId); | |||
| WxCoupon record = wxCouponMapper.selectById(couponId, tenantInfo.getTenantId()); | |||
| insertWxCardDailyLogInfo(user, record,false); | |||
| } | |||
| return new ResultData(); | |||
| } | |||
| @Override | |||
| public void insertWxCardDailyLogInfo(MallUserInfo user, WxCoupon record, Boolean flag) { | |||
| if (EnumCouponType.CARD_MULTIMCH.getCode().equals(record.getType())) { | |||
| try { | |||
| WxCardDailyLog cardSetPrice = new WxCardDailyLog(); | |||
| cardSetPrice.updateTenantInfo(record); | |||
| cardSetPrice.setPrice(flag ? record.getPrice() : record.getRemainInventory()); | |||
| cardSetPrice.setCouponId(record.getId()); | |||
| cardSetPrice.setType(flag ? EnumOperateLogType.CREATE.getCode() : EnumOperateLogType.DISABLE.getCode()); | |||
| cardSetPrice.setCount(record.getInventory()); | |||
| cardSetPrice.setOperatorType(user != null ? EnumUserType.MALLUSER.getCode() : 0); | |||
| cardSetPrice.setOperatorId(user != null ? user.getId() : 0); | |||
| cardSetPrice.setOperatorUser(user != null ? user.getUsername() : ""); | |||
| cardSetPrice.setRemark((user != null ? user.getUsername() : "") + "创建了卡[" + record.getTitle() + "]" + "库存:" + cardSetPrice.getPrice()); | |||
| wxCardDailyLogService.saveOrUpdate(cardSetPrice); | |||
| } catch (Exception e) { | |||
| logger.error("insertWxCardDailyLogInfo insert error"); | |||
| throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "insertWxCardDailyLogInfo 插入出错!"); | |||
| } | |||
| } | |||
| } | |||
| @Override | |||
| public void setParentCouponMallMerchants(TenantEntity mallTenantEntity,WxCoupon wxCoupon) throws Exception { | |||
| try { | |||
| WxCoupon coupon = wxCouponMapper.selectById(wxCoupon.getId(), mallTenantEntity.getParentTenantId()); | |||
| @@ -2,6 +2,7 @@ package com.iformall.service.impl; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.google.common.collect.Maps; | |||
| @@ -587,6 +588,10 @@ public class WxCreditHistoryServiceImpl implements WxCreditHistoryService { | |||
| @Override | |||
| @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) | |||
| public WxCreditHistory saveOrUpdate(WxCreditHistory record,TenantEntity tenantEntity) { | |||
| WxCreditHistory history = wxCreditHistoryMapper.selectOne(new LambdaQueryWrapper<WxCreditHistory>().eq(WxCreditHistory::getTicketNumber, record.getTicketNumber())); | |||
| if (history == null){ | |||
| throw new MallinkException(ErrorCode.SMALL_TICKET_IS_USED); | |||
| } | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoMapper.selectById(record.getCUserId(),record.getTenantId()); | |||
| if (wxCUserBasicInfo == null) { | |||
| //验证此用户是否存在 | |||
| @@ -13,7 +13,6 @@ import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.BaseEntity; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.po.tt.TtCoupon; | |||
| import com.iformall.domain.po.tt.TtUserFollow; | |||
| import com.iformall.domain.vo.*; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| @@ -24,7 +23,6 @@ import com.iformall.utils.Constant; | |||
| import com.iformall.utils.DateUtils; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.apache.commons.collections.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| @@ -506,7 +504,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { | |||
| List<Long> couponIds = wxCouponMerchantList.stream().map(cm -> cm.getProductId()).collect(Collectors.toList()); | |||
| couponIds.stream().filter(cid -> !isCouponMerchantValid(cid,wxCouponMerchant)).forEach(cid -> { | |||
| wxCouponService.disable(wxMerchant,cid); | |||
| wxCouponService.disable(wxMerchant,cid, null); | |||
| CouponCacheUtils.removeCouponMerchantCache(redisTemplate, cid); | |||
| }); | |||
| } | |||
| @@ -1,7 +1,7 @@ | |||
| <?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"> | |||
| <mapper namespace="com.iformall.mapper.WxCardDailyLogMapper"> | |||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCardDailyLog"> | |||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||
| @@ -53,7 +53,7 @@ | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardSetPrice" resultMap="BaseResultMap"> | |||
| <select id="findList" parameterType="com.iformall.domain.po.WxCardDailyLog" resultMap="BaseResultMap"> | |||
| select | |||
| <include refid="allColumns"/> | |||
| from wx_card_set_price | |||