935090232@qq.com
2021-03-19 81a3369395a7cccceb7cd36f5238cc6fe2aa88e5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.matrix.system.shopXcx.api.action;
 
import com.matrix.core.pojo.AjaxResult;
import com.matrix.system.common.interceptor.HostInterceptor;
import com.matrix.system.shopXcx.bean.ShopAdvertis;
import com.matrix.system.shopXcx.bean.ShopAdvertisType;
import com.matrix.system.shopXcx.dao.ShopAdvertisDao;
import com.matrix.system.shopXcx.dao.ShopAdvertisTypeDao;
import com.matrix.system.shopXcx.shopEnum.ShopAdNodeType;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author jyy
 * @description 广告表
 * @date 2019-06-05 10:15
 */
@CrossOrigin(origins = "*", maxAge = 3600)
@Controller
@RequestMapping(value = "/wxapi/ad")
public class WxAdvertisingAction {
    @Autowired
    private ShopAdvertisDao shopAdvertisDao;
    @Autowired
    private ShopAdvertisTypeDao shopAdvertisTypeDao;
 
 
 
 
    @RequestMapping("/getAdPage")
    @ResponseBody
    public AjaxResult getAdPage(@RequestBody  ShopAdvertisType shopAdvertisType) {
        shopAdvertisType.setCompanyId(HostInterceptor.getCompanyId());
        List<ShopAdvertisType> shopAdvertisTypes = shopAdvertisTypeDao.selectByModel(shopAdvertisType);
        for (ShopAdvertisType advertisType : shopAdvertisTypes) {
            if (ShopAdNodeType.NODE_TYPE_SWIPER.getCode() == advertisType.getNodeType()
                    || ShopAdNodeType.NODE_TYPE_HUKUAI.getCode() == advertisType.getNodeType()
            ) {
                //轮播图类型
                List<ShopAdvertis> advertisingList = shopAdvertisDao.selectListByTypeId(advertisType.getAdtId(), advertisType.getAdtCapacity());
                advertisType.setAds(advertisingList);
            }
        }
 
        return AjaxResult.buildSuccessInstance(shopAdvertisTypes);
    }
 
 
 
    @RequestMapping("/getAdByCode")
    @ResponseBody
    public AjaxResult getAdByCode(@RequestBody  ShopAdvertis shopAdvertis) {
        shopAdvertis.setCompanyId(HostInterceptor.getCompanyId());
        return AjaxResult.buildSuccessInstance(shopAdvertisDao.selectByModel(shopAdvertis));
    }
 
 
 
 
}