| @@ -169,8 +169,8 @@ public class WxCampaignController extends BaseController { | |||||
| wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | wxCouponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_CAMPAIN.getCode()); | ||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | wxCouponChannel.setSubTargetId(wxCampaign.getId()); | ||||
| wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCouponChannel.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| List<WxCouponChannelVo> couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| wxCampaign.setCoupons(couponList); | |||||
| List<WxCouponChannelVo> voList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| wxCampaign.setCoupons(voList); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||
| @@ -24,10 +24,7 @@ import org.apache.commons.lang3.StringUtils; | |||||
| 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.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import org.springframework.web.context.request.RequestContextHolder; | import org.springframework.web.context.request.RequestContextHolder; | ||||
| import org.springframework.web.context.request.ServletRequestAttributes; | import org.springframework.web.context.request.ServletRequestAttributes; | ||||
| @@ -521,4 +518,19 @@ public class WxInfoController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("查询c小程序首页风格") | |||||
| @GetMapping("/getAppMouldType") | |||||
| public ResultData getAppMouldType(Integer plat) { | |||||
| logger.debug("[" + getIpAddr() + "] WxAppinfoController::getAppMouldType"); | |||||
| // if(plat == null){ | |||||
| // plat = EnumAppPlat.WX.getCode(); | |||||
| // } | |||||
| // EnumAppPlat byCode = EnumAppPlat.getByCode(plat); | |||||
| // if(byCode == null){ | |||||
| // return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| // } | |||||
| WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(getTenantInfo().getTenantId(), null); | |||||
| return new ResultData(cAppInfo); | |||||
| } | |||||
| } | } | ||||
| @@ -7,7 +7,6 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.base.BaseEntity; | import com.iformall.domain.po.base.BaseEntity; | ||||
| import com.iformall.domain.po.WxCampaign; | import com.iformall.domain.po.WxCampaign; | ||||
| import com.iformall.domain.po.WxCouponChannel; | import com.iformall.domain.po.WxCouponChannel; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.domain.vo.WxCouponChannelVo; | import com.iformall.domain.vo.WxCouponChannelVo; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.service.WxCampaignService; | import com.iformall.service.WxCampaignService; | ||||
| @@ -37,6 +36,7 @@ import java.util.List; | |||||
| @RequestMapping("/api/wxCampaign") | @RequestMapping("/api/wxCampaign") | ||||
| @Api(description = "促销和banner接口") | @Api(description = "促销和banner接口") | ||||
| public class WxCampaignController extends BaseController { | public class WxCampaignController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | private final Logger logger = LoggerFactory.getLogger(this.getClass()); | ||||
| @Autowired | @Autowired | ||||
| @@ -77,15 +77,8 @@ public class WxCampaignController extends BaseController { | |||||
| wxCouponChannel.setSubTargetId(wxCampaign.getId()); | wxCouponChannel.setSubTargetId(wxCampaign.getId()); | ||||
| wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannel.setShowBeginTime(new Date()); | wxCouponChannel.setShowBeginTime(new Date()); | ||||
| //TODO待优化数据 | |||||
| List<WxCouponChannelVo> couponList = RedisCacheUtils.getCacheListObject(redisTemplate, "wxCampaignCoupons:"+wxCouponChannel.getTenantId(), WxCouponChannelVo.class); | |||||
| if (null == couponList) { | |||||
| couponList = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| if (null != couponList) { | |||||
| RedisCacheUtils.cache(redisTemplate, "wxCampaignCoupons:"+wxCouponChannel.getTenantId(), couponList, 3600); | |||||
| } | |||||
| } | |||||
| wxCampaign.setCoupons(couponList); | |||||
| List<WxCouponChannelVo> voList = wxCouponChannelService.newfindListVo(wxCouponChannel); | |||||
| wxCampaign.setCoupons(voList); | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | return new ResultData(Result.SUCCESS, "查询成功", wxCampaign); | ||||
| } | } | ||||
| @@ -58,14 +58,7 @@ public class WxTopicController extends BaseController { | |||||
| public ResultData findById(WxTopic wxTopic) { | public ResultData findById(WxTopic wxTopic) { | ||||
| logger.debug("[" + getIpAddr() + "] WxTopicController::findById"); | logger.debug("[" + getIpAddr() + "] WxTopicController::findById"); | ||||
| wxTopic.updateTenantInfo(getTenantInfo()); | wxTopic.updateTenantInfo(getTenantInfo()); | ||||
| //TODO 待优化数据 | |||||
| WxTopic queryTopic =RedisCacheUtils.getCacheObject(redisTemplate, "topic:"+wxTopic.getId(), WxTopic.class); | |||||
| if (null == queryTopic) { | |||||
| queryTopic = wxTopicService.findCById(wxTopic); | |||||
| if (null != queryTopic) { | |||||
| RedisCacheUtils.cache(redisTemplate, "topic:"+wxTopic.getId(), queryTopic, 3600); | |||||
| } | |||||
| } | |||||
| WxTopic queryTopic = wxTopicService.findCById(wxTopic); | |||||
| return new ResultData(queryTopic); | return new ResultData(queryTopic); | ||||
| } | } | ||||
| } | } | ||||
| @@ -23,10 +23,7 @@ import org.apache.commons.lang3.StringUtils; | |||||
| 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.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.ResponseBody; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| @@ -73,15 +70,15 @@ public class TtPayController extends BaseController { | |||||
| */ | */ | ||||
| @PostMapping(value = "/orderPay") | @PostMapping(value = "/orderPay") | ||||
| @ResponseBody | @ResponseBody | ||||
| public Map<String,Object> createOrder( HttpServletRequest request){ | |||||
| public Map<String,Object> createOrder( @RequestBody Map<String, Object> parameterMap){ | |||||
| logger.debug("[" + getIpAddr() + "] TtOrderCallbackController::createOrder"); | logger.debug("[" + getIpAddr() + "] TtOrderCallbackController::createOrder"); | ||||
| Map<String,Object> resultMap = new HashMap<>(); | Map<String,Object> resultMap = new HashMap<>(); | ||||
| String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); | |||||
| logger.info("抖音支付通知-----body{}"+body); | |||||
| // String body = ((BodyReaderHttpServletRequestWrapper) request).getBody(); | |||||
| logger.info("抖音支付通知-----body{}"+parameterMap); | |||||
| try { | try { | ||||
| Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class); | |||||
| // Map<String, Object> parameterMap = JSONObject.parseObject(body, Map.class); | |||||
| String timestamp = (String) parameterMap.get("timestamp"); | String timestamp = (String) parameterMap.get("timestamp"); | ||||
| String nonce = (String) parameterMap.get("nonce"); | String nonce = (String) parameterMap.get("nonce"); | ||||
| @@ -197,6 +197,10 @@ public class WxCoupon extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="couponId") | @io.swagger.annotations.ApiModelProperty(value="投放频道参数,用来过滤",name="couponId") | ||||
| private Long couponId; | private Long couponId; | ||||
| @TableField(exist = false) | |||||
| @io.swagger.annotations.ApiModelProperty(value = "用户积分,用来过滤", name = "userCredit") | |||||
| private Integer userCredit; | |||||
| @TableField(exist = false) | @TableField(exist = false) | ||||
| @io.swagger.annotations.ApiModelProperty(value="修改库存有效期参数, 用来做乐观锁",name="orgRemainInventory") | @io.swagger.annotations.ApiModelProperty(value="修改库存有效期参数, 用来做乐观锁",name="orgRemainInventory") | ||||
| private Integer orgRemainInventory; | private Integer orgRemainInventory; | ||||
| @@ -44,4 +44,11 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str | |||||
| List<WxCouponChannel> findQrcodeEmptyList(); | List<WxCouponChannel> findQrcodeEmptyList(); | ||||
| void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("endTime")Date endTime); | void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("endTime")Date endTime); | ||||
| /** | |||||
| * C端列表查询,尽量减少字段 | |||||
| * @param wxCouponChannel | |||||
| * @return | |||||
| */ | |||||
| List<WxCouponChannelVo> newfindCList(WxCouponChannel wxCouponChannel); | |||||
| } | } | ||||
| @@ -98,4 +98,11 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| Integer findCouponListCount(WxCoupon wxCoupon); | Integer findCouponListCount(WxCoupon wxCoupon); | ||||
| void updateValidEndDate(WxCoupon wxCoupon); | void updateValidEndDate(WxCoupon wxCoupon); | ||||
| /** | |||||
| * c端列表查询,尽量减少字段 | |||||
| * @param couponQ | |||||
| * @return | |||||
| */ | |||||
| List<WxCoupon> newfindCList(WxCoupon couponQ); | |||||
| } | } | ||||
| @@ -19,5 +19,6 @@ public interface WxCouponMerchantMapper extends CommonMapper<WxCouponMerchant, L | |||||
| List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | List<WxMerchantVo> findMerchantBaseList(@Param("productId")Long productId,@Param("tenantId")String tenantId); | ||||
| List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | List<WxMerchantProductVo> findMerchantProduct(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | ||||
| List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | List<Long> findMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantIdList")List<Long> merchantIdList); | ||||
| List<Long> findOneMerchantProductIds(@Param("tenantId")String tenantId,@Param("merchantId")Long merchantIdList); | |||||
| List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); | List<Long> findMerchantByProductIds(@Param("tenantId")String tenantId,@Param("productIds")List<Long> productIds); | ||||
| } | } | ||||
| @@ -84,4 +84,5 @@ public interface WxCouponChannelService { | |||||
| int countCoupon(WxCouponChannel wxCouponChannel, List<TenantEntity> tenantEntitys); | int countCoupon(WxCouponChannel wxCouponChannel, List<TenantEntity> tenantEntitys); | ||||
| List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel); | |||||
| } | } | ||||
| @@ -8,6 +8,7 @@ import javax.servlet.http.HttpServletResponse; | |||||
| 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.WxCoupon; | import com.iformall.domain.po.WxCoupon; | ||||
| import com.iformall.domain.po.WxCouponChannel; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.vo.WxCouponCVo; | import com.iformall.domain.vo.WxCouponCVo; | ||||
| import com.iformall.domain.vo.WxCouponStatisVo; | import com.iformall.domain.vo.WxCouponStatisVo; | ||||
| @@ -258,5 +259,7 @@ public interface WxCouponService { | |||||
| * 获取券商户map | * 获取券商户map | ||||
| * | * | ||||
| */ | */ | ||||
| Map<Long,String> getCouponMerchant(List<Long> couponIds,TenantEntity tenantEntity); | |||||
| Map<Long,String> getCouponMerchantMap(List<Long> couponIds,TenantEntity tenantEntity); | |||||
| Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity); | |||||
| } | } | ||||
| @@ -315,7 +315,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| wxCouponChannelQ.setCouponId(couponId); | wxCouponChannelQ.setCouponId(couponId); | ||||
| wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | wxCouponChannelQ.setStatus(EnumCampaignStatus.STATUS_THROW_IN.getCode()); | ||||
| wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | wxCouponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_LIST.getCode()); | ||||
| List<WxCouponChannelVo> voList = wxCouponChannelMapper.findVoList(wxCouponChannelQ); | |||||
| List<WxCouponChannelVo> voList = wxCouponChannelMapper.newfindCList(wxCouponChannelQ); | |||||
| // 不存在的, 新增 | // 不存在的, 新增 | ||||
| wxCouponChannel = new WxCouponChannel(); | wxCouponChannel = new WxCouponChannel(); | ||||
| if(voList != null && voList.size() > 0){ | if(voList != null && voList.size() > 0){ | ||||
| @@ -43,6 +43,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| @Autowired | @Autowired | ||||
| WxCouponChannelMapper wxCouponChannelMapper; | WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Autowired | @Autowired | ||||
| WxCouponMapper wxCouponMapper; | |||||
| @Autowired | |||||
| WxCouponService wxCouponService; | WxCouponService wxCouponService; | ||||
| @Autowired | @Autowired | ||||
| WxMerchantMapper wxMerchantMapper; | WxMerchantMapper wxMerchantMapper; | ||||
| @@ -252,13 +254,10 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| couponId = record.getCouponId(); | couponId = record.getCouponId(); | ||||
| record.setCouponId(null); | record.setCouponId(null); | ||||
| } | } | ||||
| //TODO 待优化数据,暂时放缓存 | |||||
| List<WxCouponChannelVo> voList = RedisCacheUtils.getCacheListObject(redisTemplate, "changeCoupon:"+record.getTenantId(), WxCouponChannelVo.class); | |||||
| if (null == voList) { | |||||
| voList = wxCouponChannelMapper.findVoList(record); | |||||
| RedisCacheUtils.cache(redisTemplate,"changeCoupon:"+record.getTenantId(), voList, 600); | |||||
| } | |||||
| if (voList.isEmpty()) { | |||||
| List<WxCouponChannelVo> voList = this.newfindListVo(record); | |||||
| if (voList == null || voList.isEmpty()) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", null); | return new ResultData(Result.SUCCESS, "查询成功", null); | ||||
| } | } | ||||
| Map<String, Object> data = new HashMap<>(); | Map<String, Object> data = new HashMap<>(); | ||||
| @@ -290,6 +289,74 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| return count; | return count; | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponChannelVo> newfindListVo(WxCouponChannel wxCouponChannel) { | |||||
| List<Long> mcids = new ArrayList<>(); | |||||
| if(wxCouponChannel.getMerchantId() != null){ | |||||
| mcids = wxCouponMerchantMapper.findOneMerchantProductIds(wxCouponChannel.getTenantId(), wxCouponChannel.getMerchantId()); | |||||
| if(mcids == null || mcids.isEmpty()){ | |||||
| return null; | |||||
| } | |||||
| } | |||||
| WxCoupon couponQ = new WxCoupon(); | |||||
| couponQ.setStatus(EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode()); | |||||
| if(wxCouponChannel.getSupportTransfer() != null){ | |||||
| couponQ.setSupportTransfer(wxCouponChannel.getSupportTransfer()); | |||||
| } | |||||
| if(wxCouponChannel.getUserCredit() != null){ | |||||
| couponQ.setUserCredit(wxCouponChannel.getUserCredit()); | |||||
| } | |||||
| if(wxCouponChannel.getSourceType() != null){ | |||||
| couponQ.setSourceType(wxCouponChannel.getSourceType()); | |||||
| } | |||||
| List<Long> cids = wxCouponMapper.findIdList(couponQ); | |||||
| if(cids == null || cids.isEmpty()){ | |||||
| return null; | |||||
| } | |||||
| cids.retainAll(mcids); | |||||
| if(cids.isEmpty()){ | |||||
| return null; | |||||
| } | |||||
| wxCouponChannel.setCouponIds(cids); | |||||
| List<WxCouponChannelVo> list = wxCouponChannelMapper.newfindCList(wxCouponChannel); | |||||
| List<Long> couponIds = list.stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); | |||||
| Map<Long,WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds,wxCouponChannel); | |||||
| for (WxCouponChannelVo cc:list) { | |||||
| WxCoupon c = couponMap.get(cc.getCouponId()); | |||||
| if(c != null){ | |||||
| cc.setRemainInventory(c.getRemainInventory()); | |||||
| cc.setInventory(c.getInventory()); | |||||
| cc.setCoverImg(c.getCoverImg()); | |||||
| cc.setSubTitle(c.getSubTitle()); | |||||
| cc.setSalePrice(c.getSalePrice()); | |||||
| cc.setUsePrice(c.getUsePrice()); | |||||
| cc.setPrice(c.getPrice()); | |||||
| cc.setTailPrice(c.getTailPrice()); | |||||
| cc.setOrigPrice(c.getOrigPrice()); | |||||
| cc.setUnit(c.getUnit()); | |||||
| cc.setUseLimitRule(c.getUseLimitRule()); | |||||
| cc.setUseLimitQuantity(c.getUseLimitQuantity()); | |||||
| cc.setSendType(c.getSendType()); | |||||
| cc.setSupportTransfer(c.getSupportTransfer()); | |||||
| cc.setPressLimitNum(c.getPressLimitNum()); | |||||
| cc.setAutoRefund(c.getAutoRefund()); | |||||
| cc.setConditions(c.getConditions()); | |||||
| cc.setValidType(c.getValidType()); | |||||
| cc.setValidStartDate(c.getValidStartDate()); | |||||
| cc.setValidEndDate(c.getValidEndDate()); | |||||
| cc.setPickStartDate(c.getPickStartDate()); | |||||
| cc.setPickEndDate(c.getPickEndDate()); | |||||
| cc.setValidDays(c.getValidDays()); | |||||
| cc.setCreditPrice(c.getCreditPrice()); | |||||
| cc.setContentType(c.getContentType()); | |||||
| cc.setSourceType(c.getSourceType()); | |||||
| } | |||||
| } | |||||
| return list; | |||||
| } | |||||
| private boolean isCouponMerchantValid(Long couponId,String tenantId) { | private boolean isCouponMerchantValid(Long couponId,String tenantId) { | ||||
| List<WxMerchantVo> merchantVoList = wxCouponMerchantMapper.findMerchantNameList(couponId,tenantId); | List<WxMerchantVo> merchantVoList = wxCouponMerchantMapper.findMerchantNameList(couponId,tenantId); | ||||
| if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | if (merchantVoList.stream().anyMatch((cm->cm.getMerchantStatus().equals(EnumMerchantStatus.VALID.getCode())))){ | ||||
| @@ -133,7 +133,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| @Autowired | @Autowired | ||||
| ExcelService excelService; | ExcelService excelService; | ||||
| @Autowired | @Autowired | ||||
| WxCreditHistoryService wxCreditHistoryService; | WxCreditHistoryService wxCreditHistoryService; | ||||
| @@ -128,7 +128,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | ||||
| pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVo(record)); | pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findListVo(record)); | ||||
| List<Long> couponIds = pageInfo.getList().stream().map(cs -> cs.getCouponId()).collect(Collectors.toList()); | List<Long> couponIds = pageInfo.getList().stream().map(cs -> cs.getCouponId()).collect(Collectors.toList()); | ||||
| Map<Long, String> couponMerchantMap = wxCouponService.getCouponMerchant(couponIds,record); | |||||
| Map<Long, String> couponMerchantMap = wxCouponService.getCouponMerchantMap(couponIds,record); | |||||
| for (WxCouponSendVo cs:pageInfo.getList()){ | for (WxCouponSendVo cs:pageInfo.getList()){ | ||||
| cs.setMerchantName(couponMerchantMap.get(cs.getCouponId())); | cs.setMerchantName(couponMerchantMap.get(cs.getCouponId())); | ||||
| cs.setSendCount(wxCouponActionLogService.getCountByChannelId(record, cs.getSendType(), cs.getId())); | cs.setSendCount(wxCouponActionLogService.getCountByChannelId(record, cs.getSendType(), cs.getId())); | ||||
| @@ -964,7 +964,7 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public Map<Long, String> getCouponMerchant(List<Long> couponIds, TenantEntity tenantEntity) { | |||||
| public Map<Long, String> getCouponMerchantMap(List<Long> couponIds, TenantEntity tenantEntity) { | |||||
| Map<Long,String> couponMerchantMap = new HashMap<Long,String>(); | Map<Long,String> couponMerchantMap = new HashMap<Long,String>(); | ||||
| if(null != couponIds && couponIds.size() > 0){ | if(null != couponIds && couponIds.size() > 0){ | ||||
| List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(),couponIds); | List<Long> merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(tenantEntity.getTenantId(),couponIds); | ||||
| @@ -999,5 +999,20 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| return couponMerchantMap; | return couponMerchantMap; | ||||
| } | } | ||||
| @Override | |||||
| public Map<Long, WxCoupon> getCouponMap(List<Long> couponIds, TenantEntity tenantEntity) { | |||||
| Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); | |||||
| if(null != couponIds && couponIds.size() > 0){ | |||||
| WxCoupon couponQ = new WxCoupon(); | |||||
| couponQ.updateTenantInfo(tenantEntity); | |||||
| couponQ.setIds(couponIds); | |||||
| List<WxCoupon> couponList = wxCouponMapper.newfindCList(couponQ); | |||||
| for (WxCoupon c:couponList) { | |||||
| couponMap.put(c.getId(),c); | |||||
| } | |||||
| } | |||||
| return couponMap; | |||||
| } | |||||
| } | } | ||||
| @@ -230,16 +230,10 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); | couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); | ||||
| couponChannelQ.setSubTargetId(record.getId()); | couponChannelQ.setSubTargetId(record.getId()); | ||||
| couponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | couponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); | ||||
| //TODO 待优化数据 | |||||
| List<WxCouponChannelVo> wxCouponChannelVos = RedisCacheUtils.getCacheListObject(redisTemplate, "gameCoupons:"+record.getId(), WxCouponChannelVo.class); | |||||
| if (null == wxCouponChannelVos) { | |||||
| wxCouponChannelVos = wxCouponChannelService.listVo(couponChannelQ); | |||||
| if (null != wxCouponChannelVos) { | |||||
| RedisCacheUtils.cache(redisTemplate, "gameCoupons:"+record.getId(), wxCouponChannelVos, 3600); | |||||
| } | |||||
| } | |||||
| List<WxCouponChannelVo> voList = wxCouponChannelService.newfindListVo(couponChannelQ); | |||||
| Map<Long, WxCouponChannelVo> wxCouponChannelsMap = new HashMap<Long, WxCouponChannelVo>(); | Map<Long, WxCouponChannelVo> wxCouponChannelsMap = new HashMap<Long, WxCouponChannelVo>(); | ||||
| for(WxCouponChannelVo wxCouponChannelVo: wxCouponChannelVos) { | |||||
| for(WxCouponChannelVo wxCouponChannelVo: voList) { | |||||
| wxCouponChannelsMap.put(wxCouponChannelVo.getCouponId(), wxCouponChannelVo); | wxCouponChannelsMap.put(wxCouponChannelVo.getCouponId(), wxCouponChannelVo); | ||||
| } | } | ||||
| @@ -244,10 +244,8 @@ public class WxTopicServiceImpl implements WxTopicService { | |||||
| wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | wxCouponChannel.setSortColumns(BaseEntity.SortField.CCUpdateDate_DESC, BaseEntity.SortField.CCId_DESC); | ||||
| wxCouponChannel.setShowBeginTime(new Date()); | wxCouponChannel.setShowBeginTime(new Date()); | ||||
| wxCouponChannel.setSubTargetId(wxTopic.getId()); | wxCouponChannel.setSubTargetId(wxTopic.getId()); | ||||
| List<WxCouponChannelVo> wxCouponChannelVos = wxCouponChannelService.listVo(wxCouponChannel); | |||||
| if(wxCouponChannelVos != null && wxCouponChannelVos.size() > 0){ | |||||
| wxTopic.setCouponList(wxCouponChannelVos); | |||||
| } | |||||
| List<WxCouponChannelVo> voList = wxCouponChannelService.newfindListVo(wxCouponChannel); | |||||
| wxTopic.setCouponList(voList); | |||||
| } | } | ||||
| return wxTopic; | return wxTopic; | ||||
| } | } | ||||
| @@ -213,13 +213,6 @@ | |||||
| <result column="content_type" jdbcType="INTEGER" property="contentType"/> | <result column="content_type" jdbcType="INTEGER" property="contentType"/> | ||||
| <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | ||||
| <!--<collection column="{productId=coupon_id,tenantId=tenant_id}" property="merchantVoList" | |||||
| ofType="com.iformall.domain.vo.WxMerchantVo" | |||||
| javaType="java.util.List" | |||||
| select="com.iformall.mapper.WxCouponMerchantMapper.findMerchantNameList" > | |||||
| </collection>--> | |||||
| </resultMap> | </resultMap> | ||||
| <select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | <select id="findVoList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="CouponChannelVoMap"> | ||||
| @@ -434,4 +427,87 @@ | |||||
| </update> | </update> | ||||
| <select id="newfindCList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap"> | |||||
| select cc.`id`,cc.`tenant_id`,cc.`parent_tenant_id`,cc.`coupon_id`,cc.`coupon_status`,cc.`type`,cc.`title`, | |||||
| cc.`target_ad`,cc.`business`,cc.`sub_business`,cc.`show_begin_time`,cc.`begin_time`,cc.`end_time`,cc.`status`, | |||||
| cc.`create_date`,cc.`update_date`,cc.`sub_target_id`,cc.qr_code | |||||
| from wx_coupon_channel cc | |||||
| where cc.status = 0 | |||||
| <if test=" null != id "> | |||||
| and cc.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and cc.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and cc.`parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != couponId "> | |||||
| and cc.`coupon_id` = #{couponId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and cc.`type` = #{type} | |||||
| </if> | |||||
| <if test=" null != title and ''!= title"> | |||||
| and cc.`title` like concat('%', #{title},'%') | |||||
| </if> | |||||
| <if test=" null != targetAd "> | |||||
| and cc.`target_ad` = #{targetAd} | |||||
| </if> | |||||
| <if test=" null != business "> | |||||
| and cc.`business` = #{business} | |||||
| </if> | |||||
| <if test=" null != subBusiness "> | |||||
| and cc.`sub_business` = #{subBusiness} | |||||
| </if> | |||||
| <if test=" null != showBeginTime "> | |||||
| and cc.`show_begin_time` <= #{showBeginTime} | |||||
| </if> | |||||
| <if test=" null != startdate and null!=enddate"> | |||||
| and cc.`create_date` between #{startdate} and #{enddate} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and cc.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and cc.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and cc.`update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != subTargetId "> | |||||
| and cc.`sub_target_id` = #{subTargetId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and cm.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and cc.id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != couponIds "> | |||||
| and cc.coupon_id in | |||||
| <foreach collection="couponIds" index="index" item="couponIdsItem" open="(" separator="," close=")"> | |||||
| #{couponIdsItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -255,6 +255,9 @@ | |||||
| <if test=" null != creditPrice "> | <if test=" null != creditPrice "> | ||||
| and `credit_price` = #{creditPrice} | and `credit_price` = #{creditPrice} | ||||
| </if> | </if> | ||||
| <if test=" null != userCredit "> | |||||
| and `credit_price` <= #{userCredit} | |||||
| </if> | |||||
| <if test=" null != creditRefund "> | <if test=" null != creditRefund "> | ||||
| and `credit_refund` = #{creditRefund} | and `credit_refund` = #{creditRefund} | ||||
| @@ -1228,4 +1231,21 @@ | |||||
| <update id="updateValidEndDate" parameterType="com.iformall.domain.po.WxCoupon"> | <update id="updateValidEndDate" parameterType="com.iformall.domain.po.WxCoupon"> | ||||
| update wx_coupon set valid_end_date = #{validEndDate} , update_date = #{updateDate} where id = #{id} | update wx_coupon set valid_end_date = #{validEndDate} , update_date = #{updateDate} where id = #{id} | ||||
| </update> | </update> | ||||
| <select id="newfindCList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | |||||
| select id,remain_inventory,inventory,cover_img,sub_title,sale_price,use_price,price,tail_price, | |||||
| orig_price,unit,use_limit_rule,use_limit_quantity,send_type,support_transfer,press_limit_num,auto_refund, | |||||
| conditions,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date,valid_days,credit_price, | |||||
| content_type,source_type | |||||
| from wx_coupon where `tenant_id` = #{tenantId} | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -173,6 +173,19 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id = "findOneMerchantProductIds" parameterType="java.util.Map" resultType="Long"> | |||||
| SELECT wcm.product_id | |||||
| FROM wx_coupon_merchant wcm | |||||
| WHERE wcm.STATUS = 0 | |||||
| <if test=" null != tenantId and '' != tenantId"> | |||||
| and wcm.`tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId"> | |||||
| and wcm.merchant_id = #{merchantId} | |||||
| </if> | |||||
| </select> | |||||
| <select id = "findMerchantByProductIds" parameterType="java.util.Map" resultType="Long"> | <select id = "findMerchantByProductIds" parameterType="java.util.Map" resultType="Long"> | ||||
| SELECT distinct wcm.merchant_id | SELECT distinct wcm.merchant_id | ||||
| FROM wx_coupon_merchant wcm | FROM wx_coupon_merchant wcm | ||||