| @@ -5,10 +5,15 @@ import com.iformall.annotation.SystemControllerLog; | |||||
| 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.BaseEntity; | |||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxCouponPresent; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.enums.EnumCouponPasswordStatus; | |||||
| import com.iformall.enums.EnumCouponStatus; | |||||
| import com.iformall.enums.EnumCouponValidType; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.PushLimitService; | |||||
| import com.iformall.service.WxCouponPasswordService; | |||||
| import com.iformall.service.WxCouponPresentService; | import com.iformall.service.WxCouponPresentService; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiImplicitParam; | import io.swagger.annotations.ApiImplicitParam; | ||||
| import io.swagger.annotations.ApiImplicitParams; | import io.swagger.annotations.ApiImplicitParams; | ||||
| @@ -18,6 +23,11 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.util.Date; | |||||
| import java.util.HashSet; | |||||
| import java.util.List; | |||||
| import java.util.Set; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @@ -30,6 +40,15 @@ public class WxCouponPresentController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponPresentService wxCouponPresentService; | private WxCouponPresentService wxCouponPresentService; | ||||
| @Autowired | |||||
| PushLimitService pushLimitService; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | |||||
| WxCouponPasswordService wxCouponPasswordService; | |||||
| @ApiOperation("分页列表接口") | @ApiOperation("分页列表接口") | ||||
| @GetMapping("/list") | @GetMapping("/list") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -67,12 +86,48 @@ public class WxCouponPresentController extends BaseController { | |||||
| if (wxCouponPresent.getPhones().isEmpty()) { | if (wxCouponPresent.getPhones().isEmpty()) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写手机号"); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "请填写手机号"); | ||||
| } | } | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| wxCouponPresent.setTenantId(user.getTenantId()); | |||||
| wxCouponPresent.setUserId(user.getId()); | wxCouponPresent.setUserId(user.getId()); | ||||
| wxCouponPresent.setTenantId(user.getTenantId()); | |||||
| try { | |||||
| pushLimitService.checkSendTime(user.getTenantId()); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponPresent.getCouponId()); | |||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围 | |||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | |||||
| } | |||||
| } | |||||
| if (!wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode())) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| //获取手机号 | |||||
| String phones = wxCouponPresent.getPhones(); | |||||
| String[] phoneSplit = phones.split(","); | |||||
| Set<String> phoneSet = new HashSet<>(phoneSplit.length); | |||||
| for (String phone : phoneSplit) { | |||||
| if (!phone.isEmpty()) { | |||||
| phoneSet.add(phone); | |||||
| } | |||||
| } | |||||
| //查询有效券数量 | |||||
| WxCouponPassword wxCouponPassword = new WxCouponPassword(); | |||||
| wxCouponPassword.setTenantId(user.getTenantId()); | |||||
| wxCouponPassword.setCouponId(wxCouponPresent.getCouponId()); | |||||
| wxCouponPassword.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | |||||
| List<WxCouponPassword> list = wxCouponPasswordService.findList(wxCouponPassword); | |||||
| if (phoneSet.size() > list.size()) { | |||||
| logger.info(ErrorCode.REMAIN_IS_EMPTY.getMessage()); | |||||
| return new ResultData(ErrorCode.REMAIN_IS_EMPTY); | |||||
| } | |||||
| return wxCouponPresentService.add(wxCouponPresent); | |||||
| wxCouponPresent.setCouponName(wxCoupon.getTitle()); | |||||
| wxCouponPresentService.add(wxCouponPresent, list, phoneSet); | |||||
| return new ResultData(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -68,28 +68,31 @@ public class WxCouponPasswordController extends BaseController { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | ||||
| } | } | ||||
| // 2. 设置已使用 | |||||
| try { | |||||
| WxCouponPassword updateCouponPwd = new WxCouponPassword(); | |||||
| updateCouponPwd.setId(couponPassword.getId()); | |||||
| updateCouponPwd.setStatus(EnumCouponPasswordStatus.USED.getCode()); | |||||
| couponPassword.setStatus(EnumCouponPasswordStatus.USED.getCode()); | |||||
| couponPasswordService.saveOrUpdate(updateCouponPwd); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.DB_FAIL); | |||||
| } | |||||
| // 卡密领取卡券 | |||||
| Integer pwdStatus = couponPassword.getStatus(); | |||||
| setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.USED); | |||||
| couponPassword.setStatus(EnumCouponPasswordStatus.USED.getCode()); | |||||
| // 3. 领取free coupon | // 3. 领取free coupon | ||||
| try { | try { | ||||
| WxOrder order = orderService.saveFreeOrderForCoupon(cuUser, coupon, null, formId, couponPassword.getId()); | WxOrder order = orderService.saveFreeOrderForCoupon(cuUser, coupon, null, formId, couponPassword.getId()); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.getEnum(pwdStatus)); | |||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| setCouponPasswordStatus(couponPassword, EnumCouponPasswordStatus.getEnum(pwdStatus)); | |||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(500, e.getMessage()); | return new ResultData(500, e.getMessage()); | ||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| private void setCouponPasswordStatus(WxCouponPassword couponPassword, EnumCouponPasswordStatus pwdStatus) { | |||||
| WxCouponPassword updateCouponPwd = new WxCouponPassword(); | |||||
| updateCouponPwd.setId(couponPassword.getId()); | |||||
| updateCouponPwd.setStatus(pwdStatus.getCode()); | |||||
| couponPasswordService.saveOrUpdate(updateCouponPwd); | |||||
| } | |||||
| } | } | ||||
| @@ -223,8 +223,8 @@ public enum ErrorCode{ | |||||
| * 卡密 | * 卡密 | ||||
| */ | */ | ||||
| COUPON_PASSWORD_NOT_FOUND(9501, "兑换码未找到"), | COUPON_PASSWORD_NOT_FOUND(9501, "兑换码未找到"), | ||||
| COUPON_PASSWORD_HAD_USED(9502, "兑换码已失效"), | |||||
| COUPON_PASSWORD_IS_CANCELED(9503, "兑换码已失效"), | |||||
| COUPON_PASSWORD_HAD_USED(9502, "兑换码已使用"), | |||||
| COUPON_PASSWORD_IS_CANCELED(9503, "兑换码已作废"), | |||||
| /** | /** | ||||
| * 微信 | * 微信 | ||||
| @@ -6,6 +6,7 @@ import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| public interface WxCouponPasswordService { | public interface WxCouponPasswordService { | ||||
| @@ -67,4 +68,5 @@ public interface WxCouponPasswordService { | |||||
| PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize); | PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize); | ||||
| List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword); | |||||
| } | } | ||||
| @@ -2,8 +2,12 @@ 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.WxCouponPassword; | |||||
| import com.iformall.domain.po.WxCouponPresent; | import com.iformall.domain.po.WxCouponPresent; | ||||
| import java.util.List; | |||||
| import java.util.Set; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @@ -14,6 +18,6 @@ public interface WxCouponPresentService { | |||||
| WxCouponPresent findById(Long id); | WxCouponPresent findById(Long id); | ||||
| ResultData add(WxCouponPresent wxCouponPresent); | |||||
| ResultData add(WxCouponPresent wxCouponPresent, List<WxCouponPassword> list, Set<String> phoneSet); | |||||
| } | } | ||||
| @@ -47,10 +47,13 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Override | @Override | ||||
| public WxCouponPassword getByObj(WxCouponPassword obj) { | public WxCouponPassword getByObj(WxCouponPassword obj) { | ||||
| String errMsg = "兑换码已失效"; | |||||
| List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findList(obj); | List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findList(obj); | ||||
| if (pwdList.size() <= 0) { | if (pwdList.size() <= 0) { | ||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_NOT_FOUND); | |||||
| logger.error(ErrorCode.COUPON_PASSWORD_NOT_FOUND.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_NOT_FOUND.getCode(), errMsg); | |||||
| } | } | ||||
| WxCouponPassword password = null; | WxCouponPassword password = null; | ||||
| Integer errCode = EnumCouponPasswordStatus.INIT.getCode(); | Integer errCode = EnumCouponPasswordStatus.INIT.getCode(); | ||||
| for( WxCouponPassword pwd: pwdList) { | for( WxCouponPassword pwd: pwdList) { | ||||
| @@ -65,11 +68,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| } | } | ||||
| if (password == null) { | if (password == null) { | ||||
| if (errCode.equals(EnumCouponPasswordStatus.USED.getCode())) { | if (errCode.equals(EnumCouponPasswordStatus.USED.getCode())) { | ||||
| logger.error("卡券已使用"); | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_HAD_USED); | |||||
| logger.error(ErrorCode.COUPON_PASSWORD_HAD_USED.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_HAD_USED.getCode(), errMsg); | |||||
| } else { | } else { | ||||
| logger.error("卡券已过期或已作废"); | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_IS_CANCELED); | |||||
| logger.error(ErrorCode.COUPON_PASSWORD_IS_CANCELED.getMessage()); | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_IS_CANCELED.getCode(), errMsg); | |||||
| } | } | ||||
| } | } | ||||
| return password; | return password; | ||||
| @@ -149,9 +152,6 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| @Override | @Override | ||||
| public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword) { | public void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword) { | ||||
| List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findAvaPasswordListByCouponId(couponPassword); | List<WxCouponPassword> pwdList = wxCouponPasswordMapper.findAvaPasswordListByCouponId(couponPassword); | ||||
| if (pwdList.isEmpty()) { | |||||
| throw new MallinkException(ErrorCode.COUPON_PASSWORD_NOT_FOUND); | |||||
| } | |||||
| excelService.exportExcel(pwdList, null, "兑换码", WxCouponPassword.class, "卡兑换码.xlsx", response, false); | excelService.exportExcel(pwdList, null, "兑换码", WxCouponPassword.class, "卡兑换码.xlsx", response, false); | ||||
| } | } | ||||
| @@ -161,6 +161,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findCouponCountInfo(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findCouponCountInfo(record)); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponPassword> findList(WxCouponPassword wxCouponPassword) { | |||||
| return wxCouponPasswordMapper.findList(wxCouponPassword); | |||||
| } | |||||
| /* | /* | ||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | ||||
| @@ -2,26 +2,22 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxCouponPassword; | import com.iformall.domain.po.WxCouponPassword; | ||||
| import com.iformall.domain.po.WxCouponPresent; | import com.iformall.domain.po.WxCouponPresent; | ||||
| import com.iformall.domain.po.msg.WxMsgRecord; | import com.iformall.domain.po.msg.WxMsgRecord; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxCouponPasswordMapper; | import com.iformall.mapper.WxCouponPasswordMapper; | ||||
| import com.iformall.mapper.WxCouponPresentMapper; | import com.iformall.mapper.WxCouponPresentMapper; | ||||
| import com.iformall.mq.MqBaseProducer; | import com.iformall.mq.MqBaseProducer; | ||||
| import com.iformall.service.PushLimitService; | |||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| import com.iformall.service.WxCouponPresentService; | import com.iformall.service.WxCouponPresentService; | ||||
| import com.iformall.service.WxCouponService; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -36,12 +32,6 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponPresentMapper wxCouponPresentMapper; | WxCouponPresentMapper wxCouponPresentMapper; | ||||
| @Autowired | |||||
| PushLimitService pushLimitService; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | |||||
| @Autowired | @Autowired | ||||
| WxCouponPasswordMapper wxCouponPasswordMapper; | WxCouponPasswordMapper wxCouponPasswordMapper; | ||||
| @@ -61,56 +51,22 @@ public class WxCouponPresentServiceImpl implements WxCouponPresentService { | |||||
| return wxCouponPresentMapper.selectById(id); | return wxCouponPresentMapper.selectById(id); | ||||
| } | } | ||||
| @Async | |||||
| @Override | @Override | ||||
| public ResultData add(WxCouponPresent record) { | |||||
| public ResultData add(WxCouponPresent record, List<WxCouponPassword> list, Set<String> phoneSet) { | |||||
| String tenantId = record.getTenantId(); | String tenantId = record.getTenantId(); | ||||
| try { | |||||
| pushLimitService.checkSendTime(tenantId); | |||||
| } catch (MallinkException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | |||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围 | |||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | |||||
| } | |||||
| } | |||||
| if (!wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode())) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | |||||
| } | |||||
| //获取手机号 | |||||
| record.setCouponName(wxCoupon.getTitle()); | |||||
| String phones = record.getPhones(); | |||||
| String[] phoneSplit = phones.split(","); | |||||
| Set<String> phoneSet = new HashSet<>(phoneSplit.length); | |||||
| for (String phone : phoneSplit) { | |||||
| if (!phone.isEmpty()) { | |||||
| phoneSet.add(phone); | |||||
| } | |||||
| } | |||||
| //查询有效券数量 | |||||
| WxCouponPassword wxCouponPassword = new WxCouponPassword(); | |||||
| wxCouponPassword.setTenantId(tenantId); | |||||
| wxCouponPassword.setCouponId(record.getCouponId()); | |||||
| wxCouponPassword.setStatus(EnumCouponPasswordStatus.INIT.getCode()); | |||||
| List<WxCouponPassword> list = wxCouponPasswordMapper.findList(wxCouponPassword); | |||||
| if (phoneSet.size() > list.size()) { | |||||
| return new ResultData(ErrorCode.REMAIN_IS_EMPTY); | |||||
| } | |||||
| //添加记录 | //添加记录 | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| long id = idWorker.nextId(); | long id = idWorker.nextId(); | ||||
| record.setId(id); | record.setId(id); | ||||
| record.setCouponName(wxCoupon.getTitle()); | |||||
| record.setSendAmount(phoneSet.size()); | record.setSendAmount(phoneSet.size()); | ||||
| wxCouponPresentMapper.insert(record); | wxCouponPresentMapper.insert(record); | ||||
| //小程序 | //小程序 | ||||
| WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantId); | WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantId); | ||||
| String title = wxCoupon.getTitle(); | |||||
| String title = record.getCouponName(); | |||||
| String name = appInfo.getName(); | String name = appInfo.getName(); | ||||
| List<WxCouponPassword> tempList = wxCouponPasswordMapper.findList(wxCouponPassword); | |||||
| List<WxCouponPassword> tempList = new ArrayList<>(); | |||||
| //循环发送 | //循环发送 | ||||
| int i = 0; | int i = 0; | ||||
| for (String phone : phoneSet) { | for (String phone : phoneSet) { | ||||
| @@ -11,13 +11,9 @@ import com.iformall.enums.EnumScoreType; | |||||
| import com.iformall.enums.EnumUserType; | import com.iformall.enums.EnumUserType; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.WxCreditHistoryService; | import com.iformall.service.WxCreditHistoryService; | ||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
| import org.springframework.web.bind.annotation.GetMapping; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.annotation.Resource; | import javax.annotation.Resource; | ||||
| import java.util.*; | import java.util.*; | ||||
| @@ -35,6 +31,8 @@ public class DataInitController extends BaseController { | |||||
| @Resource | @Resource | ||||
| private WxMallMapper mallMapper; | private WxMallMapper mallMapper; | ||||
| @Resource | @Resource | ||||
| private WxMsgSignatureMapper signatureMapper; | |||||
| @Resource | |||||
| private WxMsgValidationcodeModelMapper modelMapper; | private WxMsgValidationcodeModelMapper modelMapper; | ||||
| @Resource | @Resource | ||||
| private WxCreditHistoryMapper creditHistoryMapper; | private WxCreditHistoryMapper creditHistoryMapper; | ||||
| @@ -55,14 +53,16 @@ public class DataInitController extends BaseController { | |||||
| @Resource | @Resource | ||||
| private WxMerchantBUserMapper merchantBUserMapper; | private WxMerchantBUserMapper merchantBUserMapper; | ||||
| @Resource | |||||
| private WxMerchantMapper wxMerchantMapper; | |||||
| @PostMapping("/createMsgModel") | @PostMapping("/createMsgModel") | ||||
| @ApiImplicitParam(name = "content", value = "content", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData createMsgModel(String content) { | |||||
| public ResultData createMsgModel(@RequestParam String content, @RequestParam Integer code) { | |||||
| try { | try { | ||||
| MallUserInfo userInfo = getUser(); | MallUserInfo userInfo = getUser(); | ||||
| if (userInfo.isFmSuperAdmin()) { | if (userInfo.isFmSuperAdmin()) { | ||||
| addMsgModel(content); | |||||
| addMsgModel(content, code); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| @@ -163,9 +163,9 @@ public class DataInitController extends BaseController { | |||||
| } | } | ||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public void addMsgModel(String context) { | |||||
| public void addMsgModel(String context, Integer code) { | |||||
| IdWorker idWorker = IdWorker.get(); | IdWorker idWorker = IdWorker.get(); | ||||
| addBirthDayMsgModelToMall(EnumMsgModel.COUPON_BIRTHDAY_OPENED, idWorker, context); | |||||
| addBirthDayMsgModelToMall(EnumMsgModel.getEnum(code), idWorker, context); | |||||
| } | } | ||||
| /** | /** | ||||