xuhy
2025-01-09 712f70b2936079a131ecb1e63c6d337171618cad
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package com.stylefeng.guns.modular.system.controller.general;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.factory.PageFactory;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.system.model.TMerchant;
import com.stylefeng.guns.modular.system.model.TMerchantActivity;
import com.stylefeng.guns.modular.system.service.ITMerchantActivityService;
import com.stylefeng.guns.modular.system.service.ITMerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.List;
import java.util.Map;
 
@Controller
@RequestMapping("/tMerchant")
public class TMerchantController extends BaseController {
 
    private String PREFIX = "/system/tMerchant/";
 
    @Autowired
    private ITMerchantService merchantService;
 
    @Autowired
    private ITMerchantActivityService merchantActivityService;
 
    ///   跳转商家审核
    @RequestMapping("")
    public String index(){
        return PREFIX + "tMerchantAudit.html";
    }
 
    ///   跳转商家列表
    @RequestMapping("/tMerchantIndex")
    public String tMerchantIndex(){
        return PREFIX + "tMerchantIndex.html";
    }
 
 
    ///   获取商家审核列表
    @RequestMapping("/tMerchantAuditList")
    @ResponseBody
    public Object tMerchantAuditList(String startTime, String endTime, String name, Integer auditStatus){
        Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage();
        Wrapper wrapper = new EntityWrapper<TMerchant>().orderBy("id",false);
        if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
            wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
        }
        if (ToolUtil.isNotEmpty(name)){
            wrapper.like("name",name);
        }
        if (ToolUtil.isNotEmpty(auditStatus)){
            wrapper.eq("auditStatus",auditStatus);
        }
 
        page.setRecords(merchantService.selectMapsPage(page,wrapper).getRecords());
        return super.packForBT(page);
    }
 
    ///   获取商家列表
    @RequestMapping("/tMerchantList")
    @ResponseBody
    public Object tMerchantList(String startTime, String endTime, String name){
        Page<Map<String,Object>> page = new PageFactory<Map<String,Object>>().defaultPage();
        Wrapper wrapper = new EntityWrapper<TMerchant>().orderBy("id",false).eq("auditStatus",2);
        if (ToolUtil.isNotEmpty(startTime) && ToolUtil.isNotEmpty(endTime)){
            wrapper.between("createTime",startTime + " 00:00:00",endTime + " 23:59:59");
        }
        if (ToolUtil.isNotEmpty(name)){
            wrapper.like("name",name);
        }
 
        List<Map<String,Object>> list = merchantService.selectMapsPage(page,wrapper).getRecords();
        for (Map<String, Object> map : list) {
            List<TMerchantActivity> list1 = merchantActivityService.selectList(new EntityWrapper<TMerchantActivity>().eq("merchantId",map.get("id")));
            map.put("activityNum",list1.size());
        }
        page.setRecords(list);
        return super.packForBT(page);
    }
 
    ///   商家审核
    @RequestMapping("/AuditSubmit")
    @ResponseBody
    public Object AuditSubmit(TMerchant tMerchant){
        merchantService.updateById(tMerchant);
        return SUCCESS_TIP;
    }
 
 
    ///   冻结和解冻
    @RequestMapping("/updateState")
    @ResponseBody
    public Object updateState(TMerchant tMerchant){
        merchantService.updateById(tMerchant);
        return SUCCESS_TIP;
    }
}